mirror of
https://github.com/sasjs/lint.git
synced 2026-01-17 09:10:06 +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.",
|
"description": "Enforces Macro Definition syntax. Shows a warning when incorrect syntax is used.",
|
||||||
"default": true,
|
"default": true,
|
||||||
"examples": [true, false]
|
"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.
|
* More types of rules, when available, will be added here.
|
||||||
*/
|
*/
|
||||||
export class LintConfig {
|
export class LintConfig {
|
||||||
|
readonly ignoreList: string[] = []
|
||||||
readonly lineLintRules: LineLintRule[] = []
|
readonly lineLintRules: LineLintRule[] = []
|
||||||
readonly fileLintRules: FileLintRule[] = []
|
readonly fileLintRules: FileLintRule[] = []
|
||||||
readonly pathLintRules: PathLintRule[] = []
|
readonly pathLintRules: PathLintRule[] = []
|
||||||
@@ -33,6 +34,20 @@ export class LintConfig {
|
|||||||
readonly lineEndings: LineEndings = LineEndings.LF
|
readonly lineEndings: LineEndings = LineEndings.LF
|
||||||
|
|
||||||
constructor(json?: any) {
|
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) {
|
if (json?.noTrailingSpaces) {
|
||||||
this.lineLintRules.push(noTrailingSpaces)
|
this.lineLintRules.push(noTrailingSpaces)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user