1
0
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:
Krishna Acondy
2021-03-26 09:13:07 +00:00
parent 3631f5c25c
commit 8fc3c39993
3 changed files with 9 additions and 2 deletions

View File

@@ -1,2 +1,3 @@
export { lintText, lintFile } from './lint'
export * from './types'
export * from './utils'

View File

@@ -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
View File

@@ -0,0 +1,2 @@
export * from './getLintConfig'
export * from './getProjectRoot'