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:
@@ -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"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user