eslint-plugin-react-dom 1.27.1-next.4 → 1.27.1-next.6
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 +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +74 -34
- package/dist/index.mjs +74 -34
- package/package.json +7 -7
package/dist/index.d.mts
CHANGED
|
@@ -14,6 +14,7 @@ declare const _default: {
|
|
|
14
14
|
readonly "no-dangerously-set-innerhtml": _typescript_eslint_utils_ts_eslint.RuleModule<"noDangerouslySetInnerhtml", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
15
15
|
readonly "no-dangerously-set-innerhtml-with-children": _typescript_eslint_utils_ts_eslint.RuleModule<"noDangerouslySetInnerhtmlWithChildren", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
16
16
|
readonly "no-find-dom-node": _typescript_eslint_utils_ts_eslint.RuleModule<"noFindDomNode", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
17
|
+
readonly "no-flush-sync": _typescript_eslint_utils_ts_eslint.RuleModule<"noFlushSync", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
17
18
|
readonly "no-missing-button-type": _typescript_eslint_utils_ts_eslint.RuleModule<"noMissingButtonType", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
18
19
|
readonly "no-missing-iframe-sandbox": _typescript_eslint_utils_ts_eslint.RuleModule<"noMissingIframeSandbox", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
19
20
|
readonly "no-namespace": _typescript_eslint_utils_ts_eslint.RuleModule<"noNamespace", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
@@ -43,6 +44,7 @@ declare const _default: {
|
|
|
43
44
|
readonly "no-dangerously-set-innerhtml": _typescript_eslint_utils_ts_eslint.RuleModule<"noDangerouslySetInnerhtml", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
44
45
|
readonly "no-dangerously-set-innerhtml-with-children": _typescript_eslint_utils_ts_eslint.RuleModule<"noDangerouslySetInnerhtmlWithChildren", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
45
46
|
readonly "no-find-dom-node": _typescript_eslint_utils_ts_eslint.RuleModule<"noFindDomNode", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
47
|
+
readonly "no-flush-sync": _typescript_eslint_utils_ts_eslint.RuleModule<"noFlushSync", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
46
48
|
readonly "no-missing-button-type": _typescript_eslint_utils_ts_eslint.RuleModule<"noMissingButtonType", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
47
49
|
readonly "no-missing-iframe-sandbox": _typescript_eslint_utils_ts_eslint.RuleModule<"noMissingIframeSandbox", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
48
50
|
readonly "no-namespace": _typescript_eslint_utils_ts_eslint.RuleModule<"noNamespace", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ declare const _default: {
|
|
|
14
14
|
readonly "no-dangerously-set-innerhtml": _typescript_eslint_utils_ts_eslint.RuleModule<"noDangerouslySetInnerhtml", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
15
15
|
readonly "no-dangerously-set-innerhtml-with-children": _typescript_eslint_utils_ts_eslint.RuleModule<"noDangerouslySetInnerhtmlWithChildren", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
16
16
|
readonly "no-find-dom-node": _typescript_eslint_utils_ts_eslint.RuleModule<"noFindDomNode", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
17
|
+
readonly "no-flush-sync": _typescript_eslint_utils_ts_eslint.RuleModule<"noFlushSync", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
17
18
|
readonly "no-missing-button-type": _typescript_eslint_utils_ts_eslint.RuleModule<"noMissingButtonType", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
18
19
|
readonly "no-missing-iframe-sandbox": _typescript_eslint_utils_ts_eslint.RuleModule<"noMissingIframeSandbox", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
19
20
|
readonly "no-namespace": _typescript_eslint_utils_ts_eslint.RuleModule<"noNamespace", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
@@ -43,6 +44,7 @@ declare const _default: {
|
|
|
43
44
|
readonly "no-dangerously-set-innerhtml": _typescript_eslint_utils_ts_eslint.RuleModule<"noDangerouslySetInnerhtml", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
44
45
|
readonly "no-dangerously-set-innerhtml-with-children": _typescript_eslint_utils_ts_eslint.RuleModule<"noDangerouslySetInnerhtmlWithChildren", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
45
46
|
readonly "no-find-dom-node": _typescript_eslint_utils_ts_eslint.RuleModule<"noFindDomNode", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
47
|
+
readonly "no-flush-sync": _typescript_eslint_utils_ts_eslint.RuleModule<"noFlushSync", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
46
48
|
readonly "no-missing-button-type": _typescript_eslint_utils_ts_eslint.RuleModule<"noMissingButtonType", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
47
49
|
readonly "no-missing-iframe-sandbox": _typescript_eslint_utils_ts_eslint.RuleModule<"noMissingIframeSandbox", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
48
50
|
readonly "no-namespace": _typescript_eslint_utils_ts_eslint.RuleModule<"noNamespace", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
package/dist/index.js
CHANGED
|
@@ -62,7 +62,7 @@ var settings = {
|
|
|
62
62
|
|
|
63
63
|
// package.json
|
|
64
64
|
var name2 = "eslint-plugin-react-dom";
|
|
65
|
-
var version = "1.27.1-next.
|
|
65
|
+
var version = "1.27.1-next.6";
|
|
66
66
|
var createRule = shared.createRuleForPlugin("dom");
|
|
67
67
|
|
|
68
68
|
// src/utils/find-custom-component.ts
|
|
@@ -207,23 +207,62 @@ var no_find_dom_node_default = createRule({
|
|
|
207
207
|
},
|
|
208
208
|
defaultOptions: []
|
|
209
209
|
});
|
|
210
|
-
var RULE_NAME4 = "no-
|
|
210
|
+
var RULE_NAME4 = "no-flush-sync";
|
|
211
211
|
var RULE_FEATURES4 = [
|
|
212
212
|
"CHK"
|
|
213
213
|
];
|
|
214
|
+
var no_flush_sync_default = createRule({
|
|
215
|
+
meta: {
|
|
216
|
+
type: "problem",
|
|
217
|
+
docs: {
|
|
218
|
+
description: "warns against using `flushSync`",
|
|
219
|
+
[Symbol.for("rule_features")]: RULE_FEATURES4
|
|
220
|
+
},
|
|
221
|
+
messages: {
|
|
222
|
+
noFlushSync: "Using 'flushSync' is uncommon and can hurt the performance of your app."
|
|
223
|
+
},
|
|
224
|
+
schema: []
|
|
225
|
+
},
|
|
226
|
+
name: RULE_NAME4,
|
|
227
|
+
create(context) {
|
|
228
|
+
if (!context.sourceCode.text.includes("flushSync")) return {};
|
|
229
|
+
return {
|
|
230
|
+
CallExpression(node) {
|
|
231
|
+
const { callee } = node;
|
|
232
|
+
switch (callee.type) {
|
|
233
|
+
case types.AST_NODE_TYPES.Identifier:
|
|
234
|
+
if (callee.name === "flushSync") {
|
|
235
|
+
context.report({ messageId: "noFlushSync", node });
|
|
236
|
+
}
|
|
237
|
+
return;
|
|
238
|
+
case types.AST_NODE_TYPES.MemberExpression:
|
|
239
|
+
if (callee.property.type === types.AST_NODE_TYPES.Identifier && callee.property.name === "flushSync") {
|
|
240
|
+
context.report({ messageId: "noFlushSync", node });
|
|
241
|
+
}
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
},
|
|
247
|
+
defaultOptions: []
|
|
248
|
+
});
|
|
249
|
+
var RULE_NAME5 = "no-missing-button-type";
|
|
250
|
+
var RULE_FEATURES5 = [
|
|
251
|
+
"CHK"
|
|
252
|
+
];
|
|
214
253
|
var no_missing_button_type_default = createRule({
|
|
215
254
|
meta: {
|
|
216
255
|
type: "problem",
|
|
217
256
|
docs: {
|
|
218
257
|
description: "enforce that button component have an explicit 'type' attribute",
|
|
219
|
-
[Symbol.for("rule_features")]:
|
|
258
|
+
[Symbol.for("rule_features")]: RULE_FEATURES5
|
|
220
259
|
},
|
|
221
260
|
messages: {
|
|
222
261
|
noMissingButtonType: "Add missing 'type' attribute on 'button' component."
|
|
223
262
|
},
|
|
224
263
|
schema: []
|
|
225
264
|
},
|
|
226
|
-
name:
|
|
265
|
+
name: RULE_NAME5,
|
|
227
266
|
create(context) {
|
|
228
267
|
const settings2 = shared.getSettingsFromContext(context);
|
|
229
268
|
const polymorphicPropName = settings2.polymorphicPropName;
|
|
@@ -268,8 +307,8 @@ var no_missing_button_type_default = createRule({
|
|
|
268
307
|
},
|
|
269
308
|
defaultOptions: []
|
|
270
309
|
});
|
|
271
|
-
var
|
|
272
|
-
var
|
|
310
|
+
var RULE_NAME6 = "no-missing-iframe-sandbox";
|
|
311
|
+
var RULE_FEATURES6 = [
|
|
273
312
|
"CHK"
|
|
274
313
|
];
|
|
275
314
|
var validTypes = [
|
|
@@ -298,14 +337,14 @@ var no_missing_iframe_sandbox_default = createRule({
|
|
|
298
337
|
type: "problem",
|
|
299
338
|
docs: {
|
|
300
339
|
description: "enforce that 'iframe' component have an explicit 'sandbox' attribute",
|
|
301
|
-
[Symbol.for("rule_features")]:
|
|
340
|
+
[Symbol.for("rule_features")]: RULE_FEATURES6
|
|
302
341
|
},
|
|
303
342
|
messages: {
|
|
304
343
|
noMissingIframeSandbox: "Add missing 'sandbox' attribute on 'iframe' component."
|
|
305
344
|
},
|
|
306
345
|
schema: []
|
|
307
346
|
},
|
|
308
|
-
name:
|
|
347
|
+
name: RULE_NAME6,
|
|
309
348
|
create(context) {
|
|
310
349
|
const settings2 = shared.getSettingsFromContext(context);
|
|
311
350
|
const polymorphicPropName = settings2.polymorphicPropName;
|
|
@@ -349,8 +388,8 @@ var no_missing_iframe_sandbox_default = createRule({
|
|
|
349
388
|
},
|
|
350
389
|
defaultOptions: []
|
|
351
390
|
});
|
|
352
|
-
var
|
|
353
|
-
var
|
|
391
|
+
var RULE_NAME7 = "no-namespace";
|
|
392
|
+
var RULE_FEATURES7 = [
|
|
354
393
|
"CHK"
|
|
355
394
|
];
|
|
356
395
|
var no_namespace_default = createRule({
|
|
@@ -358,14 +397,14 @@ var no_namespace_default = createRule({
|
|
|
358
397
|
type: "problem",
|
|
359
398
|
docs: {
|
|
360
399
|
description: "enforce that namespaces are not used in React elements",
|
|
361
|
-
[Symbol.for("rule_features")]:
|
|
400
|
+
[Symbol.for("rule_features")]: RULE_FEATURES7
|
|
362
401
|
},
|
|
363
402
|
messages: {
|
|
364
403
|
noNamespace: "A React component '{{name}}' must not be in a namespace, as React does not support them."
|
|
365
404
|
},
|
|
366
405
|
schema: []
|
|
367
406
|
},
|
|
368
|
-
name:
|
|
407
|
+
name: RULE_NAME7,
|
|
369
408
|
create(context) {
|
|
370
409
|
return {
|
|
371
410
|
JSXElement(node) {
|
|
@@ -385,8 +424,8 @@ var no_namespace_default = createRule({
|
|
|
385
424
|
},
|
|
386
425
|
defaultOptions: []
|
|
387
426
|
});
|
|
388
|
-
var
|
|
389
|
-
var
|
|
427
|
+
var RULE_NAME8 = "no-render-return-value";
|
|
428
|
+
var RULE_FEATURES8 = [
|
|
390
429
|
"CHK"
|
|
391
430
|
];
|
|
392
431
|
var banParentTypes = [
|
|
@@ -401,14 +440,14 @@ var no_render_return_value_default = createRule({
|
|
|
401
440
|
type: "problem",
|
|
402
441
|
docs: {
|
|
403
442
|
description: "disallow usage of the return value of 'ReactDOM.render'",
|
|
404
|
-
[Symbol.for("rule_features")]:
|
|
443
|
+
[Symbol.for("rule_features")]: RULE_FEATURES8
|
|
405
444
|
},
|
|
406
445
|
messages: {
|
|
407
446
|
noRenderReturnValue: "Do not depend on the return value from '{{objectName}}.render'."
|
|
408
447
|
},
|
|
409
448
|
schema: []
|
|
410
449
|
},
|
|
411
|
-
name:
|
|
450
|
+
name: RULE_NAME8,
|
|
412
451
|
create(context) {
|
|
413
452
|
return {
|
|
414
453
|
CallExpression(node) {
|
|
@@ -438,8 +477,8 @@ var no_render_return_value_default = createRule({
|
|
|
438
477
|
},
|
|
439
478
|
defaultOptions: []
|
|
440
479
|
});
|
|
441
|
-
var
|
|
442
|
-
var
|
|
480
|
+
var RULE_NAME9 = "no-script-url";
|
|
481
|
+
var RULE_FEATURES9 = [
|
|
443
482
|
"CHK"
|
|
444
483
|
];
|
|
445
484
|
var no_script_url_default = createRule({
|
|
@@ -447,14 +486,14 @@ var no_script_url_default = createRule({
|
|
|
447
486
|
type: "problem",
|
|
448
487
|
docs: {
|
|
449
488
|
description: "disallow 'javascript:' URLs as JSX event handler prop's value",
|
|
450
|
-
[Symbol.for("rule_features")]:
|
|
489
|
+
[Symbol.for("rule_features")]: RULE_FEATURES9
|
|
451
490
|
},
|
|
452
491
|
messages: {
|
|
453
492
|
noScriptUrl: "Using a `javascript:` URL is a security risk and should be avoided."
|
|
454
493
|
},
|
|
455
494
|
schema: []
|
|
456
495
|
},
|
|
457
|
-
name:
|
|
496
|
+
name: RULE_NAME9,
|
|
458
497
|
create(context) {
|
|
459
498
|
return {
|
|
460
499
|
JSXAttribute(node) {
|
|
@@ -476,7 +515,7 @@ var no_script_url_default = createRule({
|
|
|
476
515
|
},
|
|
477
516
|
defaultOptions: []
|
|
478
517
|
});
|
|
479
|
-
var
|
|
518
|
+
var RULE_NAME10 = "no-unknown-property";
|
|
480
519
|
var DEFAULTS = {
|
|
481
520
|
ignore: [],
|
|
482
521
|
requireDataLowercase: false
|
|
@@ -1438,7 +1477,7 @@ var no_unknown_property_default = createRule({
|
|
|
1438
1477
|
}
|
|
1439
1478
|
}]
|
|
1440
1479
|
},
|
|
1441
|
-
name:
|
|
1480
|
+
name: RULE_NAME10,
|
|
1442
1481
|
create(context) {
|
|
1443
1482
|
function getIgnoreConfig() {
|
|
1444
1483
|
return context.options[0]?.ignore || DEFAULTS.ignore;
|
|
@@ -1533,8 +1572,8 @@ function testReactVersion(context, comparator, version2) {
|
|
|
1533
1572
|
const { version: localVersion } = shared.getSettingsFromContext(context);
|
|
1534
1573
|
return compareVersions.compare(localVersion, version2, comparator);
|
|
1535
1574
|
}
|
|
1536
|
-
var
|
|
1537
|
-
var
|
|
1575
|
+
var RULE_NAME11 = "no-unsafe-iframe-sandbox";
|
|
1576
|
+
var RULE_FEATURES10 = [
|
|
1538
1577
|
"CHK"
|
|
1539
1578
|
];
|
|
1540
1579
|
var unsafeSandboxValues = [
|
|
@@ -1551,14 +1590,14 @@ var no_unsafe_iframe_sandbox_default = createRule({
|
|
|
1551
1590
|
type: "problem",
|
|
1552
1591
|
docs: {
|
|
1553
1592
|
description: "disallow unsafe iframe 'sandbox' attribute combinations",
|
|
1554
|
-
[Symbol.for("rule_features")]:
|
|
1593
|
+
[Symbol.for("rule_features")]: RULE_FEATURES10
|
|
1555
1594
|
},
|
|
1556
1595
|
messages: {
|
|
1557
1596
|
noUnsafeIframeSandbox: "Unsafe 'sandbox' attribute value on 'iframe' component."
|
|
1558
1597
|
},
|
|
1559
1598
|
schema: []
|
|
1560
1599
|
},
|
|
1561
|
-
name:
|
|
1600
|
+
name: RULE_NAME11,
|
|
1562
1601
|
create(context) {
|
|
1563
1602
|
const settings2 = shared.getSettingsFromContext(context);
|
|
1564
1603
|
const polymorphicPropName = settings2.polymorphicPropName;
|
|
@@ -1604,8 +1643,8 @@ var no_unsafe_iframe_sandbox_default = createRule({
|
|
|
1604
1643
|
},
|
|
1605
1644
|
defaultOptions: []
|
|
1606
1645
|
});
|
|
1607
|
-
var
|
|
1608
|
-
var
|
|
1646
|
+
var RULE_NAME12 = "no-unsafe-target-blank";
|
|
1647
|
+
var RULE_FEATURES11 = [
|
|
1609
1648
|
"CHK"
|
|
1610
1649
|
];
|
|
1611
1650
|
function isExternalLinkLike(value) {
|
|
@@ -1621,14 +1660,14 @@ var no_unsafe_target_blank_default = createRule({
|
|
|
1621
1660
|
type: "problem",
|
|
1622
1661
|
docs: {
|
|
1623
1662
|
description: `disallow 'target="_blank"' on an external link without 'rel="noreferrer noopener"'`,
|
|
1624
|
-
[Symbol.for("rule_features")]:
|
|
1663
|
+
[Symbol.for("rule_features")]: RULE_FEATURES11
|
|
1625
1664
|
},
|
|
1626
1665
|
messages: {
|
|
1627
1666
|
noUnsafeTargetBlank: `Using 'target="_blank"' on an external link without 'rel="noreferrer noopener"' is a security risk.`
|
|
1628
1667
|
},
|
|
1629
1668
|
schema: []
|
|
1630
1669
|
},
|
|
1631
|
-
name:
|
|
1670
|
+
name: RULE_NAME12,
|
|
1632
1671
|
create(context) {
|
|
1633
1672
|
const settings2 = shared.getSettingsFromContext(context);
|
|
1634
1673
|
const polymorphicPropName = settings2.polymorphicPropName;
|
|
@@ -1678,8 +1717,8 @@ var no_unsafe_target_blank_default = createRule({
|
|
|
1678
1717
|
},
|
|
1679
1718
|
defaultOptions: []
|
|
1680
1719
|
});
|
|
1681
|
-
var
|
|
1682
|
-
var
|
|
1720
|
+
var RULE_NAME13 = "no-void-elements-with-children";
|
|
1721
|
+
var RULE_FEATURES12 = [
|
|
1683
1722
|
"CHK"
|
|
1684
1723
|
];
|
|
1685
1724
|
var voidElements = /* @__PURE__ */ new Set([
|
|
@@ -1705,14 +1744,14 @@ var no_void_elements_with_children_default = createRule({
|
|
|
1705
1744
|
type: "problem",
|
|
1706
1745
|
docs: {
|
|
1707
1746
|
description: "disallow void elements (AKA self-closing elements) from having children",
|
|
1708
|
-
[Symbol.for("rule_features")]:
|
|
1747
|
+
[Symbol.for("rule_features")]: RULE_FEATURES12
|
|
1709
1748
|
},
|
|
1710
1749
|
messages: {
|
|
1711
1750
|
noVoidElementsWithChildren: "'{{element}}' is a void element tag and must not have children."
|
|
1712
1751
|
},
|
|
1713
1752
|
schema: []
|
|
1714
1753
|
},
|
|
1715
|
-
name:
|
|
1754
|
+
name: RULE_NAME13,
|
|
1716
1755
|
create(context) {
|
|
1717
1756
|
return {
|
|
1718
1757
|
JSXElement(node) {
|
|
@@ -1757,6 +1796,7 @@ var plugin = {
|
|
|
1757
1796
|
"no-dangerously-set-innerhtml": no_dangerously_set_innerhtml_default,
|
|
1758
1797
|
"no-dangerously-set-innerhtml-with-children": no_dangerously_set_innerhtml_with_children_default,
|
|
1759
1798
|
"no-find-dom-node": no_find_dom_node_default,
|
|
1799
|
+
"no-flush-sync": no_flush_sync_default,
|
|
1760
1800
|
"no-missing-button-type": no_missing_button_type_default,
|
|
1761
1801
|
"no-missing-iframe-sandbox": no_missing_iframe_sandbox_default,
|
|
1762
1802
|
"no-namespace": no_namespace_default,
|
package/dist/index.mjs
CHANGED
|
@@ -39,7 +39,7 @@ var settings = {
|
|
|
39
39
|
|
|
40
40
|
// package.json
|
|
41
41
|
var name2 = "eslint-plugin-react-dom";
|
|
42
|
-
var version = "1.27.1-next.
|
|
42
|
+
var version = "1.27.1-next.6";
|
|
43
43
|
var createRule = createRuleForPlugin("dom");
|
|
44
44
|
|
|
45
45
|
// src/utils/find-custom-component.ts
|
|
@@ -184,23 +184,62 @@ var no_find_dom_node_default = createRule({
|
|
|
184
184
|
},
|
|
185
185
|
defaultOptions: []
|
|
186
186
|
});
|
|
187
|
-
var RULE_NAME4 = "no-
|
|
187
|
+
var RULE_NAME4 = "no-flush-sync";
|
|
188
188
|
var RULE_FEATURES4 = [
|
|
189
189
|
"CHK"
|
|
190
190
|
];
|
|
191
|
+
var no_flush_sync_default = createRule({
|
|
192
|
+
meta: {
|
|
193
|
+
type: "problem",
|
|
194
|
+
docs: {
|
|
195
|
+
description: "warns against using `flushSync`",
|
|
196
|
+
[Symbol.for("rule_features")]: RULE_FEATURES4
|
|
197
|
+
},
|
|
198
|
+
messages: {
|
|
199
|
+
noFlushSync: "Using 'flushSync' is uncommon and can hurt the performance of your app."
|
|
200
|
+
},
|
|
201
|
+
schema: []
|
|
202
|
+
},
|
|
203
|
+
name: RULE_NAME4,
|
|
204
|
+
create(context) {
|
|
205
|
+
if (!context.sourceCode.text.includes("flushSync")) return {};
|
|
206
|
+
return {
|
|
207
|
+
CallExpression(node) {
|
|
208
|
+
const { callee } = node;
|
|
209
|
+
switch (callee.type) {
|
|
210
|
+
case AST_NODE_TYPES.Identifier:
|
|
211
|
+
if (callee.name === "flushSync") {
|
|
212
|
+
context.report({ messageId: "noFlushSync", node });
|
|
213
|
+
}
|
|
214
|
+
return;
|
|
215
|
+
case AST_NODE_TYPES.MemberExpression:
|
|
216
|
+
if (callee.property.type === AST_NODE_TYPES.Identifier && callee.property.name === "flushSync") {
|
|
217
|
+
context.report({ messageId: "noFlushSync", node });
|
|
218
|
+
}
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
},
|
|
224
|
+
defaultOptions: []
|
|
225
|
+
});
|
|
226
|
+
var RULE_NAME5 = "no-missing-button-type";
|
|
227
|
+
var RULE_FEATURES5 = [
|
|
228
|
+
"CHK"
|
|
229
|
+
];
|
|
191
230
|
var no_missing_button_type_default = createRule({
|
|
192
231
|
meta: {
|
|
193
232
|
type: "problem",
|
|
194
233
|
docs: {
|
|
195
234
|
description: "enforce that button component have an explicit 'type' attribute",
|
|
196
|
-
[Symbol.for("rule_features")]:
|
|
235
|
+
[Symbol.for("rule_features")]: RULE_FEATURES5
|
|
197
236
|
},
|
|
198
237
|
messages: {
|
|
199
238
|
noMissingButtonType: "Add missing 'type' attribute on 'button' component."
|
|
200
239
|
},
|
|
201
240
|
schema: []
|
|
202
241
|
},
|
|
203
|
-
name:
|
|
242
|
+
name: RULE_NAME5,
|
|
204
243
|
create(context) {
|
|
205
244
|
const settings2 = getSettingsFromContext(context);
|
|
206
245
|
const polymorphicPropName = settings2.polymorphicPropName;
|
|
@@ -245,8 +284,8 @@ var no_missing_button_type_default = createRule({
|
|
|
245
284
|
},
|
|
246
285
|
defaultOptions: []
|
|
247
286
|
});
|
|
248
|
-
var
|
|
249
|
-
var
|
|
287
|
+
var RULE_NAME6 = "no-missing-iframe-sandbox";
|
|
288
|
+
var RULE_FEATURES6 = [
|
|
250
289
|
"CHK"
|
|
251
290
|
];
|
|
252
291
|
var validTypes = [
|
|
@@ -275,14 +314,14 @@ var no_missing_iframe_sandbox_default = createRule({
|
|
|
275
314
|
type: "problem",
|
|
276
315
|
docs: {
|
|
277
316
|
description: "enforce that 'iframe' component have an explicit 'sandbox' attribute",
|
|
278
|
-
[Symbol.for("rule_features")]:
|
|
317
|
+
[Symbol.for("rule_features")]: RULE_FEATURES6
|
|
279
318
|
},
|
|
280
319
|
messages: {
|
|
281
320
|
noMissingIframeSandbox: "Add missing 'sandbox' attribute on 'iframe' component."
|
|
282
321
|
},
|
|
283
322
|
schema: []
|
|
284
323
|
},
|
|
285
|
-
name:
|
|
324
|
+
name: RULE_NAME6,
|
|
286
325
|
create(context) {
|
|
287
326
|
const settings2 = getSettingsFromContext(context);
|
|
288
327
|
const polymorphicPropName = settings2.polymorphicPropName;
|
|
@@ -326,8 +365,8 @@ var no_missing_iframe_sandbox_default = createRule({
|
|
|
326
365
|
},
|
|
327
366
|
defaultOptions: []
|
|
328
367
|
});
|
|
329
|
-
var
|
|
330
|
-
var
|
|
368
|
+
var RULE_NAME7 = "no-namespace";
|
|
369
|
+
var RULE_FEATURES7 = [
|
|
331
370
|
"CHK"
|
|
332
371
|
];
|
|
333
372
|
var no_namespace_default = createRule({
|
|
@@ -335,14 +374,14 @@ var no_namespace_default = createRule({
|
|
|
335
374
|
type: "problem",
|
|
336
375
|
docs: {
|
|
337
376
|
description: "enforce that namespaces are not used in React elements",
|
|
338
|
-
[Symbol.for("rule_features")]:
|
|
377
|
+
[Symbol.for("rule_features")]: RULE_FEATURES7
|
|
339
378
|
},
|
|
340
379
|
messages: {
|
|
341
380
|
noNamespace: "A React component '{{name}}' must not be in a namespace, as React does not support them."
|
|
342
381
|
},
|
|
343
382
|
schema: []
|
|
344
383
|
},
|
|
345
|
-
name:
|
|
384
|
+
name: RULE_NAME7,
|
|
346
385
|
create(context) {
|
|
347
386
|
return {
|
|
348
387
|
JSXElement(node) {
|
|
@@ -362,8 +401,8 @@ var no_namespace_default = createRule({
|
|
|
362
401
|
},
|
|
363
402
|
defaultOptions: []
|
|
364
403
|
});
|
|
365
|
-
var
|
|
366
|
-
var
|
|
404
|
+
var RULE_NAME8 = "no-render-return-value";
|
|
405
|
+
var RULE_FEATURES8 = [
|
|
367
406
|
"CHK"
|
|
368
407
|
];
|
|
369
408
|
var banParentTypes = [
|
|
@@ -378,14 +417,14 @@ var no_render_return_value_default = createRule({
|
|
|
378
417
|
type: "problem",
|
|
379
418
|
docs: {
|
|
380
419
|
description: "disallow usage of the return value of 'ReactDOM.render'",
|
|
381
|
-
[Symbol.for("rule_features")]:
|
|
420
|
+
[Symbol.for("rule_features")]: RULE_FEATURES8
|
|
382
421
|
},
|
|
383
422
|
messages: {
|
|
384
423
|
noRenderReturnValue: "Do not depend on the return value from '{{objectName}}.render'."
|
|
385
424
|
},
|
|
386
425
|
schema: []
|
|
387
426
|
},
|
|
388
|
-
name:
|
|
427
|
+
name: RULE_NAME8,
|
|
389
428
|
create(context) {
|
|
390
429
|
return {
|
|
391
430
|
CallExpression(node) {
|
|
@@ -415,8 +454,8 @@ var no_render_return_value_default = createRule({
|
|
|
415
454
|
},
|
|
416
455
|
defaultOptions: []
|
|
417
456
|
});
|
|
418
|
-
var
|
|
419
|
-
var
|
|
457
|
+
var RULE_NAME9 = "no-script-url";
|
|
458
|
+
var RULE_FEATURES9 = [
|
|
420
459
|
"CHK"
|
|
421
460
|
];
|
|
422
461
|
var no_script_url_default = createRule({
|
|
@@ -424,14 +463,14 @@ var no_script_url_default = createRule({
|
|
|
424
463
|
type: "problem",
|
|
425
464
|
docs: {
|
|
426
465
|
description: "disallow 'javascript:' URLs as JSX event handler prop's value",
|
|
427
|
-
[Symbol.for("rule_features")]:
|
|
466
|
+
[Symbol.for("rule_features")]: RULE_FEATURES9
|
|
428
467
|
},
|
|
429
468
|
messages: {
|
|
430
469
|
noScriptUrl: "Using a `javascript:` URL is a security risk and should be avoided."
|
|
431
470
|
},
|
|
432
471
|
schema: []
|
|
433
472
|
},
|
|
434
|
-
name:
|
|
473
|
+
name: RULE_NAME9,
|
|
435
474
|
create(context) {
|
|
436
475
|
return {
|
|
437
476
|
JSXAttribute(node) {
|
|
@@ -453,7 +492,7 @@ var no_script_url_default = createRule({
|
|
|
453
492
|
},
|
|
454
493
|
defaultOptions: []
|
|
455
494
|
});
|
|
456
|
-
var
|
|
495
|
+
var RULE_NAME10 = "no-unknown-property";
|
|
457
496
|
var DEFAULTS = {
|
|
458
497
|
ignore: [],
|
|
459
498
|
requireDataLowercase: false
|
|
@@ -1415,7 +1454,7 @@ var no_unknown_property_default = createRule({
|
|
|
1415
1454
|
}
|
|
1416
1455
|
}]
|
|
1417
1456
|
},
|
|
1418
|
-
name:
|
|
1457
|
+
name: RULE_NAME10,
|
|
1419
1458
|
create(context) {
|
|
1420
1459
|
function getIgnoreConfig() {
|
|
1421
1460
|
return context.options[0]?.ignore || DEFAULTS.ignore;
|
|
@@ -1510,8 +1549,8 @@ function testReactVersion(context, comparator, version2) {
|
|
|
1510
1549
|
const { version: localVersion } = getSettingsFromContext(context);
|
|
1511
1550
|
return compare(localVersion, version2, comparator);
|
|
1512
1551
|
}
|
|
1513
|
-
var
|
|
1514
|
-
var
|
|
1552
|
+
var RULE_NAME11 = "no-unsafe-iframe-sandbox";
|
|
1553
|
+
var RULE_FEATURES10 = [
|
|
1515
1554
|
"CHK"
|
|
1516
1555
|
];
|
|
1517
1556
|
var unsafeSandboxValues = [
|
|
@@ -1528,14 +1567,14 @@ var no_unsafe_iframe_sandbox_default = createRule({
|
|
|
1528
1567
|
type: "problem",
|
|
1529
1568
|
docs: {
|
|
1530
1569
|
description: "disallow unsafe iframe 'sandbox' attribute combinations",
|
|
1531
|
-
[Symbol.for("rule_features")]:
|
|
1570
|
+
[Symbol.for("rule_features")]: RULE_FEATURES10
|
|
1532
1571
|
},
|
|
1533
1572
|
messages: {
|
|
1534
1573
|
noUnsafeIframeSandbox: "Unsafe 'sandbox' attribute value on 'iframe' component."
|
|
1535
1574
|
},
|
|
1536
1575
|
schema: []
|
|
1537
1576
|
},
|
|
1538
|
-
name:
|
|
1577
|
+
name: RULE_NAME11,
|
|
1539
1578
|
create(context) {
|
|
1540
1579
|
const settings2 = getSettingsFromContext(context);
|
|
1541
1580
|
const polymorphicPropName = settings2.polymorphicPropName;
|
|
@@ -1581,8 +1620,8 @@ var no_unsafe_iframe_sandbox_default = createRule({
|
|
|
1581
1620
|
},
|
|
1582
1621
|
defaultOptions: []
|
|
1583
1622
|
});
|
|
1584
|
-
var
|
|
1585
|
-
var
|
|
1623
|
+
var RULE_NAME12 = "no-unsafe-target-blank";
|
|
1624
|
+
var RULE_FEATURES11 = [
|
|
1586
1625
|
"CHK"
|
|
1587
1626
|
];
|
|
1588
1627
|
function isExternalLinkLike(value) {
|
|
@@ -1598,14 +1637,14 @@ var no_unsafe_target_blank_default = createRule({
|
|
|
1598
1637
|
type: "problem",
|
|
1599
1638
|
docs: {
|
|
1600
1639
|
description: `disallow 'target="_blank"' on an external link without 'rel="noreferrer noopener"'`,
|
|
1601
|
-
[Symbol.for("rule_features")]:
|
|
1640
|
+
[Symbol.for("rule_features")]: RULE_FEATURES11
|
|
1602
1641
|
},
|
|
1603
1642
|
messages: {
|
|
1604
1643
|
noUnsafeTargetBlank: `Using 'target="_blank"' on an external link without 'rel="noreferrer noopener"' is a security risk.`
|
|
1605
1644
|
},
|
|
1606
1645
|
schema: []
|
|
1607
1646
|
},
|
|
1608
|
-
name:
|
|
1647
|
+
name: RULE_NAME12,
|
|
1609
1648
|
create(context) {
|
|
1610
1649
|
const settings2 = getSettingsFromContext(context);
|
|
1611
1650
|
const polymorphicPropName = settings2.polymorphicPropName;
|
|
@@ -1655,8 +1694,8 @@ var no_unsafe_target_blank_default = createRule({
|
|
|
1655
1694
|
},
|
|
1656
1695
|
defaultOptions: []
|
|
1657
1696
|
});
|
|
1658
|
-
var
|
|
1659
|
-
var
|
|
1697
|
+
var RULE_NAME13 = "no-void-elements-with-children";
|
|
1698
|
+
var RULE_FEATURES12 = [
|
|
1660
1699
|
"CHK"
|
|
1661
1700
|
];
|
|
1662
1701
|
var voidElements = /* @__PURE__ */ new Set([
|
|
@@ -1682,14 +1721,14 @@ var no_void_elements_with_children_default = createRule({
|
|
|
1682
1721
|
type: "problem",
|
|
1683
1722
|
docs: {
|
|
1684
1723
|
description: "disallow void elements (AKA self-closing elements) from having children",
|
|
1685
|
-
[Symbol.for("rule_features")]:
|
|
1724
|
+
[Symbol.for("rule_features")]: RULE_FEATURES12
|
|
1686
1725
|
},
|
|
1687
1726
|
messages: {
|
|
1688
1727
|
noVoidElementsWithChildren: "'{{element}}' is a void element tag and must not have children."
|
|
1689
1728
|
},
|
|
1690
1729
|
schema: []
|
|
1691
1730
|
},
|
|
1692
|
-
name:
|
|
1731
|
+
name: RULE_NAME13,
|
|
1693
1732
|
create(context) {
|
|
1694
1733
|
return {
|
|
1695
1734
|
JSXElement(node) {
|
|
@@ -1734,6 +1773,7 @@ var plugin = {
|
|
|
1734
1773
|
"no-dangerously-set-innerhtml": no_dangerously_set_innerhtml_default,
|
|
1735
1774
|
"no-dangerously-set-innerhtml-with-children": no_dangerously_set_innerhtml_with_children_default,
|
|
1736
1775
|
"no-find-dom-node": no_find_dom_node_default,
|
|
1776
|
+
"no-flush-sync": no_flush_sync_default,
|
|
1737
1777
|
"no-missing-button-type": no_missing_button_type_default,
|
|
1738
1778
|
"no-missing-iframe-sandbox": no_missing_iframe_sandbox_default,
|
|
1739
1779
|
"no-namespace": no_namespace_default,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-dom",
|
|
3
|
-
"version": "1.27.1-next.
|
|
3
|
+
"version": "1.27.1-next.6",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for React DOM related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
"compare-versions": "^6.1.1",
|
|
50
50
|
"string-ts": "^2.2.1",
|
|
51
51
|
"ts-pattern": "^5.6.2",
|
|
52
|
-
"@eslint-react/core": "1.27.1-next.
|
|
53
|
-
"@eslint-react/
|
|
54
|
-
"@eslint-react/
|
|
55
|
-
"@eslint-react/
|
|
56
|
-
"@eslint-react/shared": "1.27.1-next.
|
|
57
|
-
"@eslint-react/
|
|
52
|
+
"@eslint-react/core": "1.27.1-next.6",
|
|
53
|
+
"@eslint-react/ast": "1.27.1-next.6",
|
|
54
|
+
"@eslint-react/eff": "1.27.1-next.6",
|
|
55
|
+
"@eslint-react/jsx": "1.27.1-next.6",
|
|
56
|
+
"@eslint-react/shared": "1.27.1-next.6",
|
|
57
|
+
"@eslint-react/var": "1.27.1-next.6"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@types/react": "^19.0.10",
|