eslint-plugin-react-x 1.37.4-beta.0 → 1.38.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +29 -27
- package/dist/index.d.ts +29 -27
- package/dist/index.js +493 -451
- package/dist/index.mjs +490 -448
- package/package.json +8 -7
package/dist/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var shared = require('@eslint-react/shared');
|
|
4
|
-
var
|
|
4
|
+
var JSX9 = require('@eslint-react/jsx');
|
|
5
|
+
var utils = require('@typescript-eslint/utils');
|
|
6
|
+
var types = require('@typescript-eslint/types');
|
|
7
|
+
var VAR2 = require('@eslint-react/var');
|
|
5
8
|
var AST11 = require('@eslint-react/ast');
|
|
6
9
|
var core = require('@eslint-react/core');
|
|
7
10
|
var eff = require('@eslint-react/eff');
|
|
8
|
-
var types = require('@typescript-eslint/types');
|
|
9
11
|
var tsPattern = require('ts-pattern');
|
|
12
|
+
var kit = require('@eslint-react/kit');
|
|
10
13
|
var compareVersions = require('compare-versions');
|
|
11
|
-
var VAR = require('@eslint-react/var');
|
|
12
14
|
var typeUtils = require('@typescript-eslint/type-utils');
|
|
13
|
-
var utils = require('@typescript-eslint/utils');
|
|
14
15
|
var tsApiUtils = require('ts-api-utils');
|
|
15
16
|
var ts = require('typescript');
|
|
16
17
|
var isImmutableType = require('is-immutable-type');
|
|
@@ -35,9 +36,9 @@ function _interopNamespace(e) {
|
|
|
35
36
|
return Object.freeze(n);
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
var
|
|
39
|
+
var JSX9__namespace = /*#__PURE__*/_interopNamespace(JSX9);
|
|
40
|
+
var VAR2__namespace = /*#__PURE__*/_interopNamespace(VAR2);
|
|
39
41
|
var AST11__namespace = /*#__PURE__*/_interopNamespace(AST11);
|
|
40
|
-
var VAR__namespace = /*#__PURE__*/_interopNamespace(VAR);
|
|
41
42
|
var ts__default = /*#__PURE__*/_interopDefault(ts);
|
|
42
43
|
|
|
43
44
|
var __defProp = Object.defineProperty;
|
|
@@ -55,6 +56,9 @@ __export(recommended_exports, {
|
|
|
55
56
|
});
|
|
56
57
|
var name = "react-x/recommended";
|
|
57
58
|
var rules = {
|
|
59
|
+
"react-x/jsx-no-duplicate-props": "warn",
|
|
60
|
+
"react-x/jsx-no-undef": "error",
|
|
61
|
+
"react-x/jsx-uses-vars": "warn",
|
|
58
62
|
"react-x/no-access-state-in-setstate": "error",
|
|
59
63
|
"react-x/no-array-index-key": "warn",
|
|
60
64
|
"react-x/no-children-count": "warn",
|
|
@@ -71,7 +75,6 @@ var rules = {
|
|
|
71
75
|
"react-x/no-create-ref": "error",
|
|
72
76
|
"react-x/no-default-props": "error",
|
|
73
77
|
"react-x/no-direct-mutation-state": "error",
|
|
74
|
-
"react-x/no-duplicate-jsx-props": "warn",
|
|
75
78
|
"react-x/no-duplicate-key": "warn",
|
|
76
79
|
"react-x/no-forward-ref": "warn",
|
|
77
80
|
"react-x/no-implicit-key": "warn",
|
|
@@ -91,8 +94,7 @@ var rules = {
|
|
|
91
94
|
"react-x/no-unused-class-component-members": "warn",
|
|
92
95
|
"react-x/no-unused-state": "warn",
|
|
93
96
|
"react-x/no-use-context": "warn",
|
|
94
|
-
"react-x/no-useless-forward-ref": "warn"
|
|
95
|
-
"react-x/use-jsx-vars": "warn"
|
|
97
|
+
"react-x/no-useless-forward-ref": "warn"
|
|
96
98
|
};
|
|
97
99
|
var settings = {
|
|
98
100
|
"react-x": shared.DEFAULT_ESLINT_REACT_SETTINGS
|
|
@@ -116,8 +118,9 @@ __export(recommended_typescript_exports, {
|
|
|
116
118
|
var name2 = "react-x/recommended-typescript";
|
|
117
119
|
var rules2 = {
|
|
118
120
|
...rules,
|
|
119
|
-
"react-x/no-duplicate-
|
|
120
|
-
"react-x/
|
|
121
|
+
"react-x/jsx-no-duplicate-props": "off",
|
|
122
|
+
"react-x/jsx-no-undef": "off",
|
|
123
|
+
"react-x/jsx-uses-vars": "off"
|
|
121
124
|
};
|
|
122
125
|
var settings2 = {
|
|
123
126
|
...settings
|
|
@@ -136,8 +139,8 @@ var settings3 = {
|
|
|
136
139
|
|
|
137
140
|
// package.json
|
|
138
141
|
var name4 = "eslint-plugin-react-x";
|
|
139
|
-
var version = "1.
|
|
140
|
-
var createRule = shared.
|
|
142
|
+
var version = "1.38.0-beta.10";
|
|
143
|
+
var createRule = utils.ESLintUtils.RuleCreator(shared.getDocsUrl("x"));
|
|
141
144
|
|
|
142
145
|
// src/rules/avoid-shorthand-boolean.ts
|
|
143
146
|
var RULE_NAME = "avoid-shorthand-boolean";
|
|
@@ -167,7 +170,7 @@ function create(context) {
|
|
|
167
170
|
messageId: "avoidShorthandBoolean",
|
|
168
171
|
node,
|
|
169
172
|
data: {
|
|
170
|
-
propName:
|
|
173
|
+
propName: JSX9__namespace.getAttributeName(node)
|
|
171
174
|
},
|
|
172
175
|
fix: (fixer) => fixer.insertTextAfter(node.name, `={true}`)
|
|
173
176
|
});
|
|
@@ -205,8 +208,131 @@ function create2(context) {
|
|
|
205
208
|
}
|
|
206
209
|
};
|
|
207
210
|
}
|
|
208
|
-
var RULE_NAME3 = "no-
|
|
211
|
+
var RULE_NAME3 = "jsx-no-duplicate-props";
|
|
209
212
|
var RULE_FEATURES3 = [];
|
|
213
|
+
var jsx_no_duplicate_props_default = createRule({
|
|
214
|
+
meta: {
|
|
215
|
+
type: "problem",
|
|
216
|
+
docs: {
|
|
217
|
+
description: "Disallow duplicate props in JSX elements.",
|
|
218
|
+
[Symbol.for("rule_features")]: RULE_FEATURES3
|
|
219
|
+
},
|
|
220
|
+
messages: {
|
|
221
|
+
jsxNoDuplicateProps: "This JSX property is assigned multiple times."
|
|
222
|
+
},
|
|
223
|
+
schema: []
|
|
224
|
+
},
|
|
225
|
+
name: RULE_NAME3,
|
|
226
|
+
create: create3,
|
|
227
|
+
defaultOptions: []
|
|
228
|
+
});
|
|
229
|
+
function create3(context) {
|
|
230
|
+
return {
|
|
231
|
+
JSXOpeningElement(node) {
|
|
232
|
+
const props = [];
|
|
233
|
+
for (const attr of node.attributes) {
|
|
234
|
+
if (attr.type === types.AST_NODE_TYPES.JSXSpreadAttribute) {
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
const name5 = attr.name.name;
|
|
238
|
+
if (typeof name5 !== "string") {
|
|
239
|
+
continue;
|
|
240
|
+
}
|
|
241
|
+
if (!props.includes(name5)) {
|
|
242
|
+
props.push(name5);
|
|
243
|
+
continue;
|
|
244
|
+
}
|
|
245
|
+
context.report({
|
|
246
|
+
messageId: "jsxNoDuplicateProps",
|
|
247
|
+
node: attr
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
var RULE_NAME4 = "jsx-no-undef";
|
|
254
|
+
var RULE_FEATURES4 = [];
|
|
255
|
+
var jsx_no_undef_default = createRule({
|
|
256
|
+
meta: {
|
|
257
|
+
type: "problem",
|
|
258
|
+
docs: {
|
|
259
|
+
description: "Disallow undefined variables in JSX.",
|
|
260
|
+
[Symbol.for("rule_features")]: RULE_FEATURES4
|
|
261
|
+
},
|
|
262
|
+
messages: {
|
|
263
|
+
jsxNoUndef: "JSX variable '{{name}}' is not defined."
|
|
264
|
+
},
|
|
265
|
+
schema: []
|
|
266
|
+
},
|
|
267
|
+
name: RULE_NAME4,
|
|
268
|
+
create: create4,
|
|
269
|
+
defaultOptions: []
|
|
270
|
+
});
|
|
271
|
+
function create4(context) {
|
|
272
|
+
return {
|
|
273
|
+
JSXIdentifier(node) {
|
|
274
|
+
if (node.name === "this") {
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
if (/^[a-z]/u.test(node.name)) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
if (node.parent.type === types.AST_NODE_TYPES.JSXMemberExpression && node.parent.property === node) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
const initialScope = context.sourceCode.getScope(node);
|
|
284
|
+
if (VAR2__namespace.findVariable(node.name, initialScope) == null) {
|
|
285
|
+
context.report({
|
|
286
|
+
messageId: "jsxNoUndef",
|
|
287
|
+
node,
|
|
288
|
+
data: { name: node.name }
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
var RULE_NAME5 = "jsx-uses-vars";
|
|
295
|
+
var RULE_FEATURES5 = [];
|
|
296
|
+
var jsx_uses_vars_default = createRule({
|
|
297
|
+
meta: {
|
|
298
|
+
type: "problem",
|
|
299
|
+
docs: {
|
|
300
|
+
description: "Marks variables used in JSX elements as used.",
|
|
301
|
+
[Symbol.for("rule_features")]: RULE_FEATURES5
|
|
302
|
+
},
|
|
303
|
+
messages: {
|
|
304
|
+
jsxUsesVars: "JSX variables should be marked as used."
|
|
305
|
+
},
|
|
306
|
+
schema: []
|
|
307
|
+
},
|
|
308
|
+
name: RULE_NAME5,
|
|
309
|
+
create: create5,
|
|
310
|
+
defaultOptions: []
|
|
311
|
+
});
|
|
312
|
+
function create5(context) {
|
|
313
|
+
return {
|
|
314
|
+
JSXOpeningElement(node) {
|
|
315
|
+
switch (node.name.type) {
|
|
316
|
+
case types.AST_NODE_TYPES.JSXIdentifier: {
|
|
317
|
+
if (/^[a-z]/u.test(node.name.name)) {
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
context.sourceCode.markVariableAsUsed(node.name.name, node);
|
|
321
|
+
break;
|
|
322
|
+
}
|
|
323
|
+
case types.AST_NODE_TYPES.JSXMemberExpression: {
|
|
324
|
+
const { object } = node.name;
|
|
325
|
+
if (object.type === types.AST_NODE_TYPES.JSXIdentifier) {
|
|
326
|
+
context.sourceCode.markVariableAsUsed(object.name, node);
|
|
327
|
+
}
|
|
328
|
+
break;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
var RULE_NAME6 = "no-access-state-in-setstate";
|
|
335
|
+
var RULE_FEATURES6 = [];
|
|
210
336
|
function isKeyLiteral(node, key) {
|
|
211
337
|
return tsPattern.match(key).with({ type: types.AST_NODE_TYPES.Literal }, eff.constTrue).with({ type: types.AST_NODE_TYPES.TemplateLiteral, expressions: [] }, eff.constTrue).with({ type: types.AST_NODE_TYPES.Identifier }, () => !node.computed).otherwise(eff.constFalse);
|
|
212
338
|
}
|
|
@@ -215,18 +341,18 @@ var no_access_state_in_setstate_default = createRule({
|
|
|
215
341
|
type: "problem",
|
|
216
342
|
docs: {
|
|
217
343
|
description: "Disallow accessing `this.state` inside `setState` calls.",
|
|
218
|
-
[Symbol.for("rule_features")]:
|
|
344
|
+
[Symbol.for("rule_features")]: RULE_FEATURES6
|
|
219
345
|
},
|
|
220
346
|
messages: {
|
|
221
347
|
noAccessStateInSetstate: "Do not access 'this.state' within 'setState'. Use the update function instead."
|
|
222
348
|
},
|
|
223
349
|
schema: []
|
|
224
350
|
},
|
|
225
|
-
name:
|
|
226
|
-
create:
|
|
351
|
+
name: RULE_NAME6,
|
|
352
|
+
create: create6,
|
|
227
353
|
defaultOptions: []
|
|
228
354
|
});
|
|
229
|
-
function
|
|
355
|
+
function create6(context) {
|
|
230
356
|
if (!context.sourceCode.text.includes("setState")) {
|
|
231
357
|
return {};
|
|
232
358
|
}
|
|
@@ -317,23 +443,9 @@ function create3(context) {
|
|
|
317
443
|
}
|
|
318
444
|
};
|
|
319
445
|
}
|
|
320
|
-
var
|
|
321
|
-
var
|
|
446
|
+
var RULE_NAME7 = "no-array-index-key";
|
|
447
|
+
var RULE_FEATURES7 = [];
|
|
322
448
|
var reactChildrenMethod = ["forEach", "map"];
|
|
323
|
-
var iteratorFunctionIndexParamPosition = /* @__PURE__ */ new Map([
|
|
324
|
-
["every", 1],
|
|
325
|
-
["filter", 1],
|
|
326
|
-
["find", 1],
|
|
327
|
-
["findIndex", 1],
|
|
328
|
-
["findLast", 1],
|
|
329
|
-
["findLastIndex", 1],
|
|
330
|
-
["flatMap", 1],
|
|
331
|
-
["forEach", 1],
|
|
332
|
-
["map", 1],
|
|
333
|
-
["reduce", 2],
|
|
334
|
-
["reduceRight", 2],
|
|
335
|
-
["some", 1]
|
|
336
|
-
]);
|
|
337
449
|
function isReactChildrenMethod(name5) {
|
|
338
450
|
return reactChildrenMethod.some((method) => method === name5);
|
|
339
451
|
}
|
|
@@ -364,7 +476,7 @@ function getMapIndexParamName(context, node) {
|
|
|
364
476
|
return eff._;
|
|
365
477
|
}
|
|
366
478
|
const { name: name5 } = callee.property;
|
|
367
|
-
if (!
|
|
479
|
+
if (!AST11__namespace.ITERATOR_FUNCTION_INDEX_PARAM_POSITION.has(name5)) {
|
|
368
480
|
return eff._;
|
|
369
481
|
}
|
|
370
482
|
const callbackArg = node.arguments[isUsingReactChildren(context, node) ? 1 : 0];
|
|
@@ -375,7 +487,7 @@ function getMapIndexParamName(context, node) {
|
|
|
375
487
|
return eff._;
|
|
376
488
|
}
|
|
377
489
|
const { params } = callbackArg;
|
|
378
|
-
const indexParamPosition =
|
|
490
|
+
const indexParamPosition = AST11__namespace.ITERATOR_FUNCTION_INDEX_PARAM_POSITION.get(name5);
|
|
379
491
|
if (indexParamPosition == null) {
|
|
380
492
|
return eff._;
|
|
381
493
|
}
|
|
@@ -402,19 +514,19 @@ var no_array_index_key_default = createRule({
|
|
|
402
514
|
type: "problem",
|
|
403
515
|
docs: {
|
|
404
516
|
description: "Disallow an item's index in the array as its key.",
|
|
405
|
-
[Symbol.for("rule_features")]:
|
|
517
|
+
[Symbol.for("rule_features")]: RULE_FEATURES7
|
|
406
518
|
},
|
|
407
519
|
messages: {
|
|
408
520
|
noArrayIndexKey: "Do not use item index in the array as its key."
|
|
409
521
|
},
|
|
410
522
|
schema: []
|
|
411
523
|
},
|
|
412
|
-
name:
|
|
413
|
-
create:
|
|
524
|
+
name: RULE_NAME7,
|
|
525
|
+
create: create7,
|
|
414
526
|
defaultOptions: []
|
|
415
527
|
});
|
|
416
|
-
function
|
|
417
|
-
const report =
|
|
528
|
+
function create7(context) {
|
|
529
|
+
const report = kit.createReport(context);
|
|
418
530
|
const indexParamNames = [];
|
|
419
531
|
function isArrayIndex(node) {
|
|
420
532
|
return node.type === types.AST_NODE_TYPES.Identifier && indexParamNames.some((name5) => name5 != null && name5 === node.name);
|
|
@@ -511,25 +623,25 @@ function create4(context) {
|
|
|
511
623
|
}
|
|
512
624
|
};
|
|
513
625
|
}
|
|
514
|
-
var
|
|
515
|
-
var
|
|
626
|
+
var RULE_NAME8 = "no-children-count";
|
|
627
|
+
var RULE_FEATURES8 = [];
|
|
516
628
|
var no_children_count_default = createRule({
|
|
517
629
|
meta: {
|
|
518
630
|
type: "problem",
|
|
519
631
|
docs: {
|
|
520
632
|
description: "Disallow `Children.count`.",
|
|
521
|
-
[Symbol.for("rule_features")]:
|
|
633
|
+
[Symbol.for("rule_features")]: RULE_FEATURES8
|
|
522
634
|
},
|
|
523
635
|
messages: {
|
|
524
636
|
noChildrenCount: "Using 'Children.count' is uncommon and can lead to fragile code. Use alternatives instead."
|
|
525
637
|
},
|
|
526
638
|
schema: []
|
|
527
639
|
},
|
|
528
|
-
name:
|
|
529
|
-
create:
|
|
640
|
+
name: RULE_NAME8,
|
|
641
|
+
create: create8,
|
|
530
642
|
defaultOptions: []
|
|
531
643
|
});
|
|
532
|
-
function
|
|
644
|
+
function create8(context) {
|
|
533
645
|
return {
|
|
534
646
|
MemberExpression(node) {
|
|
535
647
|
if (core.isChildrenCount(context, node)) {
|
|
@@ -541,25 +653,25 @@ function create5(context) {
|
|
|
541
653
|
}
|
|
542
654
|
};
|
|
543
655
|
}
|
|
544
|
-
var
|
|
545
|
-
var
|
|
656
|
+
var RULE_NAME9 = "no-children-for-each";
|
|
657
|
+
var RULE_FEATURES9 = [];
|
|
546
658
|
var no_children_for_each_default = createRule({
|
|
547
659
|
meta: {
|
|
548
660
|
type: "problem",
|
|
549
661
|
docs: {
|
|
550
662
|
description: "Disallow 'Children.forEach'.",
|
|
551
|
-
[Symbol.for("rule_features")]:
|
|
663
|
+
[Symbol.for("rule_features")]: RULE_FEATURES9
|
|
552
664
|
},
|
|
553
665
|
messages: {
|
|
554
666
|
noChildrenForEach: "Using 'Children.forEach' is uncommon and can lead to fragile code. Use alternatives instead."
|
|
555
667
|
},
|
|
556
668
|
schema: []
|
|
557
669
|
},
|
|
558
|
-
name:
|
|
559
|
-
create:
|
|
670
|
+
name: RULE_NAME9,
|
|
671
|
+
create: create9,
|
|
560
672
|
defaultOptions: []
|
|
561
673
|
});
|
|
562
|
-
function
|
|
674
|
+
function create9(context) {
|
|
563
675
|
return {
|
|
564
676
|
MemberExpression(node) {
|
|
565
677
|
if (core.isChildrenForEach(context, node)) {
|
|
@@ -571,25 +683,25 @@ function create6(context) {
|
|
|
571
683
|
}
|
|
572
684
|
};
|
|
573
685
|
}
|
|
574
|
-
var
|
|
575
|
-
var
|
|
686
|
+
var RULE_NAME10 = "no-children-map";
|
|
687
|
+
var RULE_FEATURES10 = [];
|
|
576
688
|
var no_children_map_default = createRule({
|
|
577
689
|
meta: {
|
|
578
690
|
type: "problem",
|
|
579
691
|
docs: {
|
|
580
692
|
description: "Disallow `Children.map`.",
|
|
581
|
-
[Symbol.for("rule_features")]:
|
|
693
|
+
[Symbol.for("rule_features")]: RULE_FEATURES10
|
|
582
694
|
},
|
|
583
695
|
messages: {
|
|
584
696
|
noChildrenMap: "Using 'Children.map' is uncommon and can lead to fragile code. Use alternatives instead."
|
|
585
697
|
},
|
|
586
698
|
schema: []
|
|
587
699
|
},
|
|
588
|
-
name:
|
|
589
|
-
create:
|
|
700
|
+
name: RULE_NAME10,
|
|
701
|
+
create: create10,
|
|
590
702
|
defaultOptions: []
|
|
591
703
|
});
|
|
592
|
-
function
|
|
704
|
+
function create10(context) {
|
|
593
705
|
return {
|
|
594
706
|
MemberExpression(node) {
|
|
595
707
|
if (core.isChildrenMap(context, node)) {
|
|
@@ -601,25 +713,25 @@ function create7(context) {
|
|
|
601
713
|
}
|
|
602
714
|
};
|
|
603
715
|
}
|
|
604
|
-
var
|
|
605
|
-
var
|
|
716
|
+
var RULE_NAME11 = "no-children-only";
|
|
717
|
+
var RULE_FEATURES11 = [];
|
|
606
718
|
var no_children_only_default = createRule({
|
|
607
719
|
meta: {
|
|
608
720
|
type: "problem",
|
|
609
721
|
docs: {
|
|
610
722
|
description: "Disallow `Children.only`.",
|
|
611
|
-
[Symbol.for("rule_features")]:
|
|
723
|
+
[Symbol.for("rule_features")]: RULE_FEATURES11
|
|
612
724
|
},
|
|
613
725
|
messages: {
|
|
614
726
|
noChildrenOnly: "Using 'Children.only' is uncommon and can lead to fragile code. Use alternatives instead."
|
|
615
727
|
},
|
|
616
728
|
schema: []
|
|
617
729
|
},
|
|
618
|
-
name:
|
|
619
|
-
create:
|
|
730
|
+
name: RULE_NAME11,
|
|
731
|
+
create: create11,
|
|
620
732
|
defaultOptions: []
|
|
621
733
|
});
|
|
622
|
-
function
|
|
734
|
+
function create11(context) {
|
|
623
735
|
return {
|
|
624
736
|
MemberExpression(node) {
|
|
625
737
|
if (core.isChildrenOnly(context, node)) {
|
|
@@ -631,28 +743,28 @@ function create8(context) {
|
|
|
631
743
|
}
|
|
632
744
|
};
|
|
633
745
|
}
|
|
634
|
-
var
|
|
635
|
-
var
|
|
746
|
+
var RULE_NAME12 = "no-children-prop";
|
|
747
|
+
var RULE_FEATURES12 = [];
|
|
636
748
|
var no_children_prop_default = createRule({
|
|
637
749
|
meta: {
|
|
638
750
|
type: "problem",
|
|
639
751
|
docs: {
|
|
640
752
|
description: "Disallow passing `children` as a prop.",
|
|
641
|
-
[Symbol.for("rule_features")]:
|
|
753
|
+
[Symbol.for("rule_features")]: RULE_FEATURES12
|
|
642
754
|
},
|
|
643
755
|
messages: {
|
|
644
756
|
noChildrenProp: "Do not pass 'children' as props."
|
|
645
757
|
},
|
|
646
758
|
schema: []
|
|
647
759
|
},
|
|
648
|
-
name:
|
|
649
|
-
create:
|
|
760
|
+
name: RULE_NAME12,
|
|
761
|
+
create: create12,
|
|
650
762
|
defaultOptions: []
|
|
651
763
|
});
|
|
652
|
-
function
|
|
764
|
+
function create12(context) {
|
|
653
765
|
return {
|
|
654
766
|
JSXElement(node) {
|
|
655
|
-
const attribute =
|
|
767
|
+
const attribute = JSX9__namespace.getAttribute(
|
|
656
768
|
"children",
|
|
657
769
|
node.openingElement.attributes,
|
|
658
770
|
context.sourceCode.getScope(node)
|
|
@@ -666,25 +778,25 @@ function create9(context) {
|
|
|
666
778
|
}
|
|
667
779
|
};
|
|
668
780
|
}
|
|
669
|
-
var
|
|
670
|
-
var
|
|
781
|
+
var RULE_NAME13 = "no-children-to-array";
|
|
782
|
+
var RULE_FEATURES13 = [];
|
|
671
783
|
var no_children_to_array_default = createRule({
|
|
672
784
|
meta: {
|
|
673
785
|
type: "problem",
|
|
674
786
|
docs: {
|
|
675
787
|
description: "Disallow `Children.toArray`.",
|
|
676
|
-
[Symbol.for("rule_features")]:
|
|
788
|
+
[Symbol.for("rule_features")]: RULE_FEATURES13
|
|
677
789
|
},
|
|
678
790
|
messages: {
|
|
679
791
|
noChildrenToArray: "Using 'Children.toArray' is uncommon and can lead to fragile code. Use alternatives instead."
|
|
680
792
|
},
|
|
681
793
|
schema: []
|
|
682
794
|
},
|
|
683
|
-
name:
|
|
684
|
-
create:
|
|
795
|
+
name: RULE_NAME13,
|
|
796
|
+
create: create13,
|
|
685
797
|
defaultOptions: []
|
|
686
798
|
});
|
|
687
|
-
function
|
|
799
|
+
function create13(context) {
|
|
688
800
|
return {
|
|
689
801
|
MemberExpression(node) {
|
|
690
802
|
if (core.isChildrenToArray(context, node)) {
|
|
@@ -696,25 +808,25 @@ function create10(context) {
|
|
|
696
808
|
}
|
|
697
809
|
};
|
|
698
810
|
}
|
|
699
|
-
var
|
|
700
|
-
var
|
|
811
|
+
var RULE_NAME14 = "no-class-component";
|
|
812
|
+
var RULE_FEATURES14 = [];
|
|
701
813
|
var no_class_component_default = createRule({
|
|
702
814
|
meta: {
|
|
703
815
|
type: "problem",
|
|
704
816
|
docs: {
|
|
705
817
|
description: "Disallow class components.",
|
|
706
|
-
[Symbol.for("rule_features")]:
|
|
818
|
+
[Symbol.for("rule_features")]: RULE_FEATURES14
|
|
707
819
|
},
|
|
708
820
|
messages: {
|
|
709
821
|
noClassComponent: "Do not use class components. Use function components instead."
|
|
710
822
|
},
|
|
711
823
|
schema: []
|
|
712
824
|
},
|
|
713
|
-
name:
|
|
714
|
-
create:
|
|
825
|
+
name: RULE_NAME14,
|
|
826
|
+
create: create14,
|
|
715
827
|
defaultOptions: []
|
|
716
828
|
});
|
|
717
|
-
function
|
|
829
|
+
function create14(context) {
|
|
718
830
|
if (!context.sourceCode.text.includes("Component")) return {};
|
|
719
831
|
const { ctx, listeners } = core.useComponentCollectorLegacy();
|
|
720
832
|
return {
|
|
@@ -736,25 +848,25 @@ function create11(context) {
|
|
|
736
848
|
}
|
|
737
849
|
};
|
|
738
850
|
}
|
|
739
|
-
var
|
|
740
|
-
var
|
|
851
|
+
var RULE_NAME15 = "no-clone-element";
|
|
852
|
+
var RULE_FEATURES15 = [];
|
|
741
853
|
var no_clone_element_default = createRule({
|
|
742
854
|
meta: {
|
|
743
855
|
type: "problem",
|
|
744
856
|
docs: {
|
|
745
857
|
description: "Disallow `cloneElement`.",
|
|
746
|
-
[Symbol.for("rule_features")]:
|
|
858
|
+
[Symbol.for("rule_features")]: RULE_FEATURES15
|
|
747
859
|
},
|
|
748
860
|
messages: {
|
|
749
861
|
noCloneElement: "Using 'cloneElement' is uncommon and can lead to fragile code. Use alternatives instead."
|
|
750
862
|
},
|
|
751
863
|
schema: []
|
|
752
864
|
},
|
|
753
|
-
name:
|
|
754
|
-
create:
|
|
865
|
+
name: RULE_NAME15,
|
|
866
|
+
create: create15,
|
|
755
867
|
defaultOptions: []
|
|
756
868
|
});
|
|
757
|
-
function
|
|
869
|
+
function create15(context) {
|
|
758
870
|
return {
|
|
759
871
|
CallExpression(node) {
|
|
760
872
|
if (!core.isCloneElementCall(context, node)) {
|
|
@@ -767,25 +879,25 @@ function create12(context) {
|
|
|
767
879
|
}
|
|
768
880
|
};
|
|
769
881
|
}
|
|
770
|
-
var
|
|
771
|
-
var
|
|
882
|
+
var RULE_NAME16 = "no-comment-textnodes";
|
|
883
|
+
var RULE_FEATURES16 = [];
|
|
772
884
|
var no_comment_textnodes_default = createRule({
|
|
773
885
|
meta: {
|
|
774
886
|
type: "problem",
|
|
775
887
|
docs: {
|
|
776
888
|
description: "Prevents comments from being inserted as text nodes.",
|
|
777
|
-
[Symbol.for("rule_features")]:
|
|
889
|
+
[Symbol.for("rule_features")]: RULE_FEATURES16
|
|
778
890
|
},
|
|
779
891
|
messages: {
|
|
780
892
|
noCommentTextnodes: "Possible misused comment in text node. Comments inside children section of tag should be placed inside braces."
|
|
781
893
|
},
|
|
782
894
|
schema: []
|
|
783
895
|
},
|
|
784
|
-
name:
|
|
785
|
-
create:
|
|
896
|
+
name: RULE_NAME16,
|
|
897
|
+
create: create16,
|
|
786
898
|
defaultOptions: []
|
|
787
899
|
});
|
|
788
|
-
function
|
|
900
|
+
function create16(context) {
|
|
789
901
|
function hasCommentLike(node) {
|
|
790
902
|
if (AST11__namespace.isOneOf([types.AST_NODE_TYPES.JSXAttribute, types.AST_NODE_TYPES.JSXExpressionContainer])(node.parent)) {
|
|
791
903
|
return false;
|
|
@@ -813,25 +925,27 @@ function create13(context) {
|
|
|
813
925
|
Literal: visitorFunction
|
|
814
926
|
};
|
|
815
927
|
}
|
|
816
|
-
var
|
|
817
|
-
var
|
|
928
|
+
var RULE_NAME17 = "no-complex-conditional-rendering";
|
|
929
|
+
var RULE_FEATURES17 = [
|
|
930
|
+
"EXP"
|
|
931
|
+
];
|
|
818
932
|
var no_complex_conditional_rendering_default = createRule({
|
|
819
933
|
meta: {
|
|
820
934
|
type: "problem",
|
|
821
935
|
docs: {
|
|
822
936
|
description: "Disallow complex conditional rendering in JSX expressions.",
|
|
823
|
-
[Symbol.for("rule_features")]:
|
|
937
|
+
[Symbol.for("rule_features")]: RULE_FEATURES17
|
|
824
938
|
},
|
|
825
939
|
messages: {
|
|
826
940
|
noComplexConditionalRendering: "Avoid complex conditional rendering. Extract the logic into separate elements or components."
|
|
827
941
|
},
|
|
828
942
|
schema: []
|
|
829
943
|
},
|
|
830
|
-
name:
|
|
831
|
-
create:
|
|
944
|
+
name: RULE_NAME17,
|
|
945
|
+
create: create17,
|
|
832
946
|
defaultOptions: []
|
|
833
947
|
});
|
|
834
|
-
function
|
|
948
|
+
function create17(context) {
|
|
835
949
|
const visitorFunction = (node) => {
|
|
836
950
|
const jsxExpContainer = node.parent?.parent;
|
|
837
951
|
if (!AST11__namespace.is(types.AST_NODE_TYPES.JSXExpressionContainer)(jsxExpContainer)) {
|
|
@@ -856,8 +970,8 @@ function create14(context) {
|
|
|
856
970
|
"JSXExpressionContainer > LogicalExpression[operator='||'] > LogicalExpression[operator='&&']": visitorFunction
|
|
857
971
|
};
|
|
858
972
|
}
|
|
859
|
-
var
|
|
860
|
-
var
|
|
973
|
+
var RULE_NAME18 = "no-component-will-mount";
|
|
974
|
+
var RULE_FEATURES18 = [
|
|
861
975
|
"MOD"
|
|
862
976
|
];
|
|
863
977
|
function isComponentWillMount(node) {
|
|
@@ -868,7 +982,7 @@ var no_component_will_mount_default = createRule({
|
|
|
868
982
|
type: "problem",
|
|
869
983
|
docs: {
|
|
870
984
|
description: "Replace usages of `componentWillMount` with `UNSAFE_componentWillMount`.",
|
|
871
|
-
[Symbol.for("rule_features")]:
|
|
985
|
+
[Symbol.for("rule_features")]: RULE_FEATURES18
|
|
872
986
|
},
|
|
873
987
|
fixable: "code",
|
|
874
988
|
messages: {
|
|
@@ -876,11 +990,11 @@ var no_component_will_mount_default = createRule({
|
|
|
876
990
|
},
|
|
877
991
|
schema: []
|
|
878
992
|
},
|
|
879
|
-
name:
|
|
880
|
-
create:
|
|
993
|
+
name: RULE_NAME18,
|
|
994
|
+
create: create18,
|
|
881
995
|
defaultOptions: []
|
|
882
996
|
});
|
|
883
|
-
function
|
|
997
|
+
function create18(context) {
|
|
884
998
|
if (!context.sourceCode.text.includes("componentWillMount")) return {};
|
|
885
999
|
const { ctx, listeners } = core.useComponentCollectorLegacy();
|
|
886
1000
|
return {
|
|
@@ -907,8 +1021,8 @@ function create15(context) {
|
|
|
907
1021
|
}
|
|
908
1022
|
};
|
|
909
1023
|
}
|
|
910
|
-
var
|
|
911
|
-
var
|
|
1024
|
+
var RULE_NAME19 = "no-component-will-receive-props";
|
|
1025
|
+
var RULE_FEATURES19 = [
|
|
912
1026
|
"MOD"
|
|
913
1027
|
];
|
|
914
1028
|
function isComponentWillUpdate(node) {
|
|
@@ -919,7 +1033,7 @@ var no_component_will_receive_props_default = createRule({
|
|
|
919
1033
|
type: "problem",
|
|
920
1034
|
docs: {
|
|
921
1035
|
description: "Replace usages of `componentWillReceiveProps` with `UNSAFE_componentWillReceiveProps`.",
|
|
922
|
-
[Symbol.for("rule_features")]:
|
|
1036
|
+
[Symbol.for("rule_features")]: RULE_FEATURES19
|
|
923
1037
|
},
|
|
924
1038
|
fixable: "code",
|
|
925
1039
|
messages: {
|
|
@@ -927,11 +1041,11 @@ var no_component_will_receive_props_default = createRule({
|
|
|
927
1041
|
},
|
|
928
1042
|
schema: []
|
|
929
1043
|
},
|
|
930
|
-
name:
|
|
931
|
-
create:
|
|
1044
|
+
name: RULE_NAME19,
|
|
1045
|
+
create: create19,
|
|
932
1046
|
defaultOptions: []
|
|
933
1047
|
});
|
|
934
|
-
function
|
|
1048
|
+
function create19(context) {
|
|
935
1049
|
if (!context.sourceCode.text.includes("componentWillReceiveProps")) return {};
|
|
936
1050
|
const { ctx, listeners } = core.useComponentCollectorLegacy();
|
|
937
1051
|
return {
|
|
@@ -958,8 +1072,8 @@ function create16(context) {
|
|
|
958
1072
|
}
|
|
959
1073
|
};
|
|
960
1074
|
}
|
|
961
|
-
var
|
|
962
|
-
var
|
|
1075
|
+
var RULE_NAME20 = "no-component-will-update";
|
|
1076
|
+
var RULE_FEATURES20 = [
|
|
963
1077
|
"MOD"
|
|
964
1078
|
];
|
|
965
1079
|
function isComponentWillUpdate2(node) {
|
|
@@ -970,7 +1084,7 @@ var no_component_will_update_default = createRule({
|
|
|
970
1084
|
type: "problem",
|
|
971
1085
|
docs: {
|
|
972
1086
|
description: "Replace usages of `componentWillUpdate` with `UNSAFE_componentWillUpdate`.",
|
|
973
|
-
[Symbol.for("rule_features")]:
|
|
1087
|
+
[Symbol.for("rule_features")]: RULE_FEATURES20
|
|
974
1088
|
},
|
|
975
1089
|
fixable: "code",
|
|
976
1090
|
messages: {
|
|
@@ -978,11 +1092,11 @@ var no_component_will_update_default = createRule({
|
|
|
978
1092
|
},
|
|
979
1093
|
schema: []
|
|
980
1094
|
},
|
|
981
|
-
name:
|
|
982
|
-
create:
|
|
1095
|
+
name: RULE_NAME20,
|
|
1096
|
+
create: create20,
|
|
983
1097
|
defaultOptions: []
|
|
984
1098
|
});
|
|
985
|
-
function
|
|
1099
|
+
function create20(context) {
|
|
986
1100
|
if (!context.sourceCode.text.includes("componentWillUpdate")) return {};
|
|
987
1101
|
const { ctx, listeners } = core.useComponentCollectorLegacy();
|
|
988
1102
|
return {
|
|
@@ -1009,8 +1123,8 @@ function create17(context) {
|
|
|
1009
1123
|
}
|
|
1010
1124
|
};
|
|
1011
1125
|
}
|
|
1012
|
-
var
|
|
1013
|
-
var
|
|
1126
|
+
var RULE_NAME21 = "no-context-provider";
|
|
1127
|
+
var RULE_FEATURES21 = [
|
|
1014
1128
|
"MOD"
|
|
1015
1129
|
];
|
|
1016
1130
|
var no_context_provider_default = createRule({
|
|
@@ -1018,7 +1132,7 @@ var no_context_provider_default = createRule({
|
|
|
1018
1132
|
type: "problem",
|
|
1019
1133
|
docs: {
|
|
1020
1134
|
description: "Replace usages of `<Context.Provider>` with `<Context>`.",
|
|
1021
|
-
[Symbol.for("rule_features")]:
|
|
1135
|
+
[Symbol.for("rule_features")]: RULE_FEATURES21
|
|
1022
1136
|
},
|
|
1023
1137
|
fixable: "code",
|
|
1024
1138
|
messages: {
|
|
@@ -1026,17 +1140,17 @@ var no_context_provider_default = createRule({
|
|
|
1026
1140
|
},
|
|
1027
1141
|
schema: []
|
|
1028
1142
|
},
|
|
1029
|
-
name:
|
|
1030
|
-
create:
|
|
1143
|
+
name: RULE_NAME21,
|
|
1144
|
+
create: create21,
|
|
1031
1145
|
defaultOptions: []
|
|
1032
1146
|
});
|
|
1033
|
-
function
|
|
1147
|
+
function create21(context) {
|
|
1034
1148
|
if (!context.sourceCode.text.includes("Provider")) return {};
|
|
1035
1149
|
const { version: version2 } = shared.getSettingsFromContext(context);
|
|
1036
1150
|
if (compareVersions.compare(version2, "19.0.0", "<")) return {};
|
|
1037
1151
|
return {
|
|
1038
1152
|
JSXElement(node) {
|
|
1039
|
-
const fullName =
|
|
1153
|
+
const fullName = JSX9__namespace.getElementType(node);
|
|
1040
1154
|
const parts = fullName.split(".");
|
|
1041
1155
|
const selfName = parts.pop();
|
|
1042
1156
|
const contextFullName = parts.join(".");
|
|
@@ -1062,25 +1176,25 @@ function create18(context) {
|
|
|
1062
1176
|
}
|
|
1063
1177
|
};
|
|
1064
1178
|
}
|
|
1065
|
-
var
|
|
1066
|
-
var
|
|
1179
|
+
var RULE_NAME22 = "no-create-ref";
|
|
1180
|
+
var RULE_FEATURES22 = [];
|
|
1067
1181
|
var no_create_ref_default = createRule({
|
|
1068
1182
|
meta: {
|
|
1069
1183
|
type: "problem",
|
|
1070
1184
|
docs: {
|
|
1071
1185
|
description: "Disallow `createRef` in function components.",
|
|
1072
|
-
[Symbol.for("rule_features")]:
|
|
1186
|
+
[Symbol.for("rule_features")]: RULE_FEATURES22
|
|
1073
1187
|
},
|
|
1074
1188
|
messages: {
|
|
1075
1189
|
noCreateRef: "[Deprecated] Use 'useRef' instead."
|
|
1076
1190
|
},
|
|
1077
1191
|
schema: []
|
|
1078
1192
|
},
|
|
1079
|
-
name:
|
|
1080
|
-
create:
|
|
1193
|
+
name: RULE_NAME22,
|
|
1194
|
+
create: create22,
|
|
1081
1195
|
defaultOptions: []
|
|
1082
1196
|
});
|
|
1083
|
-
function
|
|
1197
|
+
function create22(context) {
|
|
1084
1198
|
return {
|
|
1085
1199
|
CallExpression(node) {
|
|
1086
1200
|
if (core.isCreateRefCall(context, node) && AST11__namespace.findParentNode(node, core.isClassComponent) == null) {
|
|
@@ -1089,25 +1203,25 @@ function create19(context) {
|
|
|
1089
1203
|
}
|
|
1090
1204
|
};
|
|
1091
1205
|
}
|
|
1092
|
-
var
|
|
1093
|
-
var
|
|
1206
|
+
var RULE_NAME23 = "no-default-props";
|
|
1207
|
+
var RULE_FEATURES23 = [];
|
|
1094
1208
|
var no_default_props_default = createRule({
|
|
1095
1209
|
meta: {
|
|
1096
1210
|
type: "problem",
|
|
1097
1211
|
docs: {
|
|
1098
1212
|
description: "Disallow `defaultProps` property in favor of ES6 default parameters.",
|
|
1099
|
-
[Symbol.for("rule_features")]:
|
|
1213
|
+
[Symbol.for("rule_features")]: RULE_FEATURES23
|
|
1100
1214
|
},
|
|
1101
1215
|
messages: {
|
|
1102
1216
|
noDefaultProps: "[Deprecated] Use ES6 default parameters instead."
|
|
1103
1217
|
},
|
|
1104
1218
|
schema: []
|
|
1105
1219
|
},
|
|
1106
|
-
name:
|
|
1107
|
-
create:
|
|
1220
|
+
name: RULE_NAME23,
|
|
1221
|
+
create: create23,
|
|
1108
1222
|
defaultOptions: []
|
|
1109
1223
|
});
|
|
1110
|
-
function
|
|
1224
|
+
function create23(context) {
|
|
1111
1225
|
if (!context.sourceCode.text.includes("defaultProps")) return {};
|
|
1112
1226
|
return {
|
|
1113
1227
|
AssignmentExpression(node) {
|
|
@@ -1124,8 +1238,8 @@ function create20(context) {
|
|
|
1124
1238
|
if (!core.isComponentNameLoose(object.name)) {
|
|
1125
1239
|
return;
|
|
1126
1240
|
}
|
|
1127
|
-
const variable =
|
|
1128
|
-
const variableNode =
|
|
1241
|
+
const variable = VAR2__namespace.findVariable(object.name, context.sourceCode.getScope(node));
|
|
1242
|
+
const variableNode = VAR2__namespace.getVariableInitNode(variable, 0);
|
|
1129
1243
|
if (variableNode == null) return;
|
|
1130
1244
|
if (!AST11__namespace.isFunction(variableNode) && !core.isClassComponent(variableNode)) return;
|
|
1131
1245
|
context.report({ messageId: "noDefaultProps", node: property });
|
|
@@ -1141,8 +1255,8 @@ function create20(context) {
|
|
|
1141
1255
|
}
|
|
1142
1256
|
};
|
|
1143
1257
|
}
|
|
1144
|
-
var
|
|
1145
|
-
var
|
|
1258
|
+
var RULE_NAME24 = "no-direct-mutation-state";
|
|
1259
|
+
var RULE_FEATURES24 = [];
|
|
1146
1260
|
function isConstructorFunction(node) {
|
|
1147
1261
|
return AST11__namespace.isOneOf([types.AST_NODE_TYPES.FunctionDeclaration, types.AST_NODE_TYPES.FunctionExpression])(node) && AST11__namespace.isMethodOrProperty(node.parent) && node.parent.key.type === types.AST_NODE_TYPES.Identifier && node.parent.key.name === "constructor";
|
|
1148
1262
|
}
|
|
@@ -1151,18 +1265,18 @@ var no_direct_mutation_state_default = createRule({
|
|
|
1151
1265
|
type: "problem",
|
|
1152
1266
|
docs: {
|
|
1153
1267
|
description: "Disallow direct mutation of `this.state`.",
|
|
1154
|
-
[Symbol.for("rule_features")]:
|
|
1268
|
+
[Symbol.for("rule_features")]: RULE_FEATURES24
|
|
1155
1269
|
},
|
|
1156
1270
|
messages: {
|
|
1157
1271
|
noDirectMutationState: "Do not mutate state directly. Use 'setState()' instead."
|
|
1158
1272
|
},
|
|
1159
1273
|
schema: []
|
|
1160
1274
|
},
|
|
1161
|
-
name:
|
|
1162
|
-
create:
|
|
1275
|
+
name: RULE_NAME24,
|
|
1276
|
+
create: create24,
|
|
1163
1277
|
defaultOptions: []
|
|
1164
1278
|
});
|
|
1165
|
-
function
|
|
1279
|
+
function create24(context) {
|
|
1166
1280
|
return {
|
|
1167
1281
|
AssignmentExpression(node) {
|
|
1168
1282
|
if (!core.isAssignmentToThisState(node)) return;
|
|
@@ -1183,67 +1297,25 @@ function create21(context) {
|
|
|
1183
1297
|
}
|
|
1184
1298
|
};
|
|
1185
1299
|
}
|
|
1186
|
-
var
|
|
1187
|
-
var
|
|
1188
|
-
var no_duplicate_jsx_props_default = createRule({
|
|
1189
|
-
meta: {
|
|
1190
|
-
type: "problem",
|
|
1191
|
-
docs: {
|
|
1192
|
-
description: "Disallow duplicate props in JSX elements.",
|
|
1193
|
-
[Symbol.for("rule_features")]: RULE_FEATURES22
|
|
1194
|
-
},
|
|
1195
|
-
messages: {
|
|
1196
|
-
noDuplicateJsxProps: "This JSX property is assigned multiple times."
|
|
1197
|
-
},
|
|
1198
|
-
schema: []
|
|
1199
|
-
},
|
|
1200
|
-
name: RULE_NAME22,
|
|
1201
|
-
create: create22,
|
|
1202
|
-
defaultOptions: []
|
|
1203
|
-
});
|
|
1204
|
-
function create22(context) {
|
|
1205
|
-
return {
|
|
1206
|
-
JSXOpeningElement(node) {
|
|
1207
|
-
const props = [];
|
|
1208
|
-
for (const attr of node.attributes) {
|
|
1209
|
-
if (attr.type === types.AST_NODE_TYPES.JSXSpreadAttribute) {
|
|
1210
|
-
continue;
|
|
1211
|
-
}
|
|
1212
|
-
const name5 = attr.name.name;
|
|
1213
|
-
if (typeof name5 !== "string") {
|
|
1214
|
-
continue;
|
|
1215
|
-
}
|
|
1216
|
-
if (!props.includes(name5)) {
|
|
1217
|
-
props.push(name5);
|
|
1218
|
-
continue;
|
|
1219
|
-
}
|
|
1220
|
-
context.report({
|
|
1221
|
-
messageId: "noDuplicateJsxProps",
|
|
1222
|
-
node: attr
|
|
1223
|
-
});
|
|
1224
|
-
}
|
|
1225
|
-
}
|
|
1226
|
-
};
|
|
1227
|
-
}
|
|
1228
|
-
var RULE_NAME23 = "no-duplicate-key";
|
|
1229
|
-
var RULE_FEATURES23 = [];
|
|
1300
|
+
var RULE_NAME25 = "no-duplicate-key";
|
|
1301
|
+
var RULE_FEATURES25 = [];
|
|
1230
1302
|
var no_duplicate_key_default = createRule({
|
|
1231
1303
|
meta: {
|
|
1232
1304
|
type: "problem",
|
|
1233
1305
|
docs: {
|
|
1234
1306
|
description: "Disallow duplicate `key` on elements in the same array or a list of `children`.",
|
|
1235
|
-
[Symbol.for("rule_features")]:
|
|
1307
|
+
[Symbol.for("rule_features")]: RULE_FEATURES25
|
|
1236
1308
|
},
|
|
1237
1309
|
messages: {
|
|
1238
1310
|
noDuplicateKey: "A key must be unique. '{{value}}' is duplicated."
|
|
1239
1311
|
},
|
|
1240
1312
|
schema: []
|
|
1241
1313
|
},
|
|
1242
|
-
name:
|
|
1243
|
-
create:
|
|
1314
|
+
name: RULE_NAME25,
|
|
1315
|
+
create: create25,
|
|
1244
1316
|
defaultOptions: []
|
|
1245
1317
|
});
|
|
1246
|
-
function
|
|
1318
|
+
function create25(context) {
|
|
1247
1319
|
if (!context.sourceCode.getText().includes("key=")) {
|
|
1248
1320
|
return {};
|
|
1249
1321
|
}
|
|
@@ -1273,7 +1345,7 @@ function create23(context) {
|
|
|
1273
1345
|
break;
|
|
1274
1346
|
}
|
|
1275
1347
|
default: {
|
|
1276
|
-
const call = AST11__namespace.findParentNode(jsxElement, AST11__namespace.
|
|
1348
|
+
const call = AST11__namespace.findParentNode(jsxElement, AST11__namespace.isArrayMapCallLoose);
|
|
1277
1349
|
const iter = AST11__namespace.findParentNode(jsxElement, (n) => n === call || AST11__namespace.isFunction(n));
|
|
1278
1350
|
if (!AST11__namespace.isFunction(iter)) return;
|
|
1279
1351
|
const arg0 = call?.arguments[0];
|
|
@@ -1307,8 +1379,8 @@ function create23(context) {
|
|
|
1307
1379
|
}
|
|
1308
1380
|
};
|
|
1309
1381
|
}
|
|
1310
|
-
var
|
|
1311
|
-
var
|
|
1382
|
+
var RULE_NAME26 = "no-forward-ref";
|
|
1383
|
+
var RULE_FEATURES26 = [
|
|
1312
1384
|
"MOD"
|
|
1313
1385
|
];
|
|
1314
1386
|
var no_forward_ref_default = createRule({
|
|
@@ -1316,7 +1388,7 @@ var no_forward_ref_default = createRule({
|
|
|
1316
1388
|
type: "problem",
|
|
1317
1389
|
docs: {
|
|
1318
1390
|
description: "Replaces usages of `forwardRef` with passing `ref` as a prop.",
|
|
1319
|
-
[Symbol.for("rule_features")]:
|
|
1391
|
+
[Symbol.for("rule_features")]: RULE_FEATURES26
|
|
1320
1392
|
},
|
|
1321
1393
|
fixable: "code",
|
|
1322
1394
|
messages: {
|
|
@@ -1324,11 +1396,11 @@ var no_forward_ref_default = createRule({
|
|
|
1324
1396
|
},
|
|
1325
1397
|
schema: []
|
|
1326
1398
|
},
|
|
1327
|
-
name:
|
|
1328
|
-
create:
|
|
1399
|
+
name: RULE_NAME26,
|
|
1400
|
+
create: create26,
|
|
1329
1401
|
defaultOptions: []
|
|
1330
1402
|
});
|
|
1331
|
-
function
|
|
1403
|
+
function create26(context) {
|
|
1332
1404
|
if (!context.sourceCode.text.includes("forwardRef")) {
|
|
1333
1405
|
return {};
|
|
1334
1406
|
}
|
|
@@ -1416,29 +1488,31 @@ function getComponentPropsFixes(context, fixer, node, typeArguments) {
|
|
|
1416
1488
|
...arg1 == null ? [] : [fixer.remove(arg1), fixer.removeRange([arg0.range[1], arg1.range[0]])]
|
|
1417
1489
|
];
|
|
1418
1490
|
}
|
|
1419
|
-
var
|
|
1420
|
-
var
|
|
1491
|
+
var RULE_NAME27 = "no-implicit-key";
|
|
1492
|
+
var RULE_FEATURES27 = [
|
|
1493
|
+
"EXP"
|
|
1494
|
+
];
|
|
1421
1495
|
var no_implicit_key_default = createRule({
|
|
1422
1496
|
meta: {
|
|
1423
1497
|
type: "problem",
|
|
1424
1498
|
docs: {
|
|
1425
1499
|
description: "Prevents `key` from not being explicitly specified (e.g. spreading `key` from objects).",
|
|
1426
|
-
[Symbol.for("rule_features")]:
|
|
1500
|
+
[Symbol.for("rule_features")]: RULE_FEATURES27
|
|
1427
1501
|
},
|
|
1428
1502
|
messages: {
|
|
1429
1503
|
noImplicitKey: "Do not use implicit 'key' props."
|
|
1430
1504
|
},
|
|
1431
1505
|
schema: []
|
|
1432
1506
|
},
|
|
1433
|
-
name:
|
|
1434
|
-
create:
|
|
1507
|
+
name: RULE_NAME27,
|
|
1508
|
+
create: create27,
|
|
1435
1509
|
defaultOptions: []
|
|
1436
1510
|
});
|
|
1437
|
-
function
|
|
1511
|
+
function create27(context) {
|
|
1438
1512
|
return {
|
|
1439
1513
|
JSXOpeningElement(node) {
|
|
1440
1514
|
const initialScope = context.sourceCode.getScope(node);
|
|
1441
|
-
const keyPropFound =
|
|
1515
|
+
const keyPropFound = JSX9__namespace.getAttribute("key", node.attributes, initialScope);
|
|
1442
1516
|
const keyPropOnElement = node.attributes.some(
|
|
1443
1517
|
(n) => n.type === types.AST_NODE_TYPES.JSXAttribute && n.name.type === types.AST_NODE_TYPES.JSXIdentifier && n.name.name === "key"
|
|
1444
1518
|
);
|
|
@@ -1448,8 +1522,8 @@ function create25(context) {
|
|
|
1448
1522
|
}
|
|
1449
1523
|
};
|
|
1450
1524
|
}
|
|
1451
|
-
var
|
|
1452
|
-
var
|
|
1525
|
+
var RULE_NAME28 = "no-leaked-conditional-rendering";
|
|
1526
|
+
var RULE_FEATURES28 = [
|
|
1453
1527
|
"TSC"
|
|
1454
1528
|
];
|
|
1455
1529
|
var tsHelpers = {
|
|
@@ -1535,18 +1609,18 @@ var no_leaked_conditional_rendering_default = createRule({
|
|
|
1535
1609
|
type: "problem",
|
|
1536
1610
|
docs: {
|
|
1537
1611
|
description: "Prevents problematic leaked values from being rendered.",
|
|
1538
|
-
[Symbol.for("rule_features")]:
|
|
1612
|
+
[Symbol.for("rule_features")]: RULE_FEATURES28
|
|
1539
1613
|
},
|
|
1540
1614
|
messages: {
|
|
1541
1615
|
noLeakedConditionalRendering: "Potential leaked value {{value}} that might cause unintentionally rendered values or rendering crashes."
|
|
1542
1616
|
},
|
|
1543
1617
|
schema: []
|
|
1544
1618
|
},
|
|
1545
|
-
name:
|
|
1546
|
-
create:
|
|
1619
|
+
name: RULE_NAME28,
|
|
1620
|
+
create: create28,
|
|
1547
1621
|
defaultOptions: []
|
|
1548
1622
|
});
|
|
1549
|
-
function
|
|
1623
|
+
function create28(context) {
|
|
1550
1624
|
if (!context.sourceCode.text.includes("&&") && !context.sourceCode.text.includes("?")) return {};
|
|
1551
1625
|
const { version: version2 } = shared.getSettingsFromContext(context);
|
|
1552
1626
|
const allowedVariants = [
|
|
@@ -1570,7 +1644,7 @@ function create26(context) {
|
|
|
1570
1644
|
return getReportDescriptor(right);
|
|
1571
1645
|
}
|
|
1572
1646
|
const initialScope = context.sourceCode.getScope(left);
|
|
1573
|
-
const isLeftNan = left.type === types.AST_NODE_TYPES.Identifier && left.name === "NaN" ||
|
|
1647
|
+
const isLeftNan = left.type === types.AST_NODE_TYPES.Identifier && left.name === "NaN" || VAR2__namespace.toStaticValue({ kind: "lazy", node: left, initialScope }).value === "NaN";
|
|
1574
1648
|
if (isLeftNan) {
|
|
1575
1649
|
return {
|
|
1576
1650
|
messageId: "noLeakedConditionalRendering",
|
|
@@ -1592,36 +1666,36 @@ function create26(context) {
|
|
|
1592
1666
|
}).with({ type: types.AST_NODE_TYPES.ConditionalExpression }, ({ alternate, consequent }) => {
|
|
1593
1667
|
return getReportDescriptor(consequent) ?? getReportDescriptor(alternate);
|
|
1594
1668
|
}).with({ type: types.AST_NODE_TYPES.Identifier }, (n) => {
|
|
1595
|
-
const variable =
|
|
1596
|
-
const
|
|
1597
|
-
return getReportDescriptor(
|
|
1669
|
+
const variable = VAR2__namespace.findVariable(n.name, context.sourceCode.getScope(n));
|
|
1670
|
+
const variableDefNode = variable?.defs.at(0)?.node;
|
|
1671
|
+
return tsPattern.match(variableDefNode).with({ init: tsPattern.P.select({ type: tsPattern.P.not(types.AST_NODE_TYPES.VariableDeclaration) }) }, getReportDescriptor).otherwise(() => eff._);
|
|
1598
1672
|
}).otherwise(() => eff._);
|
|
1599
1673
|
}
|
|
1600
|
-
const visitorFunction = eff.flow(getReportDescriptor,
|
|
1674
|
+
const visitorFunction = eff.flow(getReportDescriptor, kit.createReport(context));
|
|
1601
1675
|
return {
|
|
1602
1676
|
"JSXExpressionContainer > ConditionalExpression": visitorFunction,
|
|
1603
1677
|
"JSXExpressionContainer > LogicalExpression": visitorFunction
|
|
1604
1678
|
};
|
|
1605
1679
|
}
|
|
1606
|
-
var
|
|
1607
|
-
var
|
|
1680
|
+
var RULE_NAME29 = "no-missing-component-display-name";
|
|
1681
|
+
var RULE_FEATURES29 = [];
|
|
1608
1682
|
var no_missing_component_display_name_default = createRule({
|
|
1609
1683
|
meta: {
|
|
1610
1684
|
type: "problem",
|
|
1611
1685
|
docs: {
|
|
1612
1686
|
description: "Enforces that all components have a `displayName` which can be used in devtools.",
|
|
1613
|
-
[Symbol.for("rule_features")]:
|
|
1687
|
+
[Symbol.for("rule_features")]: RULE_FEATURES29
|
|
1614
1688
|
},
|
|
1615
1689
|
messages: {
|
|
1616
1690
|
noMissingComponentDisplayName: "Add missing 'displayName' for component."
|
|
1617
1691
|
},
|
|
1618
1692
|
schema: []
|
|
1619
1693
|
},
|
|
1620
|
-
name:
|
|
1621
|
-
create:
|
|
1694
|
+
name: RULE_NAME29,
|
|
1695
|
+
create: create29,
|
|
1622
1696
|
defaultOptions: []
|
|
1623
1697
|
});
|
|
1624
|
-
function
|
|
1698
|
+
function create29(context) {
|
|
1625
1699
|
if (!context.sourceCode.text.includes("memo") && !context.sourceCode.text.includes("forwardRef")) return {};
|
|
1626
1700
|
const {
|
|
1627
1701
|
ctx,
|
|
@@ -1656,25 +1730,25 @@ function create27(context) {
|
|
|
1656
1730
|
}
|
|
1657
1731
|
};
|
|
1658
1732
|
}
|
|
1659
|
-
var
|
|
1660
|
-
var
|
|
1733
|
+
var RULE_NAME30 = "no-missing-context-display-name";
|
|
1734
|
+
var RULE_FEATURES30 = [];
|
|
1661
1735
|
var no_missing_context_display_name_default = createRule({
|
|
1662
1736
|
meta: {
|
|
1663
1737
|
type: "problem",
|
|
1664
1738
|
docs: {
|
|
1665
1739
|
description: "Enforces that all contexts have a `displayName` which can be used in devtools.",
|
|
1666
|
-
[Symbol.for("rule_features")]:
|
|
1740
|
+
[Symbol.for("rule_features")]: RULE_FEATURES30
|
|
1667
1741
|
},
|
|
1668
1742
|
messages: {
|
|
1669
1743
|
noMissingContextDisplayName: "Add missing 'displayName' for context."
|
|
1670
1744
|
},
|
|
1671
1745
|
schema: []
|
|
1672
1746
|
},
|
|
1673
|
-
name:
|
|
1674
|
-
create:
|
|
1747
|
+
name: RULE_NAME30,
|
|
1748
|
+
create: create30,
|
|
1675
1749
|
defaultOptions: []
|
|
1676
1750
|
});
|
|
1677
|
-
function
|
|
1751
|
+
function create30(context) {
|
|
1678
1752
|
if (!context.sourceCode.text.includes("createContext")) return {};
|
|
1679
1753
|
const createCalls = [];
|
|
1680
1754
|
const displayNameAssignments = [];
|
|
@@ -1712,14 +1786,14 @@ function create28(context) {
|
|
|
1712
1786
|
}
|
|
1713
1787
|
};
|
|
1714
1788
|
}
|
|
1715
|
-
var
|
|
1716
|
-
var
|
|
1789
|
+
var RULE_NAME31 = "no-missing-key";
|
|
1790
|
+
var RULE_FEATURES31 = [];
|
|
1717
1791
|
var no_missing_key_default = createRule({
|
|
1718
1792
|
meta: {
|
|
1719
1793
|
type: "problem",
|
|
1720
1794
|
docs: {
|
|
1721
1795
|
description: "Disallow missing `key` on items in list rendering.",
|
|
1722
|
-
[Symbol.for("rule_features")]:
|
|
1796
|
+
[Symbol.for("rule_features")]: RULE_FEATURES31
|
|
1723
1797
|
},
|
|
1724
1798
|
messages: {
|
|
1725
1799
|
missingKey: "Missing 'key' for element when rendering list.",
|
|
@@ -1727,18 +1801,18 @@ var no_missing_key_default = createRule({
|
|
|
1727
1801
|
},
|
|
1728
1802
|
schema: []
|
|
1729
1803
|
},
|
|
1730
|
-
name:
|
|
1731
|
-
create:
|
|
1804
|
+
name: RULE_NAME31,
|
|
1805
|
+
create: create31,
|
|
1732
1806
|
defaultOptions: []
|
|
1733
1807
|
});
|
|
1734
|
-
function
|
|
1735
|
-
const report =
|
|
1808
|
+
function create31(context) {
|
|
1809
|
+
const report = kit.createReport(context);
|
|
1736
1810
|
const state = { isWithinChildrenToArray: false };
|
|
1737
1811
|
function checkIteratorElement(node) {
|
|
1738
1812
|
switch (node.type) {
|
|
1739
1813
|
case types.AST_NODE_TYPES.JSXElement: {
|
|
1740
1814
|
const initialScope = context.sourceCode.getScope(node);
|
|
1741
|
-
if (!
|
|
1815
|
+
if (!JSX9__namespace.hasAttribute("key", node.openingElement.attributes, initialScope)) {
|
|
1742
1816
|
return {
|
|
1743
1817
|
messageId: "missingKey",
|
|
1744
1818
|
node
|
|
@@ -1795,7 +1869,7 @@ function create29(context) {
|
|
|
1795
1869
|
}
|
|
1796
1870
|
const initialScope = context.sourceCode.getScope(node);
|
|
1797
1871
|
for (const element of elements) {
|
|
1798
|
-
if (!
|
|
1872
|
+
if (!JSX9__namespace.hasAttribute("key", element.openingElement.attributes, initialScope)) {
|
|
1799
1873
|
report({
|
|
1800
1874
|
messageId: "missingKey",
|
|
1801
1875
|
node: element
|
|
@@ -1808,7 +1882,7 @@ function create29(context) {
|
|
|
1808
1882
|
if (state.isWithinChildrenToArray) {
|
|
1809
1883
|
return;
|
|
1810
1884
|
}
|
|
1811
|
-
const isMapCall = AST11__namespace.
|
|
1885
|
+
const isMapCall = AST11__namespace.isArrayMapCallLoose(node);
|
|
1812
1886
|
if (!isMapCall && !isArrayFromCall(node)) {
|
|
1813
1887
|
return;
|
|
1814
1888
|
}
|
|
@@ -1844,27 +1918,26 @@ function create29(context) {
|
|
|
1844
1918
|
function isArrayFromCall(node) {
|
|
1845
1919
|
return node.type === types.AST_NODE_TYPES.CallExpression && node.callee.type === types.AST_NODE_TYPES.MemberExpression && node.callee.property.type === types.AST_NODE_TYPES.Identifier && node.callee.property.name === "from";
|
|
1846
1920
|
}
|
|
1847
|
-
var
|
|
1848
|
-
var
|
|
1921
|
+
var RULE_NAME32 = "no-nested-component-definitions";
|
|
1922
|
+
var RULE_FEATURES32 = [];
|
|
1849
1923
|
var no_nested_component_definitions_default = createRule({
|
|
1850
1924
|
meta: {
|
|
1851
1925
|
type: "problem",
|
|
1852
1926
|
docs: {
|
|
1853
1927
|
description: "Disallow nesting component definitions inside other components.",
|
|
1854
|
-
[Symbol.for("rule_features")]:
|
|
1928
|
+
[Symbol.for("rule_features")]: RULE_FEATURES32
|
|
1855
1929
|
},
|
|
1856
1930
|
messages: {
|
|
1857
|
-
|
|
1858
|
-
noNestedComponentDefinitionInProps: "Do not nest component definitions inside props. Move it to the top level or pass it as a prop."
|
|
1931
|
+
noNestedComponentDefinitions: "Do not nest component definitions inside other components or props. {{suggestion}}"
|
|
1859
1932
|
},
|
|
1860
1933
|
schema: []
|
|
1861
1934
|
},
|
|
1862
|
-
name:
|
|
1863
|
-
create:
|
|
1935
|
+
name: RULE_NAME32,
|
|
1936
|
+
create: create32,
|
|
1864
1937
|
defaultOptions: []
|
|
1865
1938
|
});
|
|
1866
|
-
function
|
|
1867
|
-
const hint = core.ERComponentHint.
|
|
1939
|
+
function create32(context) {
|
|
1940
|
+
const hint = core.ERComponentHint.SkipArrayMapArgument | core.ERComponentHint.SkipNullLiteral | core.ERComponentHint.SkipUndefined | core.ERComponentHint.SkipBooleanLiteral | core.ERComponentHint.SkipStringLiteral | core.ERComponentHint.SkipNumberLiteral | core.ERComponentHint.StrictLogical | core.ERComponentHint.StrictConditional;
|
|
1868
1941
|
const collector = core.useComponentCollector(context, { hint });
|
|
1869
1942
|
const collectorLegacy = core.useComponentCollectorLegacy();
|
|
1870
1943
|
return {
|
|
@@ -1889,10 +1962,11 @@ function create30(context) {
|
|
|
1889
1962
|
if (isInsideJSXAttributeValue(component)) {
|
|
1890
1963
|
if (!core.isDeclaredInRenderPropLoose(component)) {
|
|
1891
1964
|
context.report({
|
|
1892
|
-
messageId: "
|
|
1965
|
+
messageId: "noNestedComponentDefinitions",
|
|
1893
1966
|
node: component,
|
|
1894
1967
|
data: {
|
|
1895
|
-
name: name5
|
|
1968
|
+
name: name5,
|
|
1969
|
+
suggestion: "Move it to the top level or pass it as a prop."
|
|
1896
1970
|
}
|
|
1897
1971
|
});
|
|
1898
1972
|
}
|
|
@@ -1900,10 +1974,11 @@ function create30(context) {
|
|
|
1900
1974
|
}
|
|
1901
1975
|
if (isInsideCreateElementProps(context, component)) {
|
|
1902
1976
|
context.report({
|
|
1903
|
-
messageId: "
|
|
1977
|
+
messageId: "noNestedComponentDefinitions",
|
|
1904
1978
|
node: component,
|
|
1905
1979
|
data: {
|
|
1906
|
-
name: name5
|
|
1980
|
+
name: name5,
|
|
1981
|
+
suggestion: "Move it to the top level or pass it as a prop."
|
|
1907
1982
|
}
|
|
1908
1983
|
});
|
|
1909
1984
|
continue;
|
|
@@ -1911,20 +1986,22 @@ function create30(context) {
|
|
|
1911
1986
|
const parentComponent = AST11__namespace.findParentNode(component, isFunctionComponent);
|
|
1912
1987
|
if (parentComponent != null && !core.isDirectValueOfRenderPropertyLoose(parentComponent)) {
|
|
1913
1988
|
context.report({
|
|
1914
|
-
messageId:
|
|
1989
|
+
messageId: "noNestedComponentDefinitions",
|
|
1915
1990
|
node: component,
|
|
1916
1991
|
data: {
|
|
1917
|
-
name: name5
|
|
1992
|
+
name: name5,
|
|
1993
|
+
suggestion: component.parent.type === types.AST_NODE_TYPES.Property ? "Move it to the top level or pass it as a prop." : "Move it to the top level."
|
|
1918
1994
|
}
|
|
1919
1995
|
});
|
|
1920
1996
|
continue;
|
|
1921
1997
|
}
|
|
1922
1998
|
if (core.isInsideRenderMethod(component)) {
|
|
1923
1999
|
context.report({
|
|
1924
|
-
messageId: "
|
|
2000
|
+
messageId: "noNestedComponentDefinitions",
|
|
1925
2001
|
node: component,
|
|
1926
2002
|
data: {
|
|
1927
|
-
name: name5
|
|
2003
|
+
name: name5,
|
|
2004
|
+
suggestion: "Move it to the top level."
|
|
1928
2005
|
}
|
|
1929
2006
|
});
|
|
1930
2007
|
}
|
|
@@ -1934,10 +2011,11 @@ function create30(context) {
|
|
|
1934
2011
|
continue;
|
|
1935
2012
|
}
|
|
1936
2013
|
context.report({
|
|
1937
|
-
messageId: "
|
|
2014
|
+
messageId: "noNestedComponentDefinitions",
|
|
1938
2015
|
node: component,
|
|
1939
2016
|
data: {
|
|
1940
|
-
name: name5
|
|
2017
|
+
name: name5,
|
|
2018
|
+
suggestion: component.parent.type === types.AST_NODE_TYPES.Property ? "Move it to the top level or pass it as a prop." : "Move it to the top level."
|
|
1941
2019
|
}
|
|
1942
2020
|
});
|
|
1943
2021
|
}
|
|
@@ -1945,7 +2023,7 @@ function create30(context) {
|
|
|
1945
2023
|
};
|
|
1946
2024
|
}
|
|
1947
2025
|
function isInsideJSXAttributeValue(node) {
|
|
1948
|
-
return node.parent.type === types.AST_NODE_TYPES.JSXAttribute ||
|
|
2026
|
+
return node.parent.type === types.AST_NODE_TYPES.JSXAttribute || JSX9__namespace.findParentAttribute(node, (n) => n.value?.type === types.AST_NODE_TYPES.JSXExpressionContainer) != null;
|
|
1949
2027
|
}
|
|
1950
2028
|
function isInsideCreateElementProps(context, node) {
|
|
1951
2029
|
const call = AST11__namespace.findParentNode(node, core.isCreateElementCall(context));
|
|
@@ -1954,25 +2032,25 @@ function isInsideCreateElementProps(context, node) {
|
|
|
1954
2032
|
if (prop == null) return false;
|
|
1955
2033
|
return prop === call.arguments[1];
|
|
1956
2034
|
}
|
|
1957
|
-
var
|
|
1958
|
-
var
|
|
2035
|
+
var RULE_NAME33 = "no-prop-types";
|
|
2036
|
+
var RULE_FEATURES33 = [];
|
|
1959
2037
|
var no_prop_types_default = createRule({
|
|
1960
2038
|
meta: {
|
|
1961
2039
|
type: "problem",
|
|
1962
2040
|
docs: {
|
|
1963
2041
|
description: "Disallow `propTypes` in favor of TypeScript or another type-checking solution.",
|
|
1964
|
-
[Symbol.for("rule_features")]:
|
|
2042
|
+
[Symbol.for("rule_features")]: RULE_FEATURES33
|
|
1965
2043
|
},
|
|
1966
2044
|
messages: {
|
|
1967
2045
|
noPropTypes: "[Deprecated] Use TypeScript or another type-checking solution instead."
|
|
1968
2046
|
},
|
|
1969
2047
|
schema: []
|
|
1970
2048
|
},
|
|
1971
|
-
name:
|
|
1972
|
-
create:
|
|
2049
|
+
name: RULE_NAME33,
|
|
2050
|
+
create: create33,
|
|
1973
2051
|
defaultOptions: []
|
|
1974
2052
|
});
|
|
1975
|
-
function
|
|
2053
|
+
function create33(context) {
|
|
1976
2054
|
if (!context.sourceCode.text.includes("propTypes")) {
|
|
1977
2055
|
return {};
|
|
1978
2056
|
}
|
|
@@ -1991,8 +2069,8 @@ function create31(context) {
|
|
|
1991
2069
|
if (!core.isComponentNameLoose(object.name)) {
|
|
1992
2070
|
return;
|
|
1993
2071
|
}
|
|
1994
|
-
const variable =
|
|
1995
|
-
const variableNode =
|
|
2072
|
+
const variable = VAR2__namespace.findVariable(object.name, context.sourceCode.getScope(node));
|
|
2073
|
+
const variableNode = VAR2__namespace.getVariableInitNode(variable, 0);
|
|
1996
2074
|
if (variableNode != null && (AST11__namespace.isFunction(variableNode) || core.isClassComponent(variableNode))) {
|
|
1997
2075
|
context.report({ messageId: "noPropTypes", node: property });
|
|
1998
2076
|
}
|
|
@@ -2008,8 +2086,8 @@ function create31(context) {
|
|
|
2008
2086
|
}
|
|
2009
2087
|
};
|
|
2010
2088
|
}
|
|
2011
|
-
var
|
|
2012
|
-
var
|
|
2089
|
+
var RULE_NAME34 = "no-redundant-should-component-update";
|
|
2090
|
+
var RULE_FEATURES34 = [];
|
|
2013
2091
|
function isShouldComponentUpdate(node) {
|
|
2014
2092
|
return AST11__namespace.isMethodOrProperty(node) && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "shouldComponentUpdate";
|
|
2015
2093
|
}
|
|
@@ -2018,18 +2096,18 @@ var no_redundant_should_component_update_default = createRule({
|
|
|
2018
2096
|
type: "problem",
|
|
2019
2097
|
docs: {
|
|
2020
2098
|
description: "Disallow `shouldComponentUpdate` when extending `React.PureComponent`.",
|
|
2021
|
-
[Symbol.for("rule_features")]:
|
|
2099
|
+
[Symbol.for("rule_features")]: RULE_FEATURES34
|
|
2022
2100
|
},
|
|
2023
2101
|
messages: {
|
|
2024
2102
|
noRedundantShouldComponentUpdate: "'{{componentName}}' does not need 'shouldComponentUpdate' when extending 'React.PureComponent'."
|
|
2025
2103
|
},
|
|
2026
2104
|
schema: []
|
|
2027
2105
|
},
|
|
2028
|
-
name:
|
|
2029
|
-
create:
|
|
2106
|
+
name: RULE_NAME34,
|
|
2107
|
+
create: create34,
|
|
2030
2108
|
defaultOptions: []
|
|
2031
2109
|
});
|
|
2032
|
-
function
|
|
2110
|
+
function create34(context) {
|
|
2033
2111
|
if (!context.sourceCode.text.includes("shouldComponentUpdate")) return {};
|
|
2034
2112
|
const { ctx, listeners } = core.useComponentCollectorLegacy();
|
|
2035
2113
|
return {
|
|
@@ -2056,8 +2134,8 @@ function create32(context) {
|
|
|
2056
2134
|
}
|
|
2057
2135
|
};
|
|
2058
2136
|
}
|
|
2059
|
-
var
|
|
2060
|
-
var
|
|
2137
|
+
var RULE_NAME35 = "no-set-state-in-component-did-mount";
|
|
2138
|
+
var RULE_FEATURES35 = [];
|
|
2061
2139
|
function isComponentDidMount(node) {
|
|
2062
2140
|
return AST11__namespace.isMethodOrProperty(node) && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "componentDidMount";
|
|
2063
2141
|
}
|
|
@@ -2066,18 +2144,18 @@ var no_set_state_in_component_did_mount_default = createRule({
|
|
|
2066
2144
|
type: "problem",
|
|
2067
2145
|
docs: {
|
|
2068
2146
|
description: "Disallow calling `this.setState` in `componentDidMount` outside of functions, such as callbacks.",
|
|
2069
|
-
[Symbol.for("rule_features")]:
|
|
2147
|
+
[Symbol.for("rule_features")]: RULE_FEATURES35
|
|
2070
2148
|
},
|
|
2071
2149
|
messages: {
|
|
2072
2150
|
noSetStateInComponentDidMount: "Do not call `this.setState` in `componentDidMount` outside of functions, such as callbacks."
|
|
2073
2151
|
},
|
|
2074
2152
|
schema: []
|
|
2075
2153
|
},
|
|
2076
|
-
name:
|
|
2077
|
-
create:
|
|
2154
|
+
name: RULE_NAME35,
|
|
2155
|
+
create: create35,
|
|
2078
2156
|
defaultOptions: []
|
|
2079
2157
|
});
|
|
2080
|
-
function
|
|
2158
|
+
function create35(context) {
|
|
2081
2159
|
if (!context.sourceCode.text.includes("componentDidMount")) return {};
|
|
2082
2160
|
return {
|
|
2083
2161
|
CallExpression(node) {
|
|
@@ -2098,8 +2176,8 @@ function create33(context) {
|
|
|
2098
2176
|
}
|
|
2099
2177
|
};
|
|
2100
2178
|
}
|
|
2101
|
-
var
|
|
2102
|
-
var
|
|
2179
|
+
var RULE_NAME36 = "no-set-state-in-component-did-update";
|
|
2180
|
+
var RULE_FEATURES36 = [];
|
|
2103
2181
|
function isComponentDidUpdate(node) {
|
|
2104
2182
|
return AST11__namespace.isMethodOrProperty(node) && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "componentDidUpdate";
|
|
2105
2183
|
}
|
|
@@ -2108,18 +2186,18 @@ var no_set_state_in_component_did_update_default = createRule({
|
|
|
2108
2186
|
type: "problem",
|
|
2109
2187
|
docs: {
|
|
2110
2188
|
description: "Disallows calling `this.setState` in `componentDidUpdate` outside of functions, such as callbacks.",
|
|
2111
|
-
[Symbol.for("rule_features")]:
|
|
2189
|
+
[Symbol.for("rule_features")]: RULE_FEATURES36
|
|
2112
2190
|
},
|
|
2113
2191
|
messages: {
|
|
2114
2192
|
noSetStateInComponentDidUpdate: "Do not call `this.setState` in `componentDidUpdate` outside of functions, such as callbacks."
|
|
2115
2193
|
},
|
|
2116
2194
|
schema: []
|
|
2117
2195
|
},
|
|
2118
|
-
name:
|
|
2119
|
-
create:
|
|
2196
|
+
name: RULE_NAME36,
|
|
2197
|
+
create: create36,
|
|
2120
2198
|
defaultOptions: []
|
|
2121
2199
|
});
|
|
2122
|
-
function
|
|
2200
|
+
function create36(context) {
|
|
2123
2201
|
if (!context.sourceCode.text.includes("componentDidUpdate")) return {};
|
|
2124
2202
|
return {
|
|
2125
2203
|
CallExpression(node) {
|
|
@@ -2140,8 +2218,8 @@ function create34(context) {
|
|
|
2140
2218
|
}
|
|
2141
2219
|
};
|
|
2142
2220
|
}
|
|
2143
|
-
var
|
|
2144
|
-
var
|
|
2221
|
+
var RULE_NAME37 = "no-set-state-in-component-will-update";
|
|
2222
|
+
var RULE_FEATURES37 = [];
|
|
2145
2223
|
function isComponentWillUpdate3(node) {
|
|
2146
2224
|
return AST11__namespace.isMethodOrProperty(node) && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "componentWillUpdate";
|
|
2147
2225
|
}
|
|
@@ -2150,18 +2228,18 @@ var no_set_state_in_component_will_update_default = createRule({
|
|
|
2150
2228
|
type: "problem",
|
|
2151
2229
|
docs: {
|
|
2152
2230
|
description: "Disallows calling `this.setState` in `componentWillUpdate` outside of functions, such as callbacks.",
|
|
2153
|
-
[Symbol.for("rule_features")]:
|
|
2231
|
+
[Symbol.for("rule_features")]: RULE_FEATURES37
|
|
2154
2232
|
},
|
|
2155
2233
|
messages: {
|
|
2156
2234
|
noSetStateInComponentWillUpdate: "Do not call `this.setState` in `componentWillUpdate` outside of functions, such as callbacks."
|
|
2157
2235
|
},
|
|
2158
2236
|
schema: []
|
|
2159
2237
|
},
|
|
2160
|
-
name:
|
|
2161
|
-
create:
|
|
2238
|
+
name: RULE_NAME37,
|
|
2239
|
+
create: create37,
|
|
2162
2240
|
defaultOptions: []
|
|
2163
2241
|
});
|
|
2164
|
-
function
|
|
2242
|
+
function create37(context) {
|
|
2165
2243
|
if (!context.sourceCode.text.includes("componentWillUpdate")) return {};
|
|
2166
2244
|
return {
|
|
2167
2245
|
CallExpression(node) {
|
|
@@ -2182,8 +2260,8 @@ function create35(context) {
|
|
|
2182
2260
|
}
|
|
2183
2261
|
};
|
|
2184
2262
|
}
|
|
2185
|
-
var
|
|
2186
|
-
var
|
|
2263
|
+
var RULE_NAME38 = "no-string-refs";
|
|
2264
|
+
var RULE_FEATURES38 = [];
|
|
2187
2265
|
function containsStringLiteral({ value }) {
|
|
2188
2266
|
return value?.type === types.AST_NODE_TYPES.Literal && typeof value.value === "string";
|
|
2189
2267
|
}
|
|
@@ -2201,18 +2279,18 @@ var no_string_refs_default = createRule({
|
|
|
2201
2279
|
type: "problem",
|
|
2202
2280
|
docs: {
|
|
2203
2281
|
description: "Disallow deprecated string `refs`.",
|
|
2204
|
-
[Symbol.for("rule_features")]:
|
|
2282
|
+
[Symbol.for("rule_features")]: RULE_FEATURES38
|
|
2205
2283
|
},
|
|
2206
2284
|
messages: {
|
|
2207
2285
|
noStringRefs: "[Deprecated] Use callback refs instead."
|
|
2208
2286
|
},
|
|
2209
2287
|
schema: []
|
|
2210
2288
|
},
|
|
2211
|
-
name:
|
|
2212
|
-
create:
|
|
2289
|
+
name: RULE_NAME38,
|
|
2290
|
+
create: create38,
|
|
2213
2291
|
defaultOptions: []
|
|
2214
2292
|
});
|
|
2215
|
-
function
|
|
2293
|
+
function create38(context) {
|
|
2216
2294
|
return {
|
|
2217
2295
|
JSXAttribute(node) {
|
|
2218
2296
|
if (node.name.name !== "ref") {
|
|
@@ -2227,8 +2305,8 @@ function create36(context) {
|
|
|
2227
2305
|
}
|
|
2228
2306
|
};
|
|
2229
2307
|
}
|
|
2230
|
-
var
|
|
2231
|
-
var
|
|
2308
|
+
var RULE_NAME39 = "no-unsafe-component-will-mount";
|
|
2309
|
+
var RULE_FEATURES39 = [];
|
|
2232
2310
|
function isUnsafeComponentWillMount(node) {
|
|
2233
2311
|
return AST11__namespace.isMethodOrProperty(node) && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "UNSAFE_componentWillMount";
|
|
2234
2312
|
}
|
|
@@ -2237,18 +2315,18 @@ var no_unsafe_component_will_mount_default = createRule({
|
|
|
2237
2315
|
type: "problem",
|
|
2238
2316
|
docs: {
|
|
2239
2317
|
description: "Warns the usage of `UNSAFE_componentWillMount` in class components.",
|
|
2240
|
-
[Symbol.for("rule_features")]:
|
|
2318
|
+
[Symbol.for("rule_features")]: RULE_FEATURES39
|
|
2241
2319
|
},
|
|
2242
2320
|
messages: {
|
|
2243
2321
|
noUnsafeComponentWillMount: "Do not use 'UNSAFE_componentWillMount'."
|
|
2244
2322
|
},
|
|
2245
2323
|
schema: []
|
|
2246
2324
|
},
|
|
2247
|
-
name:
|
|
2248
|
-
create:
|
|
2325
|
+
name: RULE_NAME39,
|
|
2326
|
+
create: create39,
|
|
2249
2327
|
defaultOptions: []
|
|
2250
2328
|
});
|
|
2251
|
-
function
|
|
2329
|
+
function create39(context) {
|
|
2252
2330
|
if (!context.sourceCode.text.includes("UNSAFE_componentWillMount")) return {};
|
|
2253
2331
|
const { ctx, listeners } = core.useComponentCollectorLegacy();
|
|
2254
2332
|
return {
|
|
@@ -2269,8 +2347,8 @@ function create37(context) {
|
|
|
2269
2347
|
}
|
|
2270
2348
|
};
|
|
2271
2349
|
}
|
|
2272
|
-
var
|
|
2273
|
-
var
|
|
2350
|
+
var RULE_NAME40 = "no-unsafe-component-will-receive-props";
|
|
2351
|
+
var RULE_FEATURES40 = [];
|
|
2274
2352
|
function isUnsafeComponentWillReceiveProps(node) {
|
|
2275
2353
|
return AST11__namespace.isMethodOrProperty(node) && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "UNSAFE_componentWillReceiveProps";
|
|
2276
2354
|
}
|
|
@@ -2279,18 +2357,18 @@ var no_unsafe_component_will_receive_props_default = createRule({
|
|
|
2279
2357
|
type: "problem",
|
|
2280
2358
|
docs: {
|
|
2281
2359
|
description: "Warns the usage of `UNSAFE_componentWillReceiveProps` in class components.",
|
|
2282
|
-
[Symbol.for("rule_features")]:
|
|
2360
|
+
[Symbol.for("rule_features")]: RULE_FEATURES40
|
|
2283
2361
|
},
|
|
2284
2362
|
messages: {
|
|
2285
2363
|
noUnsafeComponentWillReceiveProps: "Do not use 'UNSAFE_componentWillReceiveProps'."
|
|
2286
2364
|
},
|
|
2287
2365
|
schema: []
|
|
2288
2366
|
},
|
|
2289
|
-
name:
|
|
2290
|
-
create:
|
|
2367
|
+
name: RULE_NAME40,
|
|
2368
|
+
create: create40,
|
|
2291
2369
|
defaultOptions: []
|
|
2292
2370
|
});
|
|
2293
|
-
function
|
|
2371
|
+
function create40(context) {
|
|
2294
2372
|
if (!context.sourceCode.text.includes("UNSAFE_componentWillReceiveProps")) {
|
|
2295
2373
|
return {};
|
|
2296
2374
|
}
|
|
@@ -2313,8 +2391,8 @@ function create38(context) {
|
|
|
2313
2391
|
}
|
|
2314
2392
|
};
|
|
2315
2393
|
}
|
|
2316
|
-
var
|
|
2317
|
-
var
|
|
2394
|
+
var RULE_NAME41 = "no-unsafe-component-will-update";
|
|
2395
|
+
var RULE_FEATURES41 = [];
|
|
2318
2396
|
function isUnsafeComponentWillUpdate(node) {
|
|
2319
2397
|
return AST11__namespace.isMethodOrProperty(node) && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "UNSAFE_componentWillUpdate";
|
|
2320
2398
|
}
|
|
@@ -2323,18 +2401,18 @@ var no_unsafe_component_will_update_default = createRule({
|
|
|
2323
2401
|
type: "problem",
|
|
2324
2402
|
docs: {
|
|
2325
2403
|
description: "Warns the usage of `UNSAFE_componentWillUpdate` in class components.",
|
|
2326
|
-
[Symbol.for("rule_features")]:
|
|
2404
|
+
[Symbol.for("rule_features")]: RULE_FEATURES41
|
|
2327
2405
|
},
|
|
2328
2406
|
messages: {
|
|
2329
2407
|
noUnsafeComponentWillUpdate: "Do not use 'UNSAFE_componentWillUpdate'."
|
|
2330
2408
|
},
|
|
2331
2409
|
schema: []
|
|
2332
2410
|
},
|
|
2333
|
-
name:
|
|
2334
|
-
create:
|
|
2411
|
+
name: RULE_NAME41,
|
|
2412
|
+
create: create41,
|
|
2335
2413
|
defaultOptions: []
|
|
2336
2414
|
});
|
|
2337
|
-
function
|
|
2415
|
+
function create41(context) {
|
|
2338
2416
|
if (!context.sourceCode.text.includes("UNSAFE_componentWillUpdate")) return {};
|
|
2339
2417
|
const { ctx, listeners } = core.useComponentCollectorLegacy();
|
|
2340
2418
|
return {
|
|
@@ -2355,25 +2433,25 @@ function create39(context) {
|
|
|
2355
2433
|
}
|
|
2356
2434
|
};
|
|
2357
2435
|
}
|
|
2358
|
-
var
|
|
2359
|
-
var
|
|
2436
|
+
var RULE_NAME42 = "no-unstable-context-value";
|
|
2437
|
+
var RULE_FEATURES42 = [];
|
|
2360
2438
|
var no_unstable_context_value_default = createRule({
|
|
2361
2439
|
meta: {
|
|
2362
2440
|
type: "problem",
|
|
2363
2441
|
docs: {
|
|
2364
2442
|
description: "Prevents non-stable values (i.e. object literals) from being used as a value for `Context.Provider`.",
|
|
2365
|
-
[Symbol.for("rule_features")]:
|
|
2443
|
+
[Symbol.for("rule_features")]: RULE_FEATURES42
|
|
2366
2444
|
},
|
|
2367
2445
|
messages: {
|
|
2368
2446
|
unstableContextValue: "A/an '{{type}}' passed as the value prop to the context provider should not be constructed. It will change on every render. {{suggestion}}"
|
|
2369
2447
|
},
|
|
2370
2448
|
schema: []
|
|
2371
2449
|
},
|
|
2372
|
-
name:
|
|
2373
|
-
create:
|
|
2450
|
+
name: RULE_NAME42,
|
|
2451
|
+
create: create42,
|
|
2374
2452
|
defaultOptions: []
|
|
2375
2453
|
});
|
|
2376
|
-
function
|
|
2454
|
+
function create42(context) {
|
|
2377
2455
|
const { version: version2 } = shared.getSettingsFromContext(context);
|
|
2378
2456
|
const isReact18OrBelow = compareVersions.compare(version2, "19.0.0", "<");
|
|
2379
2457
|
const { ctx, listeners } = core.useComponentCollector(context);
|
|
@@ -2381,7 +2459,7 @@ function create40(context) {
|
|
|
2381
2459
|
return {
|
|
2382
2460
|
...listeners,
|
|
2383
2461
|
JSXOpeningElement(node) {
|
|
2384
|
-
const fullName =
|
|
2462
|
+
const fullName = JSX9__namespace.getElementType(node.parent);
|
|
2385
2463
|
const selfName = fullName.split(".").at(-1);
|
|
2386
2464
|
if (selfName == null) return;
|
|
2387
2465
|
if (!isContextName(selfName, isReact18OrBelow)) return;
|
|
@@ -2395,7 +2473,7 @@ function create40(context) {
|
|
|
2395
2473
|
if (value?.type !== types.AST_NODE_TYPES.JSXExpressionContainer) return;
|
|
2396
2474
|
const valueExpression = value.expression;
|
|
2397
2475
|
const initialScope = context.sourceCode.getScope(valueExpression);
|
|
2398
|
-
const construction =
|
|
2476
|
+
const construction = VAR2__namespace.getValueConstruction(valueExpression, initialScope);
|
|
2399
2477
|
if (construction == null) return;
|
|
2400
2478
|
if (core.isReactHookCall(construction.node)) {
|
|
2401
2479
|
return;
|
|
@@ -2428,25 +2506,25 @@ function isContextName(name5, isReact18OrBelow) {
|
|
|
2428
2506
|
}
|
|
2429
2507
|
return false;
|
|
2430
2508
|
}
|
|
2431
|
-
var
|
|
2432
|
-
var
|
|
2509
|
+
var RULE_NAME43 = "no-unstable-default-props";
|
|
2510
|
+
var RULE_FEATURES43 = [];
|
|
2433
2511
|
var no_unstable_default_props_default = createRule({
|
|
2434
2512
|
meta: {
|
|
2435
2513
|
type: "problem",
|
|
2436
2514
|
docs: {
|
|
2437
2515
|
description: "Prevents using referential-type values as default props in object destructuring.",
|
|
2438
|
-
[Symbol.for("rule_features")]:
|
|
2516
|
+
[Symbol.for("rule_features")]: RULE_FEATURES43
|
|
2439
2517
|
},
|
|
2440
2518
|
messages: {
|
|
2441
2519
|
noUnstableDefaultProps: "A/an '{{forbiddenType}}' as default prop. This could lead to potential infinite render loop in React. Use a variable instead of '{{forbiddenType}}'."
|
|
2442
2520
|
},
|
|
2443
2521
|
schema: []
|
|
2444
2522
|
},
|
|
2445
|
-
name:
|
|
2446
|
-
create:
|
|
2523
|
+
name: RULE_NAME43,
|
|
2524
|
+
create: create43,
|
|
2447
2525
|
defaultOptions: []
|
|
2448
2526
|
});
|
|
2449
|
-
function
|
|
2527
|
+
function create43(context) {
|
|
2450
2528
|
const { ctx, listeners } = core.useComponentCollector(context);
|
|
2451
2529
|
const declarators = /* @__PURE__ */ new Map();
|
|
2452
2530
|
return {
|
|
@@ -2469,10 +2547,10 @@ function create41(context) {
|
|
|
2469
2547
|
const { value } = prop;
|
|
2470
2548
|
const { right } = value;
|
|
2471
2549
|
const initialScope = context.sourceCode.getScope(value);
|
|
2472
|
-
const construction =
|
|
2550
|
+
const construction = VAR2__namespace.getValueConstruction(
|
|
2473
2551
|
value,
|
|
2474
2552
|
initialScope,
|
|
2475
|
-
|
|
2553
|
+
VAR2__namespace.ValueConstructionHint.StrictCallExpression
|
|
2476
2554
|
);
|
|
2477
2555
|
if (construction == null) {
|
|
2478
2556
|
continue;
|
|
@@ -2502,8 +2580,8 @@ function create41(context) {
|
|
|
2502
2580
|
}
|
|
2503
2581
|
};
|
|
2504
2582
|
}
|
|
2505
|
-
var
|
|
2506
|
-
var
|
|
2583
|
+
var RULE_NAME44 = "no-unused-class-component-members";
|
|
2584
|
+
var RULE_FEATURES44 = [];
|
|
2507
2585
|
var LIFECYCLE_METHODS = /* @__PURE__ */ new Set([
|
|
2508
2586
|
"componentDidCatch",
|
|
2509
2587
|
"componentDidMount",
|
|
@@ -2529,18 +2607,18 @@ var no_unused_class_component_members_default = createRule({
|
|
|
2529
2607
|
type: "problem",
|
|
2530
2608
|
docs: {
|
|
2531
2609
|
description: "Warns unused class component methods and properties.",
|
|
2532
|
-
[Symbol.for("rule_features")]:
|
|
2610
|
+
[Symbol.for("rule_features")]: RULE_FEATURES44
|
|
2533
2611
|
},
|
|
2534
2612
|
messages: {
|
|
2535
2613
|
noUnusedClassComponentMembers: "Unused method or property '{{methodName}}'' of class '{{className}}'."
|
|
2536
2614
|
},
|
|
2537
2615
|
schema: []
|
|
2538
2616
|
},
|
|
2539
|
-
name:
|
|
2540
|
-
create:
|
|
2617
|
+
name: RULE_NAME44,
|
|
2618
|
+
create: create44,
|
|
2541
2619
|
defaultOptions: []
|
|
2542
2620
|
});
|
|
2543
|
-
function
|
|
2621
|
+
function create44(context) {
|
|
2544
2622
|
const classEntries = [];
|
|
2545
2623
|
const methodEntries = [];
|
|
2546
2624
|
const propertyDefs = /* @__PURE__ */ new WeakMap();
|
|
@@ -2650,8 +2728,8 @@ function create42(context) {
|
|
|
2650
2728
|
}
|
|
2651
2729
|
};
|
|
2652
2730
|
}
|
|
2653
|
-
var
|
|
2654
|
-
var
|
|
2731
|
+
var RULE_NAME45 = "no-unused-state";
|
|
2732
|
+
var RULE_FEATURES45 = [];
|
|
2655
2733
|
function isKeyLiteral3(node, key) {
|
|
2656
2734
|
return tsPattern.match(key).with({ type: types.AST_NODE_TYPES.Literal }, eff.constTrue).with({ type: types.AST_NODE_TYPES.TemplateLiteral, expressions: [] }, eff.constTrue).with({ type: types.AST_NODE_TYPES.Identifier }, () => !node.computed).otherwise(eff.constFalse);
|
|
2657
2735
|
}
|
|
@@ -2660,18 +2738,18 @@ var no_unused_state_default = createRule({
|
|
|
2660
2738
|
type: "problem",
|
|
2661
2739
|
docs: {
|
|
2662
2740
|
description: "Warns unused class component state.",
|
|
2663
|
-
[Symbol.for("rule_features")]:
|
|
2741
|
+
[Symbol.for("rule_features")]: RULE_FEATURES45
|
|
2664
2742
|
},
|
|
2665
2743
|
messages: {
|
|
2666
2744
|
noUnusedState: "Unused class component state in '{{className}}'"
|
|
2667
2745
|
},
|
|
2668
2746
|
schema: []
|
|
2669
2747
|
},
|
|
2670
|
-
name:
|
|
2671
|
-
create:
|
|
2748
|
+
name: RULE_NAME45,
|
|
2749
|
+
create: create45,
|
|
2672
2750
|
defaultOptions: []
|
|
2673
2751
|
});
|
|
2674
|
-
function
|
|
2752
|
+
function create45(context) {
|
|
2675
2753
|
const classEntries = [];
|
|
2676
2754
|
const methodEntries = [];
|
|
2677
2755
|
const constructorEntries = [];
|
|
@@ -2805,8 +2883,8 @@ function create43(context) {
|
|
|
2805
2883
|
}
|
|
2806
2884
|
};
|
|
2807
2885
|
}
|
|
2808
|
-
var
|
|
2809
|
-
var
|
|
2886
|
+
var RULE_NAME46 = "no-use-context";
|
|
2887
|
+
var RULE_FEATURES46 = [
|
|
2810
2888
|
"MOD"
|
|
2811
2889
|
];
|
|
2812
2890
|
var no_use_context_default = createRule({
|
|
@@ -2814,7 +2892,7 @@ var no_use_context_default = createRule({
|
|
|
2814
2892
|
type: "problem",
|
|
2815
2893
|
docs: {
|
|
2816
2894
|
description: "Replaces usages of `useContext` with `use`.",
|
|
2817
|
-
[Symbol.for("rule_features")]:
|
|
2895
|
+
[Symbol.for("rule_features")]: RULE_FEATURES46
|
|
2818
2896
|
},
|
|
2819
2897
|
fixable: "code",
|
|
2820
2898
|
messages: {
|
|
@@ -2822,11 +2900,11 @@ var no_use_context_default = createRule({
|
|
|
2822
2900
|
},
|
|
2823
2901
|
schema: []
|
|
2824
2902
|
},
|
|
2825
|
-
name:
|
|
2826
|
-
create:
|
|
2903
|
+
name: RULE_NAME46,
|
|
2904
|
+
create: create46,
|
|
2827
2905
|
defaultOptions: []
|
|
2828
2906
|
});
|
|
2829
|
-
function
|
|
2907
|
+
function create46(context) {
|
|
2830
2908
|
if (!context.sourceCode.text.includes("useContext")) return {};
|
|
2831
2909
|
const settings4 = shared.getSettingsFromContext(context);
|
|
2832
2910
|
const useContextAlias = /* @__PURE__ */ new Set();
|
|
@@ -2904,25 +2982,25 @@ function getAssociatedTokens(context, node) {
|
|
|
2904
2982
|
return tokens;
|
|
2905
2983
|
}
|
|
2906
2984
|
}
|
|
2907
|
-
var
|
|
2908
|
-
var
|
|
2985
|
+
var RULE_NAME47 = "no-useless-forward-ref";
|
|
2986
|
+
var RULE_FEATURES47 = [];
|
|
2909
2987
|
var no_useless_forward_ref_default = createRule({
|
|
2910
2988
|
meta: {
|
|
2911
2989
|
type: "problem",
|
|
2912
2990
|
docs: {
|
|
2913
2991
|
description: "Disallow useless `forwardRef` calls on components that don't use `ref`s.",
|
|
2914
|
-
[Symbol.for("rule_features")]:
|
|
2992
|
+
[Symbol.for("rule_features")]: RULE_FEATURES47
|
|
2915
2993
|
},
|
|
2916
2994
|
messages: {
|
|
2917
2995
|
noUselessForwardRef: "A 'forwardRef' is used with this component but no 'ref' parameter is set."
|
|
2918
2996
|
},
|
|
2919
2997
|
schema: []
|
|
2920
2998
|
},
|
|
2921
|
-
name:
|
|
2922
|
-
create:
|
|
2999
|
+
name: RULE_NAME47,
|
|
3000
|
+
create: create47,
|
|
2923
3001
|
defaultOptions: []
|
|
2924
3002
|
});
|
|
2925
|
-
function
|
|
3003
|
+
function create47(context) {
|
|
2926
3004
|
return {
|
|
2927
3005
|
CallExpression(node) {
|
|
2928
3006
|
if (!core.isForwardRefCall(context, node)) {
|
|
@@ -2943,7 +3021,7 @@ function create45(context) {
|
|
|
2943
3021
|
}
|
|
2944
3022
|
};
|
|
2945
3023
|
}
|
|
2946
|
-
var
|
|
3024
|
+
var RULE_NAME48 = "no-useless-fragment";
|
|
2947
3025
|
var defaultOptions = [{
|
|
2948
3026
|
allowExpressions: true
|
|
2949
3027
|
}];
|
|
@@ -2969,15 +3047,15 @@ var no_useless_fragment_default = createRule({
|
|
|
2969
3047
|
}
|
|
2970
3048
|
}]
|
|
2971
3049
|
},
|
|
2972
|
-
name:
|
|
2973
|
-
create:
|
|
3050
|
+
name: RULE_NAME48,
|
|
3051
|
+
create: create48,
|
|
2974
3052
|
defaultOptions
|
|
2975
3053
|
});
|
|
2976
|
-
function
|
|
3054
|
+
function create48(context, [option]) {
|
|
2977
3055
|
const { allowExpressions = true } = option;
|
|
2978
3056
|
return {
|
|
2979
3057
|
JSXElement(node) {
|
|
2980
|
-
if (!
|
|
3058
|
+
if (!JSX9__namespace.isFragmentElement(node)) return;
|
|
2981
3059
|
doCheck(context, node, allowExpressions);
|
|
2982
3060
|
},
|
|
2983
3061
|
JSXFragment(node) {
|
|
@@ -2999,12 +3077,12 @@ function doCheck(context, node, allowExpressions) {
|
|
|
2999
3077
|
return null;
|
|
3000
3078
|
}
|
|
3001
3079
|
if (node.children.some(
|
|
3002
|
-
(child) =>
|
|
3080
|
+
(child) => JSX9__namespace.isLiteral(child) && !JSX9__namespace.isWhiteSpace(child) || AST11__namespace.is(types.AST_NODE_TYPES.JSXExpressionContainer)(child)
|
|
3003
3081
|
)) {
|
|
3004
3082
|
return null;
|
|
3005
3083
|
}
|
|
3006
3084
|
}
|
|
3007
|
-
if (
|
|
3085
|
+
if (JSX9__namespace.isUserDefinedElement(node.parent)) {
|
|
3008
3086
|
return null;
|
|
3009
3087
|
}
|
|
3010
3088
|
const opener = node.type === types.AST_NODE_TYPES.JSXFragment ? node.openingFragment : node.openingElement;
|
|
@@ -3013,10 +3091,10 @@ function doCheck(context, node, allowExpressions) {
|
|
|
3013
3091
|
return fixer.replaceText(node, trimLikeReact(childrenText));
|
|
3014
3092
|
}
|
|
3015
3093
|
const initialScope = context.sourceCode.getScope(node);
|
|
3016
|
-
if (
|
|
3094
|
+
if (JSX9__namespace.isKeyedElement(node, initialScope)) {
|
|
3017
3095
|
return;
|
|
3018
3096
|
}
|
|
3019
|
-
if (
|
|
3097
|
+
if (JSX9__namespace.isBuiltInElement(node.parent)) {
|
|
3020
3098
|
context.report({
|
|
3021
3099
|
messageId: "uselessFragment",
|
|
3022
3100
|
node,
|
|
@@ -3040,7 +3118,7 @@ function doCheck(context, node, allowExpressions) {
|
|
|
3040
3118
|
const isChildElement = AST11__namespace.isOneOf([types.AST_NODE_TYPES.JSXElement, types.AST_NODE_TYPES.JSXFragment])(node.parent);
|
|
3041
3119
|
switch (true) {
|
|
3042
3120
|
// <Foo content={<>ee eeee eeee ...</>} />
|
|
3043
|
-
case (allowExpressions && !isChildElement && node.children.length === 1 &&
|
|
3121
|
+
case (allowExpressions && !isChildElement && node.children.length === 1 && JSX9__namespace.isLiteral(node.children.at(0))): {
|
|
3044
3122
|
return;
|
|
3045
3123
|
}
|
|
3046
3124
|
// <Foo><>hello, world</></Foo>
|
|
@@ -3067,7 +3145,7 @@ function doCheck(context, node, allowExpressions) {
|
|
|
3067
3145
|
return;
|
|
3068
3146
|
}
|
|
3069
3147
|
}
|
|
3070
|
-
const nonPaddingChildren = node.children.filter((child) => !
|
|
3148
|
+
const nonPaddingChildren = node.children.filter((child) => !JSX9__namespace.isPaddingSpaces(child));
|
|
3071
3149
|
const firstNonPaddingChild = nonPaddingChildren.at(0);
|
|
3072
3150
|
switch (true) {
|
|
3073
3151
|
case nonPaddingChildren.length === 0:
|
|
@@ -3085,8 +3163,8 @@ function doCheck(context, node, allowExpressions) {
|
|
|
3085
3163
|
}
|
|
3086
3164
|
return;
|
|
3087
3165
|
}
|
|
3088
|
-
var
|
|
3089
|
-
var
|
|
3166
|
+
var RULE_NAME49 = "prefer-destructuring-assignment";
|
|
3167
|
+
var RULE_FEATURES48 = [];
|
|
3090
3168
|
function isMemberExpressionWithObjectName(node) {
|
|
3091
3169
|
return node.object.type === types.AST_NODE_TYPES.Identifier && "name" in node.object;
|
|
3092
3170
|
}
|
|
@@ -3095,18 +3173,18 @@ var prefer_destructuring_assignment_default = createRule({
|
|
|
3095
3173
|
type: "problem",
|
|
3096
3174
|
docs: {
|
|
3097
3175
|
description: "Enforces destructuring assignment for component props and context.",
|
|
3098
|
-
[Symbol.for("rule_features")]:
|
|
3176
|
+
[Symbol.for("rule_features")]: RULE_FEATURES48
|
|
3099
3177
|
},
|
|
3100
3178
|
messages: {
|
|
3101
3179
|
preferDestructuringAssignment: "Use destructuring assignment for {{name}}."
|
|
3102
3180
|
},
|
|
3103
3181
|
schema: []
|
|
3104
3182
|
},
|
|
3105
|
-
name:
|
|
3106
|
-
create:
|
|
3183
|
+
name: RULE_NAME49,
|
|
3184
|
+
create: create49,
|
|
3107
3185
|
defaultOptions: []
|
|
3108
3186
|
});
|
|
3109
|
-
function
|
|
3187
|
+
function create49(context) {
|
|
3110
3188
|
const { ctx, listeners } = core.useComponentCollector(context);
|
|
3111
3189
|
const memberExpressionWithNames = [];
|
|
3112
3190
|
return {
|
|
@@ -3166,16 +3244,17 @@ function create47(context) {
|
|
|
3166
3244
|
}
|
|
3167
3245
|
};
|
|
3168
3246
|
}
|
|
3169
|
-
var
|
|
3170
|
-
var
|
|
3171
|
-
"FIX"
|
|
3247
|
+
var RULE_NAME50 = "prefer-react-namespace-import";
|
|
3248
|
+
var RULE_FEATURES49 = [
|
|
3249
|
+
"FIX",
|
|
3250
|
+
"EXP"
|
|
3172
3251
|
];
|
|
3173
3252
|
var prefer_react_namespace_import_default = createRule({
|
|
3174
3253
|
meta: {
|
|
3175
3254
|
type: "problem",
|
|
3176
3255
|
docs: {
|
|
3177
3256
|
description: "Enforces React is imported via a namespace import.",
|
|
3178
|
-
[Symbol.for("rule_features")]:
|
|
3257
|
+
[Symbol.for("rule_features")]: RULE_FEATURES49
|
|
3179
3258
|
},
|
|
3180
3259
|
fixable: "code",
|
|
3181
3260
|
messages: {
|
|
@@ -3183,11 +3262,11 @@ var prefer_react_namespace_import_default = createRule({
|
|
|
3183
3262
|
},
|
|
3184
3263
|
schema: []
|
|
3185
3264
|
},
|
|
3186
|
-
name:
|
|
3187
|
-
create:
|
|
3265
|
+
name: RULE_NAME50,
|
|
3266
|
+
create: create50,
|
|
3188
3267
|
defaultOptions: []
|
|
3189
3268
|
});
|
|
3190
|
-
function
|
|
3269
|
+
function create50(context) {
|
|
3191
3270
|
const { importSource } = shared.getSettingsFromContext(context);
|
|
3192
3271
|
return {
|
|
3193
3272
|
[`ImportDeclaration[source.value="${importSource}"] ImportDefaultSpecifier`](node) {
|
|
@@ -3220,27 +3299,28 @@ ${importStringPrefix} ${specifiers} from ${importSourceQuoted}${semiColon}`
|
|
|
3220
3299
|
}
|
|
3221
3300
|
};
|
|
3222
3301
|
}
|
|
3223
|
-
var
|
|
3224
|
-
var
|
|
3225
|
-
"TSC"
|
|
3302
|
+
var RULE_NAME51 = "prefer-read-only-props";
|
|
3303
|
+
var RULE_FEATURES50 = [
|
|
3304
|
+
"TSC",
|
|
3305
|
+
"EXP"
|
|
3226
3306
|
];
|
|
3227
3307
|
var prefer_read_only_props_default = createRule({
|
|
3228
3308
|
meta: {
|
|
3229
3309
|
type: "problem",
|
|
3230
3310
|
docs: {
|
|
3231
3311
|
description: "Enforces read-only props in components.",
|
|
3232
|
-
[Symbol.for("rule_features")]:
|
|
3312
|
+
[Symbol.for("rule_features")]: RULE_FEATURES50
|
|
3233
3313
|
},
|
|
3234
3314
|
messages: {
|
|
3235
3315
|
preferReadOnlyProps: "A function component's props should be read-only."
|
|
3236
3316
|
},
|
|
3237
3317
|
schema: []
|
|
3238
3318
|
},
|
|
3239
|
-
name:
|
|
3240
|
-
create:
|
|
3319
|
+
name: RULE_NAME51,
|
|
3320
|
+
create: create51,
|
|
3241
3321
|
defaultOptions: []
|
|
3242
3322
|
});
|
|
3243
|
-
function
|
|
3323
|
+
function create51(context) {
|
|
3244
3324
|
const services = utils.ESLintUtils.getParserServices(context, false);
|
|
3245
3325
|
const { ctx, listeners } = core.useComponentCollector(context);
|
|
3246
3326
|
return {
|
|
@@ -3270,8 +3350,8 @@ function isTypeReadonlyLoose(services, type) {
|
|
|
3270
3350
|
return true;
|
|
3271
3351
|
}
|
|
3272
3352
|
}
|
|
3273
|
-
var
|
|
3274
|
-
var
|
|
3353
|
+
var RULE_NAME52 = "prefer-shorthand-boolean";
|
|
3354
|
+
var RULE_FEATURES51 = [
|
|
3275
3355
|
"FIX"
|
|
3276
3356
|
];
|
|
3277
3357
|
var prefer_shorthand_boolean_default = createRule({
|
|
@@ -3279,7 +3359,7 @@ var prefer_shorthand_boolean_default = createRule({
|
|
|
3279
3359
|
type: "problem",
|
|
3280
3360
|
docs: {
|
|
3281
3361
|
description: "Enforces shorthand syntax for boolean attributes.",
|
|
3282
|
-
[Symbol.for("rule_features")]:
|
|
3362
|
+
[Symbol.for("rule_features")]: RULE_FEATURES51
|
|
3283
3363
|
},
|
|
3284
3364
|
fixable: "code",
|
|
3285
3365
|
messages: {
|
|
@@ -3287,15 +3367,15 @@ var prefer_shorthand_boolean_default = createRule({
|
|
|
3287
3367
|
},
|
|
3288
3368
|
schema: []
|
|
3289
3369
|
},
|
|
3290
|
-
name:
|
|
3291
|
-
create:
|
|
3370
|
+
name: RULE_NAME52,
|
|
3371
|
+
create: create52,
|
|
3292
3372
|
defaultOptions: []
|
|
3293
3373
|
});
|
|
3294
|
-
function
|
|
3374
|
+
function create52(context) {
|
|
3295
3375
|
return {
|
|
3296
3376
|
JSXAttribute(node) {
|
|
3297
3377
|
const { value } = node;
|
|
3298
|
-
const propName =
|
|
3378
|
+
const propName = JSX9__namespace.getAttributeName(node);
|
|
3299
3379
|
const hasValueTrue = value?.type === types.AST_NODE_TYPES.JSXExpressionContainer && value.expression.type === types.AST_NODE_TYPES.Literal && value.expression.value === true;
|
|
3300
3380
|
if (!hasValueTrue) {
|
|
3301
3381
|
return;
|
|
@@ -3311,8 +3391,8 @@ function create50(context) {
|
|
|
3311
3391
|
}
|
|
3312
3392
|
};
|
|
3313
3393
|
}
|
|
3314
|
-
var
|
|
3315
|
-
var
|
|
3394
|
+
var RULE_NAME53 = "prefer-shorthand-fragment";
|
|
3395
|
+
var RULE_FEATURES52 = [
|
|
3316
3396
|
"FIX"
|
|
3317
3397
|
];
|
|
3318
3398
|
var prefer_shorthand_fragment_default = createRule({
|
|
@@ -3320,7 +3400,7 @@ var prefer_shorthand_fragment_default = createRule({
|
|
|
3320
3400
|
type: "problem",
|
|
3321
3401
|
docs: {
|
|
3322
3402
|
description: "Enforces shorthand syntax for fragments.",
|
|
3323
|
-
[Symbol.for("rule_features")]:
|
|
3403
|
+
[Symbol.for("rule_features")]: RULE_FEATURES52
|
|
3324
3404
|
},
|
|
3325
3405
|
fixable: "code",
|
|
3326
3406
|
messages: {
|
|
@@ -3328,14 +3408,14 @@ var prefer_shorthand_fragment_default = createRule({
|
|
|
3328
3408
|
},
|
|
3329
3409
|
schema: []
|
|
3330
3410
|
},
|
|
3331
|
-
name:
|
|
3332
|
-
create:
|
|
3411
|
+
name: RULE_NAME53,
|
|
3412
|
+
create: create53,
|
|
3333
3413
|
defaultOptions: []
|
|
3334
3414
|
});
|
|
3335
|
-
function
|
|
3415
|
+
function create53(context) {
|
|
3336
3416
|
return {
|
|
3337
3417
|
JSXElement(node) {
|
|
3338
|
-
if (!
|
|
3418
|
+
if (!JSX9__namespace.isFragmentElement(node)) return;
|
|
3339
3419
|
const hasAttributes = node.openingElement.attributes.length > 0;
|
|
3340
3420
|
if (hasAttributes) {
|
|
3341
3421
|
return;
|
|
@@ -3357,46 +3437,6 @@ function create51(context) {
|
|
|
3357
3437
|
}
|
|
3358
3438
|
};
|
|
3359
3439
|
}
|
|
3360
|
-
var RULE_NAME52 = "use-jsx-vars";
|
|
3361
|
-
var RULE_FEATURES51 = [];
|
|
3362
|
-
var use_jsx_vars_default = createRule({
|
|
3363
|
-
meta: {
|
|
3364
|
-
type: "problem",
|
|
3365
|
-
docs: {
|
|
3366
|
-
description: "Marks variables used in JSX as used.",
|
|
3367
|
-
[Symbol.for("rule_features")]: RULE_FEATURES51
|
|
3368
|
-
},
|
|
3369
|
-
messages: {
|
|
3370
|
-
useJsxVars: ""
|
|
3371
|
-
},
|
|
3372
|
-
schema: []
|
|
3373
|
-
},
|
|
3374
|
-
name: RULE_NAME52,
|
|
3375
|
-
create: create52,
|
|
3376
|
-
defaultOptions: []
|
|
3377
|
-
});
|
|
3378
|
-
function create52(context) {
|
|
3379
|
-
return {
|
|
3380
|
-
JSXOpeningElement(node) {
|
|
3381
|
-
switch (node.name.type) {
|
|
3382
|
-
case types.AST_NODE_TYPES.JSXIdentifier: {
|
|
3383
|
-
if (/^[a-z]/u.test(node.name.name)) {
|
|
3384
|
-
return;
|
|
3385
|
-
}
|
|
3386
|
-
context.sourceCode.markVariableAsUsed(node.name.name, node);
|
|
3387
|
-
break;
|
|
3388
|
-
}
|
|
3389
|
-
case types.AST_NODE_TYPES.JSXMemberExpression: {
|
|
3390
|
-
const { object } = node.name;
|
|
3391
|
-
if (object.type === types.AST_NODE_TYPES.JSXIdentifier) {
|
|
3392
|
-
context.sourceCode.markVariableAsUsed(object.name, node);
|
|
3393
|
-
}
|
|
3394
|
-
break;
|
|
3395
|
-
}
|
|
3396
|
-
}
|
|
3397
|
-
}
|
|
3398
|
-
};
|
|
3399
|
-
}
|
|
3400
3440
|
|
|
3401
3441
|
// src/plugin.ts
|
|
3402
3442
|
var plugin = {
|
|
@@ -3426,7 +3466,6 @@ var plugin = {
|
|
|
3426
3466
|
"no-create-ref": no_create_ref_default,
|
|
3427
3467
|
"no-default-props": no_default_props_default,
|
|
3428
3468
|
"no-direct-mutation-state": no_direct_mutation_state_default,
|
|
3429
|
-
"no-duplicate-jsx-props": no_duplicate_jsx_props_default,
|
|
3430
3469
|
"no-duplicate-key": no_duplicate_key_default,
|
|
3431
3470
|
"no-forward-ref": no_forward_ref_default,
|
|
3432
3471
|
"no-implicit-key": no_implicit_key_default,
|
|
@@ -3456,18 +3495,21 @@ var plugin = {
|
|
|
3456
3495
|
"prefer-read-only-props": prefer_read_only_props_default,
|
|
3457
3496
|
"prefer-shorthand-boolean": prefer_shorthand_boolean_default,
|
|
3458
3497
|
"prefer-shorthand-fragment": prefer_shorthand_fragment_default,
|
|
3459
|
-
|
|
3498
|
+
// Part: JSX only rules
|
|
3499
|
+
"jsx-no-duplicate-props": jsx_no_duplicate_props_default,
|
|
3500
|
+
"jsx-no-undef": jsx_no_undef_default,
|
|
3501
|
+
"jsx-uses-vars": jsx_uses_vars_default,
|
|
3460
3502
|
// Part: deprecated rules
|
|
3461
3503
|
/** @deprecated Use `no-useless-forward-ref` instead */
|
|
3462
3504
|
"ensure-forward-ref-using-ref": no_useless_forward_ref_default,
|
|
3463
|
-
/** @deprecated Use `no-duplicate-jsx-props` instead */
|
|
3464
|
-
"jsx-no-duplicate-props": no_duplicate_jsx_props_default,
|
|
3465
|
-
/** @deprecated Use `use-jsx-vars` instead */
|
|
3466
|
-
"jsx-uses-vars": use_jsx_vars_default,
|
|
3467
3505
|
/** @deprecated Use `no-complex-conditional-rendering` instead */
|
|
3468
3506
|
"no-complicated-conditional-rendering": no_complex_conditional_rendering_default,
|
|
3507
|
+
/** @deprecated Use `jsx-no-duplicate-props` instead */
|
|
3508
|
+
"no-duplicate-jsx-props": jsx_no_duplicate_props_default,
|
|
3469
3509
|
/** @deprecated Use `no-nested-component-definitions` instead */
|
|
3470
|
-
"no-nested-components": no_nested_component_definitions_default
|
|
3510
|
+
"no-nested-components": no_nested_component_definitions_default,
|
|
3511
|
+
/** @deprecated Use `jsx-uses-vars` instead */
|
|
3512
|
+
"use-jsx-vars": jsx_uses_vars_default
|
|
3471
3513
|
}
|
|
3472
3514
|
};
|
|
3473
3515
|
|