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

feat: add new config maxDataLineLength

This commit is contained in:
2023-01-11 19:51:07 +05:00
parent 985ed41a4b
commit 7a46e9857e
10 changed files with 251 additions and 13 deletions

View File

@@ -35,6 +35,7 @@ export class LintConfig {
readonly pathLintRules: PathLintRule[] = []
readonly maxLineLength: number = 80
readonly maxHeaderLineLength: number = 80
readonly maxDataLineLength: number = 80
readonly indentationMultiple: number = 2
readonly lineEndings: LineEndings = LineEndings.LF
readonly defaultHeader: string = getDefaultHeader()
@@ -75,6 +76,10 @@ export class LintConfig {
if (!isNaN(json?.maxHeaderLineLength)) {
this.maxHeaderLineLength = json.maxHeaderLineLength
}
if (!isNaN(json?.maxDataLineLength)) {
this.maxDataLineLength = json.maxDataLineLength
}
}
this.fileLintRules.push(lineEndings)

View File

@@ -13,6 +13,11 @@ export interface LintRule {
message: string
}
export interface LineLintRuleOptions {
isHeaderLine?: boolean
isDataLine?: boolean
}
/**
* A LineLintRule is run once per line of text.
*/
@@ -22,7 +27,7 @@ export interface LineLintRule extends LintRule {
value: string,
lineNumber: number,
config?: LintConfig,
isHeaderLine?: boolean
options?: LineLintRuleOptions
) => Diagnostic[]
fix?: (value: string, config?: LintConfig) => string
}