File tree Expand file tree Collapse file tree 3 files changed +40
-1
lines changed
config-helpers/tests/types Expand file tree Collapse file tree 3 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -71,3 +71,23 @@ defineConfig(
71
71
72
72
globalIgnores ( [ "node_modules" ] ) ;
73
73
globalIgnores ( [ "dist" , "build" ] , "my name" ) ;
74
+
75
+ defineConfig ( {
76
+ plugins : {
77
+ "some-plugin" : {
78
+ rules : {
79
+ "some-rule" : {
80
+ meta : {
81
+ docs : {
82
+ recommended : "not a boolean!" ,
83
+ } ,
84
+ } ,
85
+
86
+ create ( ) {
87
+ return { } ;
88
+ } ,
89
+ } ,
90
+ } ,
91
+ } ,
92
+ } ,
93
+ } ) ;
Original file line number Diff line number Diff line change @@ -127,8 +127,10 @@ export interface RulesMetaDocs {
127
127
128
128
/**
129
129
* Indicates if the rule is generally recommended for all users.
130
+ *
131
+ * Note - this will always be a boolean for core rules, but may be used in any way by plugins.
130
132
*/
131
- recommended ?: boolean | undefined ;
133
+ recommended ?: unknown ;
132
134
133
135
/**
134
136
* Indicates if the rule is frozen (no longer accepting feature requests).
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import type {
23
23
RuleDefinition ,
24
24
RulesConfig ,
25
25
RulesMeta ,
26
+ RulesMetaDocs ,
26
27
RuleTextEdit ,
27
28
RuleTextEditor ,
28
29
RuleVisitor ,
@@ -240,6 +241,9 @@ const testRule: RuleDefinition<{
240
241
meta : {
241
242
type : "problem" ,
242
243
fixable : "code" ,
244
+ docs : {
245
+ recommended : true ,
246
+ } ,
243
247
deprecated : {
244
248
message : "use something else" ,
245
249
url : "https://example.com" ,
@@ -413,3 +417,16 @@ export type Rule5 = TestRuleDefinition<{ Code: TestSourceCode }>;
413
417
414
418
// @ts -expect-error -- undefined value not allow for optional property (assumes `exactOptionalPropertyTypes` tsc compiler option)
415
419
export type Rule6 = TestRuleDefinition < { RuleOptions : undefined } > ;
420
+
421
+ export const shouldAllowRecommendedBoolean : RulesMetaDocs = {
422
+ recommended : true ,
423
+ } ;
424
+ export const shouldAllowRecommendedString : RulesMetaDocs = {
425
+ recommended : "strict" ,
426
+ } ;
427
+
428
+ export const shouldAllowRecommendedObject : RulesMetaDocs = {
429
+ recommended : {
430
+ someKey : "some value" ,
431
+ } ,
432
+ } ;
You can’t perform that action at this time.
0 commit comments