Skip to content

Commit df3263b

Browse files
nzakasmdjermanovic
andauthored
feat: Add more type definitions (#81)
Co-authored-by: Milos Djermanovic <[email protected]>
1 parent b3a22fa commit df3263b

File tree

1 file changed

+47
-3
lines changed

1 file changed

+47
-3
lines changed

packages/core/src/types.ts

+47-3
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,56 @@ export interface Position {
5959
// Config
6060
//------------------------------------------------------------------------------
6161

62-
export type RuleSeverity = 0 | 1 | 2 | "off" | "warn" | "error";
62+
/**
63+
* The human readable severity level used in a configuration.
64+
*/
65+
export type SeverityName = "off" | "warn" | "error";
66+
67+
/**
68+
* The numeric severity level for a rule.
69+
*
70+
* - `0` means off.
71+
* - `1` means warn.
72+
* - `2` means error.
73+
*
74+
*/
75+
export type SeverityLevel = 0 | 1 | 2;
76+
77+
/**
78+
* The severity of a rule in a configuration.
79+
*/
80+
export type Severity = SeverityName | SeverityLevel;
81+
82+
/**
83+
* Represents the configuration options for the core linter.
84+
*/
85+
export interface LinterOptionsConfig {
86+
/**
87+
* Indicates whether or not inline configuration is evaluated.
88+
*/
89+
noInlineConfig?: boolean;
90+
91+
/**
92+
* Indicates what to do when an unused disable directive is found.
93+
*/
94+
reportUnusedDisableDirectives?: boolean | Severity;
95+
}
96+
97+
/**
98+
* Shared settings that are accessible from within plugins.
99+
*/
100+
export type SettingsConfig = Record<string, unknown>;
63101

64-
export type RuleConfig = RuleSeverity | [RuleSeverity, ...any[]];
102+
/**
103+
* The configuration for a rule.
104+
*/
105+
export type RuleConfig = Severity | [Severity, ...any[]];
65106

107+
/**
108+
* A collection of rules and their configurations.
109+
*/
66110
export interface RulesConfig {
67-
[key: string]: RuleConfig;
111+
[ruleId: string]: RuleConfig;
68112
}
69113

70114
//------------------------------------------------------------------------------

0 commit comments

Comments
 (0)