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

feat: add a new config maxHeaderLineLength

This commit is contained in:
2023-01-10 14:48:18 +05:00
parent 4cb2fe8a69
commit b6e9ee0825
10 changed files with 107 additions and 10 deletions

View File

@@ -7,9 +7,19 @@ const name = 'maxLineLength'
const description = 'Restrict lines to the specified length.'
const message = 'Line exceeds maximum length'
const test = (value: string, lineNumber: number, config?: LintConfig) => {
const test = (
value: string,
lineNumber: number,
config?: LintConfig,
isHeaderLine?: boolean
) => {
const severity = config?.severityLevel[name] || Severity.Warning
const maxLineLength = config?.maxLineLength || 80
let maxLineLength = config?.maxLineLength || 80
if (isHeaderLine && config) {
maxLineLength = Math.max(config.maxLineLength, config.maxHeaderLineLength)
}
if (value.length <= maxLineLength) return []
return [
{