File tree 4 files changed +13
-6
lines changed
4 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 1
1
import { rules as ruleLint } from "../../all-rules"
2
+ import type { SeverityString } from "../../types"
2
3
import { rules as recommendedRules } from "./recommended"
3
4
4
- const all : Record < string , string > = { }
5
+ const all : Record < string , SeverityString > = { }
5
6
for ( const rule of ruleLint ) {
6
7
all [ rule . meta . docs . ruleId ] = "error"
7
8
}
Original file line number Diff line number Diff line change 1
- export const rules = {
1
+ import type { SeverityString } from "../../types"
2
+
3
+ export const rules : Record < string , SeverityString > = {
2
4
// ESLint core rules
3
5
"no-control-regex" : "error" ,
4
6
"no-misleading-character-class" : "error" ,
@@ -70,4 +72,4 @@ export const rules = {
70
72
"regexp/sort-flags" : "error" ,
71
73
"regexp/strict" : "error" ,
72
74
"regexp/use-ignore-case" : "error" ,
73
- } as const
75
+ }
Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ export type RuleCategory =
13
13
| "Best Practices"
14
14
| "Stylistic Issues"
15
15
16
+ export type SeverityString = "error" | "warn" | "off"
17
+
16
18
export interface RuleMetaData {
17
19
docs : {
18
20
description : string
@@ -21,7 +23,7 @@ export interface RuleMetaData {
21
23
url : string
22
24
ruleId : string
23
25
ruleName : string
24
- default ?: "error" | "warn"
26
+ default ?: Exclude < SeverityString , "off" >
25
27
}
26
28
messages : { [ messageId : string ] : string }
27
29
fixable ?: "code" | "whitespace"
@@ -42,7 +44,7 @@ export interface PartialRuleMetaData {
42
44
description : string
43
45
category : RuleCategory
44
46
recommended : boolean
45
- default ?: "error" | "warn"
47
+ default ?: Exclude < SeverityString , "off" >
46
48
}
47
49
messages : { [ messageId : string ] : string }
48
50
fixable ?: "code" | "whitespace"
Original file line number Diff line number Diff line change @@ -14,7 +14,9 @@ const coreRules = [
14
14
// "require-unicode-regexp", // modern
15
15
]
16
16
17
- const content = `export const rules = {
17
+ const content = `import type { SeverityString } from "../../types"
18
+
19
+ export const rules: Record<string, SeverityString> = {
18
20
// ESLint core rules
19
21
${ coreRules . map ( ( ruleName ) => `"${ ruleName } ": "error"` ) . join ( ",\n " ) } ,
20
22
// The ESLint rule will report fewer cases than our rule
You can’t perform that action at this time.
0 commit comments