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:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
8
src/types/Severity.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Severity indicates the seriousness of a given violation.
|
||||
*/
|
||||
export enum Severity {
|
||||
Info,
|
||||
Warning,
|
||||
Error
|
||||
}
|
||||
Reference in New Issue
Block a user