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