File tree Expand file tree Collapse file tree 3 files changed +23
-5
lines changed
packages/experimental-utils/src/ts-eslint Expand file tree Collapse file tree 3 files changed +23
-5
lines changed Original file line number Diff line number Diff line change 3
3
import { Linter as ESLintLinter } from 'eslint' ;
4
4
import { TSESTree , ParserServices } from '../ts-estree' ;
5
5
import { ParserOptions as TSParserOptions } from './ParserOptions' ;
6
- import { RuleCreateFunction , RuleFix , RuleModule } from './Rule' ;
6
+ import {
7
+ RuleCreateFunction ,
8
+ RuleFix ,
9
+ RuleModule ,
10
+ SharedConfigurationSettings ,
11
+ } from './Rule' ;
7
12
import { Scope } from './Scope' ;
8
13
import { SourceCode } from './SourceCode' ;
9
14
@@ -164,7 +169,7 @@ namespace Linter {
164
169
/**
165
170
* The shared settings.
166
171
*/
167
- settings ?: { [ name : string ] : unknown } ;
172
+ settings ?: SharedConfigurationSettings ;
168
173
}
169
174
170
175
export interface ConfigOverride extends BaseConfig {
Original file line number Diff line number Diff line change @@ -165,6 +165,14 @@ type ReportDescriptor<TMessageIds extends string> =
165
165
ReportDescriptorWithSuggestion < TMessageIds > &
166
166
( ReportDescriptorNodeOptionalLoc | ReportDescriptorLocOnly ) ;
167
167
168
+ /**
169
+ * Plugins can add their settings using declaration
170
+ * merging against this interface.
171
+ */
172
+ interface SharedConfigurationSettings {
173
+ [ name : string ] : unknown ;
174
+ }
175
+
168
176
interface RuleContext <
169
177
TMessageIds extends string ,
170
178
TOptions extends readonly unknown [ ] ,
@@ -194,7 +202,7 @@ interface RuleContext<
194
202
* The shared settings from configuration.
195
203
* We do not have any shared settings in this plugin.
196
204
*/
197
- settings : Record < string , unknown > ;
205
+ settings : SharedConfigurationSettings ;
198
206
199
207
/**
200
208
* Returns an array of the ancestors of the currently-traversed node, starting at
@@ -452,4 +460,5 @@ export {
452
460
RuleMetaData ,
453
461
RuleMetaDataDocs ,
454
462
RuleModule ,
463
+ SharedConfigurationSettings ,
455
464
} ;
Original file line number Diff line number Diff line change @@ -2,7 +2,11 @@ import { RuleTester as ESLintRuleTester } from 'eslint';
2
2
import { AST_NODE_TYPES , AST_TOKEN_TYPES } from '../ts-estree' ;
3
3
import { ParserOptions } from './ParserOptions' ;
4
4
import { Linter } from './Linter' ;
5
- import { RuleCreateFunction , RuleModule } from './Rule' ;
5
+ import {
6
+ RuleCreateFunction ,
7
+ RuleModule ,
8
+ SharedConfigurationSettings ,
9
+ } from './Rule' ;
6
10
7
11
interface ValidTestCase < TOptions extends Readonly < unknown [ ] > > {
8
12
/**
@@ -36,7 +40,7 @@ interface ValidTestCase<TOptions extends Readonly<unknown[]>> {
36
40
/**
37
41
* Settings for the test case.
38
42
*/
39
- readonly settings ?: Readonly < Record < string , unknown > > ;
43
+ readonly settings ?: Readonly < SharedConfigurationSettings > ;
40
44
/**
41
45
* Run this case exclusively for debugging in supported test frameworks.
42
46
*/
You can’t perform that action at this time.
0 commit comments