Skip to content

Commit

Permalink
feat: add a new attribute ignoreList to .sasjslint (LintConfig)
Browse files Browse the repository at this point in the history
  • Loading branch information
sabhas committed Aug 12, 2022
1 parent 51c6dd7 commit e1bcf5b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sasjslint-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
}
}
15 changes: 15 additions & 0 deletions src/types/LintConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = []
Expand All @@ -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)
}
Expand Down

0 comments on commit e1bcf5b

Please sign in to comment.