Skip to content

Commit

Permalink
fix: update the logic for default values of rules
Browse files Browse the repository at this point in the history
  • Loading branch information
sabhas committed Dec 28, 2022
1 parent 5c44ec4 commit 24fba78
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions src/types/LintConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,25 @@ export class LintConfig {
}
}

if (json?.noTrailingSpaces) {
if (json?.noTrailingSpaces !== false) {
this.lineLintRules.push(noTrailingSpaces)
}

if (json?.noEncodedPasswords) {
if (json?.noEncodedPasswords !== false) {
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.lineLintRules.push(maxLineLength)
}

this.fileLintRules.push(lineEndings)
if (json?.lineEndings) {
if (
json.lineEndings !== LineEndings.LF &&
Expand All @@ -80,47 +82,46 @@ export class LintConfig {
)
}
this.lineEndings = json.lineEndings
this.fileLintRules.push(lineEndings)
}

this.lineLintRules.push(indentationMultiple)
if (!isNaN(json?.indentationMultiple)) {
this.indentationMultiple = json.indentationMultiple as number
this.lineLintRules.push(indentationMultiple)
}

if (json?.hasDoxygenHeader) {
if (json?.hasDoxygenHeader !== false) {
this.fileLintRules.push(hasDoxygenHeader)
}

if (json?.defaultHeader) {
this.defaultHeader = json.defaultHeader
}

if (json?.noSpacesInFileNames) {
if (json?.noSpacesInFileNames !== false) {
this.pathLintRules.push(noSpacesInFileNames)
}

if (json?.lowerCaseFileNames) {
if (json?.lowerCaseFileNames !== false) {
this.pathLintRules.push(lowerCaseFileNames)
}

if (json?.hasMacroNameInMend) {
this.fileLintRules.push(hasMacroNameInMend)
}

if (json?.noNestedMacros) {
if (json?.noNestedMacros !== false) {
this.fileLintRules.push(noNestedMacros)
}

if (json?.hasMacroParentheses) {
if (json?.hasMacroParentheses !== false) {
this.fileLintRules.push(hasMacroParentheses)
}

if (json?.strictMacroDefinition) {
if (json?.strictMacroDefinition !== false) {
this.fileLintRules.push(strictMacroDefinition)
}

if (json?.noGremlins === undefined || json?.noGremlins) {
if (json?.noGremlins !== false) {
this.lineLintRules.push(noGremlins)
}

Expand Down

0 comments on commit 24fba78

Please sign in to comment.