mirror of
https://github.com/sasjs/lint.git
synced 2026-01-16 00:30:05 +00:00
fix: maxLineLength rule should be off when non positive number is provided
This commit is contained in:
@@ -31,7 +31,7 @@ describe('LintConfig', () => {
|
|||||||
).toBeUndefined()
|
).toBeUndefined()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should create an instance with the maxLineLength flag off', () => {
|
it('should create an instance with the maxLineLength flag off by setting value to 0', () => {
|
||||||
const config = new LintConfig({ maxLineLength: 0 })
|
const config = new LintConfig({ maxLineLength: 0 })
|
||||||
|
|
||||||
expect(config).toBeTruthy()
|
expect(config).toBeTruthy()
|
||||||
@@ -42,6 +42,17 @@ describe('LintConfig', () => {
|
|||||||
).toBeUndefined()
|
).toBeUndefined()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should create an instance with the maxLineLength flag off by setting value to a negative number', () => {
|
||||||
|
const config = new LintConfig({ maxLineLength: -1 })
|
||||||
|
|
||||||
|
expect(config).toBeTruthy()
|
||||||
|
expect(config.lineLintRules.length).toBeGreaterThan(0)
|
||||||
|
expect(config.fileLintRules.length).toBeGreaterThan(0)
|
||||||
|
expect(
|
||||||
|
config.lineLintRules.find((rule) => rule.name === 'maxLineLength')
|
||||||
|
).toBeUndefined()
|
||||||
|
})
|
||||||
|
|
||||||
it('should create an instance with the hasDoxygenHeader flag off', () => {
|
it('should create an instance with the hasDoxygenHeader flag off', () => {
|
||||||
const config = new LintConfig({ hasDoxygenHeader: false })
|
const config = new LintConfig({ hasDoxygenHeader: false })
|
||||||
|
|
||||||
|
|||||||
@@ -68,12 +68,9 @@ export class LintConfig {
|
|||||||
this.lineLintRules.pop()
|
this.lineLintRules.pop()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (json?.maxLineLength) {
|
if (json?.maxLineLength > 0) {
|
||||||
this.lineLintRules.push(maxLineLength)
|
this.lineLintRules.push(maxLineLength)
|
||||||
|
this.maxLineLength = json.maxLineLength
|
||||||
if (!isNaN(json?.maxLineLength)) {
|
|
||||||
this.maxLineLength = json.maxLineLength
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isNaN(json?.maxHeaderLineLength)) {
|
if (!isNaN(json?.maxHeaderLineLength)) {
|
||||||
this.maxHeaderLineLength = json.maxHeaderLineLength
|
this.maxHeaderLineLength = json.maxHeaderLineLength
|
||||||
|
|||||||
Reference in New Issue
Block a user