This repository was archived by the owner on Mar 7, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +42
-5
lines changed Expand file tree Collapse file tree 2 files changed +42
-5
lines changed Original file line number Diff line number Diff line change 1
- import type { RuleSeverity } from './rule-severity' ;
1
+ import type { RuleLevel } from './rule-severity' ;
2
+
3
+ // Synced to https://github.com/DefinitelyTyped/DefinitelyTyped/blob/042141ce5f77f36df01c344ad09f32feda26c4fd/types/eslint/helpers.d.ts#L1-L3
4
+
5
+ export type Prepend < Tuple extends any [ ] , Addend > = ( (
6
+ _ : Addend ,
7
+ ..._1 : Tuple
8
+ ) => any ) extends ( ..._ : infer Result ) => any
9
+ ? Result
10
+ : never ;
11
+
12
+ // Synced to https://github.com/DefinitelyTyped/DefinitelyTyped/blob/042141ce5f77f36df01c344ad09f32feda26c4fd/types/eslint/index.d.ts#L717-L719
13
+
14
+ /**
15
+ * Rule configuration.
16
+ */
17
+ export type RuleLevelAndOptions < Options extends any [ ] = any [ ] > = Prepend <
18
+ Partial < Options > ,
19
+ RuleLevel
20
+ > ;
21
+
22
+ export type RuleEntry < Options extends any [ ] = any [ ] > =
23
+ | RuleLevel
24
+ | RuleLevelAndOptions < Options > ;
2
25
3
26
/**
4
27
* Rule configuration.
28
+ *
29
+ * @alias RuleEntry
5
30
*/
6
- export type RuleConfig < Options extends unknown [ ] = unknown [ ] > =
7
- | RuleSeverity
8
- | [ RuleSeverity , ...Options ] ;
31
+ export type RuleConfig < Options extends any [ ] = any [ ] > = RuleEntry < Options > ;
Original file line number Diff line number Diff line change
1
+ // Synced to https://github.com/DefinitelyTyped/DefinitelyTyped/blob/042141ce5f77f36df01c344ad09f32feda26c4fd/types/eslint/index.d.ts#L714-L716
2
+
3
+ /**
4
+ * Rule ordinal severity.
5
+ */
6
+ export type Severity = 0 | 1 | 2 ;
7
+
8
+ /**
9
+ * Rule severity.
10
+ */
11
+ export type RuleLevel = Severity | 'off' | 'warn' | 'error' ;
12
+
1
13
/**
2
14
* Rule severity.
15
+ *
16
+ * @alias RuleLevel
3
17
*/
4
- export type RuleSeverity = 'off' | 'warn' | 'error' | 0 | 1 | 2 ;
18
+ export type RuleSeverity = RuleLevel ;
You can’t perform that action at this time.
0 commit comments