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

fix(*): Add severity, start and end column numbers for diagnostics, change warning to message

This commit is contained in:
Krishna Acondy
2021-03-24 09:11:09 +00:00
parent 702756545b
commit de1fabc394
12 changed files with 126 additions and 37 deletions

View File

@@ -1,8 +1,12 @@
import { Severity } from './Severity'
/**
* A diagnostic is produced by the execution of a lint rule against a file or line of text.
*/
export interface Diagnostic {
lineNumber: number
columnNumber: number
warning: string
startColumnNumber: number
endColumnNumber: number
message: string
severity: Severity
}

View File

@@ -2,14 +2,14 @@ import { Diagnostic } from './Diagnostic'
import { LintRuleType } from './LintRuleType'
/**
* A lint rule is defined by a type, name, description, warning text and a test function.
* A lint rule is defined by a type, name, description, message 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
message: string
test: (value: string, lineNumber: number) => Diagnostic[]
}

8
src/types/Severity.ts Normal file
View File

@@ -0,0 +1,8 @@
/**
* Severity indicates the seriousness of a given violation.
*/
export enum Severity {
Info,
Warning,
Error
}