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

feat(lint): add rules for lowercase file names, max line length and no tab indentation

This commit is contained in:
Krishna Acondy
2021-03-26 09:09:42 +00:00
parent 1be358ca51
commit 3631f5c25c
15 changed files with 265 additions and 12 deletions

View File

@@ -0,0 +1,30 @@
import { LineLintRule } from '../types/LintRule'
import { LintRuleType } from '../types/LintRuleType'
import { Severity } from '../types/Severity'
const name = 'noTabs'
const description = 'Disallow indenting with tabs.'
const message = 'Line is indented with a tab'
const test = (value: string, lineNumber: number) => {
if (!value.startsWith('\t')) return []
return [
{
message,
lineNumber,
startColumnNumber: 1,
endColumnNumber: 1,
severity: Severity.Warning
}
]
}
/**
* Lint rule that checks if a given line of text is indented with a tab.
*/
export const noTabIndentation: LineLintRule = {
type: LintRuleType.Line,
name,
description,
message,
test
}