1
0
mirror of https://github.com/sasjs/lint.git synced 2026-01-14 07:40:05 +00:00

fix(*): Add severity, start and end column numbers for diagnostics, change warning to message

This commit is contained in:
Krishna Acondy
2021-03-24 09:11:09 +00:00
parent 702756545b
commit de1fabc394
12 changed files with 126 additions and 37 deletions

View File

@@ -10,14 +10,15 @@ const defaultConfiguration = {
}
/**
* Fetches the config from the .sasjslint file and creates a LintConfig object.
* Returns the default configuration when a .sasjslint file is unavailable.
* @returns {Promise<LintConfig>} resolves with an object representing the current lint configuration.
*/
export async function getLintConfig(): Promise<LintConfig> {
const projectRoot = await getProjectRoot()
const configuration = await readFile(
path.join(projectRoot, '.sasjslint')
).catch((e) => {
console.error('Error reading .sasjslint file', e)
).catch((_) => {
console.warn('Unable to load .sasjslint file. Using default configuration.')
return JSON.stringify(defaultConfiguration)
})
return new LintConfig(JSON.parse(configuration))