mirror of
https://github.com/sasjs/lint.git
synced 2026-01-14 07:40:05 +00:00
fix(lint): ignore indentation multiple when set to zero
This commit is contained in:
@@ -40,6 +40,20 @@ describe('LintConfig', () => {
|
||||
expect(config.fileLintRules[0].type).toEqual(LintRuleType.File)
|
||||
})
|
||||
|
||||
it('should create an instance with the indentation multiple set', () => {
|
||||
const config = new LintConfig({ indentationMultiple: 5 })
|
||||
|
||||
expect(config).toBeTruthy()
|
||||
expect(config.indentationMultiple).toEqual(5)
|
||||
})
|
||||
|
||||
it('should create an instance with the indentation multiple turned off', () => {
|
||||
const config = new LintConfig({ indentationMultiple: 0 })
|
||||
|
||||
expect(config).toBeTruthy()
|
||||
expect(config.indentationMultiple).toEqual(0)
|
||||
})
|
||||
|
||||
it('should create an instance with all flags set', () => {
|
||||
const config = new LintConfig({
|
||||
noTrailingSpaces: true,
|
||||
|
||||
@@ -19,8 +19,8 @@ export class LintConfig {
|
||||
readonly lineLintRules: LineLintRule[] = []
|
||||
readonly fileLintRules: FileLintRule[] = []
|
||||
readonly pathLintRules: PathLintRule[] = []
|
||||
readonly maxLineLength = 80
|
||||
readonly indentationMultiple = 2
|
||||
readonly maxLineLength: number = 80
|
||||
readonly indentationMultiple: number = 2
|
||||
|
||||
constructor(json?: any) {
|
||||
if (json?.noTrailingSpaces) {
|
||||
@@ -40,8 +40,8 @@ export class LintConfig {
|
||||
this.lineLintRules.push(maxLineLength)
|
||||
}
|
||||
|
||||
if (json?.indentationMultiple) {
|
||||
this.indentationMultiple = json.indentationMultiple
|
||||
if (!isNaN(json?.indentationMultiple)) {
|
||||
this.indentationMultiple = json.indentationMultiple as number
|
||||
this.lineLintRules.push(indentationMultiple)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user