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

fix: update the logic for default values of rules

This commit is contained in:
2022-12-29 00:49:13 +05:00
parent 5c44ec400d
commit 24fba7867c

View File

@@ -53,23 +53,25 @@ export class LintConfig {
} }
} }
if (json?.noTrailingSpaces) { if (json?.noTrailingSpaces !== false) {
this.lineLintRules.push(noTrailingSpaces) this.lineLintRules.push(noTrailingSpaces)
} }
if (json?.noEncodedPasswords) { if (json?.noEncodedPasswords !== false) {
this.lineLintRules.push(noEncodedPasswords) this.lineLintRules.push(noEncodedPasswords)
} }
if (json?.noTabs || json?.noTabIndentation) { this.lineLintRules.push(noTabs)
this.lineLintRules.push(noTabs) if (json?.noTabs === false || json?.noTabIndentation === false) {
this.lineLintRules.pop()
} }
if (json?.maxLineLength) { this.lineLintRules.push(maxLineLength)
if (!isNaN(json?.maxLineLength)) {
this.maxLineLength = json.maxLineLength this.maxLineLength = json.maxLineLength
this.lineLintRules.push(maxLineLength)
} }
this.fileLintRules.push(lineEndings)
if (json?.lineEndings) { if (json?.lineEndings) {
if ( if (
json.lineEndings !== LineEndings.LF && json.lineEndings !== LineEndings.LF &&
@@ -80,15 +82,14 @@ export class LintConfig {
) )
} }
this.lineEndings = json.lineEndings this.lineEndings = json.lineEndings
this.fileLintRules.push(lineEndings)
} }
this.lineLintRules.push(indentationMultiple)
if (!isNaN(json?.indentationMultiple)) { if (!isNaN(json?.indentationMultiple)) {
this.indentationMultiple = json.indentationMultiple as number this.indentationMultiple = json.indentationMultiple as number
this.lineLintRules.push(indentationMultiple)
} }
if (json?.hasDoxygenHeader) { if (json?.hasDoxygenHeader !== false) {
this.fileLintRules.push(hasDoxygenHeader) this.fileLintRules.push(hasDoxygenHeader)
} }
@@ -96,11 +97,11 @@ export class LintConfig {
this.defaultHeader = json.defaultHeader this.defaultHeader = json.defaultHeader
} }
if (json?.noSpacesInFileNames) { if (json?.noSpacesInFileNames !== false) {
this.pathLintRules.push(noSpacesInFileNames) this.pathLintRules.push(noSpacesInFileNames)
} }
if (json?.lowerCaseFileNames) { if (json?.lowerCaseFileNames !== false) {
this.pathLintRules.push(lowerCaseFileNames) this.pathLintRules.push(lowerCaseFileNames)
} }
@@ -108,19 +109,19 @@ export class LintConfig {
this.fileLintRules.push(hasMacroNameInMend) this.fileLintRules.push(hasMacroNameInMend)
} }
if (json?.noNestedMacros) { if (json?.noNestedMacros !== false) {
this.fileLintRules.push(noNestedMacros) this.fileLintRules.push(noNestedMacros)
} }
if (json?.hasMacroParentheses) { if (json?.hasMacroParentheses !== false) {
this.fileLintRules.push(hasMacroParentheses) this.fileLintRules.push(hasMacroParentheses)
} }
if (json?.strictMacroDefinition) { if (json?.strictMacroDefinition !== false) {
this.fileLintRules.push(strictMacroDefinition) this.fileLintRules.push(strictMacroDefinition)
} }
if (json?.noGremlins === undefined || json?.noGremlins) { if (json?.noGremlins !== false) {
this.lineLintRules.push(noGremlins) this.lineLintRules.push(noGremlins)
} }