mirror of
https://github.com/sasjs/lint.git
synced 2026-01-05 11:40:06 +00:00
chore(*): organise rules into folders by type
This commit is contained in:
30
src/rules/line/noTrailingSpaces.ts
Normal file
30
src/rules/line/noTrailingSpaces.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { LineLintRule } from '../../types/LintRule'
|
||||
import { LintRuleType } from '../../types/LintRuleType'
|
||||
import { Severity } from '../../types/Severity'
|
||||
|
||||
const name = 'noTrailingSpaces'
|
||||
const description = 'Disallow trailing spaces on lines.'
|
||||
const message = 'Line contains trailing spaces'
|
||||
const test = (value: string, lineNumber: number) =>
|
||||
value.trimEnd() === value
|
||||
? []
|
||||
: [
|
||||
{
|
||||
message,
|
||||
lineNumber,
|
||||
startColumnNumber: value.trimEnd().length + 1,
|
||||
endColumnNumber: value.length,
|
||||
severity: Severity.Warning
|
||||
}
|
||||
]
|
||||
|
||||
/**
|
||||
* Lint rule that checks for the presence of trailing space(s) in a given line of text.
|
||||
*/
|
||||
export const noTrailingSpaces: LineLintRule = {
|
||||
type: LintRuleType.Line,
|
||||
name,
|
||||
description,
|
||||
message,
|
||||
test
|
||||
}
|
||||
Reference in New Issue
Block a user