1
0
mirror of https://github.com/sasjs/lint.git synced 2026-01-03 19:10:04 +00:00
Files
lint/src/types/LintRule.ts
2021-03-22 20:36:19 +00:00

30 lines
719 B
TypeScript

import { Diagnostic } from './Diagnostic'
import { LintRuleType } from './LintRuleType'
/**
* A lint rule is defined by a type, name, description, warning text and a test function.
* The test function produces a set of diagnostics when executed.
*/
export interface LintRule {
type: LintRuleType
name: string
description: string
warning: string
test: (value: string, lineNumber: number) => Diagnostic[]
}
/**
* A LineLintRule is run once per line of text.
*/
export interface LineLintRule extends LintRule {
type: LintRuleType.Line
}
/**
* A FileLintRule is run once per file.
*/
export interface FileLintRule extends LintRule {
type: LintRuleType.File
test: (value: string) => Diagnostic[]
}