mirror of
https://github.com/sasjs/lint.git
synced 2025-12-10 17:34:36 +00:00
chore(*): export utils modules and default config
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
export { lintText, lintFile } from './lint'
|
||||
export * from './types'
|
||||
export * from './utils'
|
||||
|
||||
@@ -3,7 +3,10 @@ import { LintConfig } from '../types/LintConfig'
|
||||
import { readFile } from '@sasjs/utils/file'
|
||||
import { getProjectRoot } from './getProjectRoot'
|
||||
|
||||
const defaultConfiguration = {
|
||||
/**
|
||||
* Default configuration that is used when a .sasjslint file is not found
|
||||
*/
|
||||
export const DefaultLintConfiguration = {
|
||||
noTrailingSpaces: true,
|
||||
noEncodedPasswords: true,
|
||||
hasDoxygenHeader: true,
|
||||
@@ -12,6 +15,7 @@ const defaultConfiguration = {
|
||||
maxLineLength: 80,
|
||||
noTabIndentation: true
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches the config from the .sasjslint file and creates a LintConfig object.
|
||||
* Returns the default configuration when a .sasjslint file is unavailable.
|
||||
@@ -23,7 +27,7 @@ export async function getLintConfig(): Promise<LintConfig> {
|
||||
path.join(projectRoot, '.sasjslint')
|
||||
).catch((_) => {
|
||||
console.warn('Unable to load .sasjslint file. Using default configuration.')
|
||||
return JSON.stringify(defaultConfiguration)
|
||||
return JSON.stringify(DefaultLintConfiguration)
|
||||
})
|
||||
return new LintConfig(JSON.parse(configuration))
|
||||
}
|
||||
|
||||
2
src/utils/index.ts
Normal file
2
src/utils/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './getLintConfig'
|
||||
export * from './getProjectRoot'
|
||||
Reference in New Issue
Block a user