1
0
mirror of https://github.com/sasjs/lint.git synced 2025-12-10 17:34:36 +00:00

feat: add a new attribute ignoreList to .sasjslint (LintConfig)

This commit is contained in:
2022-08-12 15:48:35 +05:00
parent 51c6dd7c1a
commit e1bcf5b06b
2 changed files with 23 additions and 0 deletions

View File

@@ -140,6 +140,14 @@
"description": "Enforces Macro Definition syntax. Shows a warning when incorrect syntax is used.",
"default": true,
"examples": [true, false]
},
"ignoreList": {
"$id": "#/properties/ignoreList",
"type": "object",
"title": "ignoreList",
"description": "An array of paths or path patterns to ignore matching resources from linting. Files or folders matching patterns in .gitignore will always be ignored.",
"default": ["sasjsbuild/", "sasjsresults/"],
"examples": ["sasjs/services", "appinit.sas"]
}
}
}

View File

@@ -25,6 +25,7 @@ import { FileLintRule, LineLintRule, PathLintRule } from './LintRule'
* More types of rules, when available, will be added here.
*/
export class LintConfig {
readonly ignoreList: string[] = []
readonly lineLintRules: LineLintRule[] = []
readonly fileLintRules: FileLintRule[] = []
readonly pathLintRules: PathLintRule[] = []
@@ -33,6 +34,20 @@ export class LintConfig {
readonly lineEndings: LineEndings = LineEndings.LF
constructor(json?: any) {
if (json?.ignoreList) {
if (Array.isArray(json.ignoreList)) {
json.ignoreList.forEach((item: any) => {
if (typeof item === 'string') this.ignoreList.push(item)
else
throw new Error(
`Property "ignoreList" has invalid type of values. It can contain only strings.`
)
})
} else {
throw new Error(`Property "ignoreList" can only be an array of strings`)
}
}
if (json?.noTrailingSpaces) {
this.lineLintRules.push(noTrailingSpaces)
}