mirror of
https://github.com/sasjs/lint.git
synced 2026-01-11 06:20:06 +00:00
chore(*): add PR template, add TSDoc comments
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
/**
|
||||
* 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
|
||||
|
||||
@@ -3,6 +3,13 @@ import { noEncodedPasswords } from '../rules/noEncodedPasswords'
|
||||
import { noTrailingSpaces } from '../rules/noTrailingSpaces'
|
||||
import { FileLintRule, LineLintRule } from './LintRule'
|
||||
|
||||
/**
|
||||
* LintConfig is the logical representation of the .sasjslint file.
|
||||
* It exposes two sets of rules - one to be run against each line in a file,
|
||||
* and one to be run once per file.
|
||||
*
|
||||
* More types of rules, when available, will be added here.
|
||||
*/
|
||||
export class LintConfig {
|
||||
readonly lineLintRules: LineLintRule[] = []
|
||||
readonly fileLintRules: FileLintRule[] = []
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
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
|
||||
@@ -9,10 +13,16 @@ export interface LintRule {
|
||||
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[]
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/**
|
||||
* The types of lint rules available.
|
||||
* This might be expanded to include lint rules for entire folders and projects.
|
||||
*/
|
||||
export enum LintRuleType {
|
||||
Line,
|
||||
File
|
||||
|
||||
Reference in New Issue
Block a user