eslint-plugin-react-dom 1.34.2-beta.2 → 1.34.2-beta.3
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 +127 -48
- package/dist/index.mjs +127 -48
- package/package.json +7 -7
package/dist/index.d.mts
CHANGED
|
@@ -15,6 +15,7 @@ declare const _default: {
|
|
|
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
17
|
readonly "no-flush-sync": _typescript_eslint_utils_ts_eslint.RuleModule<"noFlushSync", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
18
|
+
readonly "no-hydrate": _typescript_eslint_utils_ts_eslint.RuleModule<"noHydrate", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
18
19
|
readonly "no-missing-button-type": _typescript_eslint_utils_ts_eslint.RuleModule<"noMissingButtonType", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
19
20
|
readonly "no-missing-iframe-sandbox": _typescript_eslint_utils_ts_eslint.RuleModule<"noMissingIframeSandbox", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
20
21
|
readonly "no-namespace": _typescript_eslint_utils_ts_eslint.RuleModule<"noNamespace", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
@@ -47,6 +48,7 @@ declare const _default: {
|
|
|
47
48
|
readonly "no-dangerously-set-innerhtml-with-children": _typescript_eslint_utils_ts_eslint.RuleModule<"noDangerouslySetInnerhtmlWithChildren", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
48
49
|
readonly "no-find-dom-node": _typescript_eslint_utils_ts_eslint.RuleModule<"noFindDomNode", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
49
50
|
readonly "no-flush-sync": _typescript_eslint_utils_ts_eslint.RuleModule<"noFlushSync", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
51
|
+
readonly "no-hydrate": _typescript_eslint_utils_ts_eslint.RuleModule<"noHydrate", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
50
52
|
readonly "no-missing-button-type": _typescript_eslint_utils_ts_eslint.RuleModule<"noMissingButtonType", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
51
53
|
readonly "no-missing-iframe-sandbox": _typescript_eslint_utils_ts_eslint.RuleModule<"noMissingIframeSandbox", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
52
54
|
readonly "no-namespace": _typescript_eslint_utils_ts_eslint.RuleModule<"noNamespace", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ declare const _default: {
|
|
|
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
17
|
readonly "no-flush-sync": _typescript_eslint_utils_ts_eslint.RuleModule<"noFlushSync", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
18
|
+
readonly "no-hydrate": _typescript_eslint_utils_ts_eslint.RuleModule<"noHydrate", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
18
19
|
readonly "no-missing-button-type": _typescript_eslint_utils_ts_eslint.RuleModule<"noMissingButtonType", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
19
20
|
readonly "no-missing-iframe-sandbox": _typescript_eslint_utils_ts_eslint.RuleModule<"noMissingIframeSandbox", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
20
21
|
readonly "no-namespace": _typescript_eslint_utils_ts_eslint.RuleModule<"noNamespace", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
@@ -47,6 +48,7 @@ declare const _default: {
|
|
|
47
48
|
readonly "no-dangerously-set-innerhtml-with-children": _typescript_eslint_utils_ts_eslint.RuleModule<"noDangerouslySetInnerhtmlWithChildren", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
48
49
|
readonly "no-find-dom-node": _typescript_eslint_utils_ts_eslint.RuleModule<"noFindDomNode", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
49
50
|
readonly "no-flush-sync": _typescript_eslint_utils_ts_eslint.RuleModule<"noFlushSync", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
51
|
+
readonly "no-hydrate": _typescript_eslint_utils_ts_eslint.RuleModule<"noHydrate", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
50
52
|
readonly "no-missing-button-type": _typescript_eslint_utils_ts_eslint.RuleModule<"noMissingButtonType", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
51
53
|
readonly "no-missing-iframe-sandbox": _typescript_eslint_utils_ts_eslint.RuleModule<"noMissingIframeSandbox", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
52
54
|
readonly "no-namespace": _typescript_eslint_utils_ts_eslint.RuleModule<"noNamespace", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
package/dist/index.js
CHANGED
|
@@ -47,6 +47,7 @@ var rules = {
|
|
|
47
47
|
"react-dom/no-dangerously-set-innerhtml-with-children": "error",
|
|
48
48
|
"react-dom/no-find-dom-node": "error",
|
|
49
49
|
"react-dom/no-flush-sync": "error",
|
|
50
|
+
"react-dom/no-hydrate": "error",
|
|
50
51
|
"react-dom/no-missing-button-type": "warn",
|
|
51
52
|
"react-dom/no-missing-iframe-sandbox": "warn",
|
|
52
53
|
"react-dom/no-namespace": "error",
|
|
@@ -65,7 +66,7 @@ var settings = {
|
|
|
65
66
|
|
|
66
67
|
// package.json
|
|
67
68
|
var name2 = "eslint-plugin-react-dom";
|
|
68
|
-
var version = "1.34.2-beta.
|
|
69
|
+
var version = "1.34.2-beta.3";
|
|
69
70
|
var createRule = shared.createRuleForPlugin("dom");
|
|
70
71
|
|
|
71
72
|
// src/utils/find-custom-component.ts
|
|
@@ -253,8 +254,85 @@ function create4(context) {
|
|
|
253
254
|
}
|
|
254
255
|
};
|
|
255
256
|
}
|
|
256
|
-
var RULE_NAME5 = "no-
|
|
257
|
+
var RULE_NAME5 = "no-hydrate";
|
|
257
258
|
var RULE_FEATURES5 = [
|
|
259
|
+
"CHK",
|
|
260
|
+
"MOD"
|
|
261
|
+
];
|
|
262
|
+
var no_hydrate_default = createRule({
|
|
263
|
+
meta: {
|
|
264
|
+
type: "problem",
|
|
265
|
+
docs: {
|
|
266
|
+
description: "replaces usages of 'ReactDom.hydrate()' with 'hydrateRoot()'",
|
|
267
|
+
[Symbol.for("rule_features")]: RULE_FEATURES5
|
|
268
|
+
},
|
|
269
|
+
fixable: "code",
|
|
270
|
+
messages: {
|
|
271
|
+
noHydrate: "[Deprecated] Use 'hydrateRoot()' instead."
|
|
272
|
+
},
|
|
273
|
+
schema: []
|
|
274
|
+
},
|
|
275
|
+
name: RULE_NAME5,
|
|
276
|
+
create(context) {
|
|
277
|
+
if (!context.sourceCode.text.includes("hydrate")) return {};
|
|
278
|
+
const settings2 = shared.getSettingsFromContext(context);
|
|
279
|
+
if (compareVersions.compare(settings2.version, "18.0.0", "<")) return {};
|
|
280
|
+
const reactDomNames = /* @__PURE__ */ new Set();
|
|
281
|
+
const hydrateNames = /* @__PURE__ */ new Set();
|
|
282
|
+
return {
|
|
283
|
+
CallExpression(node) {
|
|
284
|
+
switch (true) {
|
|
285
|
+
case (node.callee.type === types.AST_NODE_TYPES.Identifier && hydrateNames.has(node.callee.name)):
|
|
286
|
+
context.report({
|
|
287
|
+
messageId: "noHydrate",
|
|
288
|
+
node,
|
|
289
|
+
fix: getFix(context, node)
|
|
290
|
+
});
|
|
291
|
+
return;
|
|
292
|
+
case (node.callee.type === types.AST_NODE_TYPES.MemberExpression && node.callee.object.type === types.AST_NODE_TYPES.Identifier && node.callee.property.type === types.AST_NODE_TYPES.Identifier && node.callee.property.name === "hydrate" && reactDomNames.has(node.callee.object.name)):
|
|
293
|
+
context.report({
|
|
294
|
+
messageId: "noHydrate",
|
|
295
|
+
node,
|
|
296
|
+
fix: getFix(context, node)
|
|
297
|
+
});
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
ImportDeclaration(node) {
|
|
302
|
+
const [baseSource] = node.source.value.split("/");
|
|
303
|
+
if (baseSource !== "react-dom") return;
|
|
304
|
+
for (const specifier of node.specifiers) {
|
|
305
|
+
switch (specifier.type) {
|
|
306
|
+
case types.AST_NODE_TYPES.ImportSpecifier:
|
|
307
|
+
if (specifier.imported.type !== types.AST_NODE_TYPES.Identifier) continue;
|
|
308
|
+
if (specifier.imported.name === "hydrate") {
|
|
309
|
+
hydrateNames.add(specifier.local.name);
|
|
310
|
+
}
|
|
311
|
+
continue;
|
|
312
|
+
case types.AST_NODE_TYPES.ImportDefaultSpecifier:
|
|
313
|
+
case types.AST_NODE_TYPES.ImportNamespaceSpecifier:
|
|
314
|
+
reactDomNames.add(specifier.local.name);
|
|
315
|
+
continue;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
},
|
|
321
|
+
defaultOptions: []
|
|
322
|
+
});
|
|
323
|
+
function getFix(context, node) {
|
|
324
|
+
const getText2 = (n) => context.sourceCode.getText(n);
|
|
325
|
+
return (fixer) => {
|
|
326
|
+
const [arg0, arg1] = node.arguments;
|
|
327
|
+
if (arg0 == null || arg1 == null) return null;
|
|
328
|
+
return [
|
|
329
|
+
fixer.insertTextBefore(context.sourceCode.ast, 'import { hydrateRoot } from "react-dom/client";\n'),
|
|
330
|
+
fixer.replaceText(node, `hydrateRoot(${getText2(arg1)}, ${getText2(arg0)})`)
|
|
331
|
+
];
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
var RULE_NAME6 = "no-missing-button-type";
|
|
335
|
+
var RULE_FEATURES6 = [
|
|
258
336
|
"CHK"
|
|
259
337
|
];
|
|
260
338
|
var no_missing_button_type_default = createRule({
|
|
@@ -262,14 +340,14 @@ var no_missing_button_type_default = createRule({
|
|
|
262
340
|
type: "problem",
|
|
263
341
|
docs: {
|
|
264
342
|
description: "enforce that button component have an explicit 'type' attribute",
|
|
265
|
-
[Symbol.for("rule_features")]:
|
|
343
|
+
[Symbol.for("rule_features")]: RULE_FEATURES6
|
|
266
344
|
},
|
|
267
345
|
messages: {
|
|
268
346
|
noMissingButtonType: "Add missing 'type' attribute on 'button' component."
|
|
269
347
|
},
|
|
270
348
|
schema: []
|
|
271
349
|
},
|
|
272
|
-
name:
|
|
350
|
+
name: RULE_NAME6,
|
|
273
351
|
create: create5,
|
|
274
352
|
defaultOptions: []
|
|
275
353
|
});
|
|
@@ -315,8 +393,8 @@ function create5(context) {
|
|
|
315
393
|
}
|
|
316
394
|
};
|
|
317
395
|
}
|
|
318
|
-
var
|
|
319
|
-
var
|
|
396
|
+
var RULE_NAME7 = "no-missing-iframe-sandbox";
|
|
397
|
+
var RULE_FEATURES7 = [
|
|
320
398
|
"CHK"
|
|
321
399
|
];
|
|
322
400
|
var validTypes = [
|
|
@@ -345,14 +423,14 @@ var no_missing_iframe_sandbox_default = createRule({
|
|
|
345
423
|
type: "problem",
|
|
346
424
|
docs: {
|
|
347
425
|
description: "enforce that 'iframe' component have an explicit 'sandbox' attribute",
|
|
348
|
-
[Symbol.for("rule_features")]:
|
|
426
|
+
[Symbol.for("rule_features")]: RULE_FEATURES7
|
|
349
427
|
},
|
|
350
428
|
messages: {
|
|
351
429
|
noMissingIframeSandbox: "Add missing 'sandbox' attribute on 'iframe' component."
|
|
352
430
|
},
|
|
353
431
|
schema: []
|
|
354
432
|
},
|
|
355
|
-
name:
|
|
433
|
+
name: RULE_NAME7,
|
|
356
434
|
create: create6,
|
|
357
435
|
defaultOptions: []
|
|
358
436
|
});
|
|
@@ -397,8 +475,8 @@ function create6(context) {
|
|
|
397
475
|
}
|
|
398
476
|
};
|
|
399
477
|
}
|
|
400
|
-
var
|
|
401
|
-
var
|
|
478
|
+
var RULE_NAME8 = "no-namespace";
|
|
479
|
+
var RULE_FEATURES8 = [
|
|
402
480
|
"CHK"
|
|
403
481
|
];
|
|
404
482
|
var no_namespace_default = createRule({
|
|
@@ -406,14 +484,14 @@ var no_namespace_default = createRule({
|
|
|
406
484
|
type: "problem",
|
|
407
485
|
docs: {
|
|
408
486
|
description: "enforce that namespaces are not used in React elements",
|
|
409
|
-
[Symbol.for("rule_features")]:
|
|
487
|
+
[Symbol.for("rule_features")]: RULE_FEATURES8
|
|
410
488
|
},
|
|
411
489
|
messages: {
|
|
412
490
|
noNamespace: "A React component '{{name}}' must not be in a namespace, as React does not support them."
|
|
413
491
|
},
|
|
414
492
|
schema: []
|
|
415
493
|
},
|
|
416
|
-
name:
|
|
494
|
+
name: RULE_NAME8,
|
|
417
495
|
create: create7,
|
|
418
496
|
defaultOptions: []
|
|
419
497
|
});
|
|
@@ -434,8 +512,8 @@ function create7(context) {
|
|
|
434
512
|
}
|
|
435
513
|
};
|
|
436
514
|
}
|
|
437
|
-
var
|
|
438
|
-
var
|
|
515
|
+
var RULE_NAME9 = "no-render";
|
|
516
|
+
var RULE_FEATURES9 = [
|
|
439
517
|
"CHK",
|
|
440
518
|
"MOD"
|
|
441
519
|
];
|
|
@@ -444,7 +522,7 @@ var no_render_default = createRule({
|
|
|
444
522
|
type: "problem",
|
|
445
523
|
docs: {
|
|
446
524
|
description: "replace usages of 'ReactDom.render()' with 'createRoot(node).render()'",
|
|
447
|
-
[Symbol.for("rule_features")]:
|
|
525
|
+
[Symbol.for("rule_features")]: RULE_FEATURES9
|
|
448
526
|
},
|
|
449
527
|
fixable: "code",
|
|
450
528
|
messages: {
|
|
@@ -452,7 +530,7 @@ var no_render_default = createRule({
|
|
|
452
530
|
},
|
|
453
531
|
schema: []
|
|
454
532
|
},
|
|
455
|
-
name:
|
|
533
|
+
name: RULE_NAME9,
|
|
456
534
|
create(context) {
|
|
457
535
|
if (!context.sourceCode.text.includes("render")) return {};
|
|
458
536
|
const settings2 = shared.getSettingsFromContext(context);
|
|
@@ -466,14 +544,14 @@ var no_render_default = createRule({
|
|
|
466
544
|
context.report({
|
|
467
545
|
messageId: "noRender",
|
|
468
546
|
node,
|
|
469
|
-
fix:
|
|
547
|
+
fix: getFix2(context, node)
|
|
470
548
|
});
|
|
471
549
|
return;
|
|
472
550
|
case (node.callee.type === types.AST_NODE_TYPES.MemberExpression && node.callee.object.type === types.AST_NODE_TYPES.Identifier && node.callee.property.type === types.AST_NODE_TYPES.Identifier && node.callee.property.name === "render" && reactDomNames.has(node.callee.object.name)):
|
|
473
551
|
context.report({
|
|
474
552
|
messageId: "noRender",
|
|
475
553
|
node,
|
|
476
|
-
fix:
|
|
554
|
+
fix: getFix2(context, node)
|
|
477
555
|
});
|
|
478
556
|
return;
|
|
479
557
|
}
|
|
@@ -500,7 +578,7 @@ var no_render_default = createRule({
|
|
|
500
578
|
},
|
|
501
579
|
defaultOptions: []
|
|
502
580
|
});
|
|
503
|
-
function
|
|
581
|
+
function getFix2(context, node) {
|
|
504
582
|
const getText2 = (n) => context.sourceCode.getText(n);
|
|
505
583
|
return (fixer) => {
|
|
506
584
|
const [arg0, arg1] = node.arguments;
|
|
@@ -511,8 +589,8 @@ function getFix(context, node) {
|
|
|
511
589
|
];
|
|
512
590
|
};
|
|
513
591
|
}
|
|
514
|
-
var
|
|
515
|
-
var
|
|
592
|
+
var RULE_NAME10 = "no-render-return-value";
|
|
593
|
+
var RULE_FEATURES10 = [
|
|
516
594
|
"CHK"
|
|
517
595
|
];
|
|
518
596
|
var banParentTypes = [
|
|
@@ -527,14 +605,14 @@ var no_render_return_value_default = createRule({
|
|
|
527
605
|
type: "problem",
|
|
528
606
|
docs: {
|
|
529
607
|
description: "disallow usage of the return value of 'ReactDOM.render'",
|
|
530
|
-
[Symbol.for("rule_features")]:
|
|
608
|
+
[Symbol.for("rule_features")]: RULE_FEATURES10
|
|
531
609
|
},
|
|
532
610
|
messages: {
|
|
533
611
|
noRenderReturnValue: "Do not depend on the return value from '{{objectName}}.render'."
|
|
534
612
|
},
|
|
535
613
|
schema: []
|
|
536
614
|
},
|
|
537
|
-
name:
|
|
615
|
+
name: RULE_NAME10,
|
|
538
616
|
create: create8,
|
|
539
617
|
defaultOptions: []
|
|
540
618
|
});
|
|
@@ -565,8 +643,8 @@ function create8(context) {
|
|
|
565
643
|
}
|
|
566
644
|
};
|
|
567
645
|
}
|
|
568
|
-
var
|
|
569
|
-
var
|
|
646
|
+
var RULE_NAME11 = "no-script-url";
|
|
647
|
+
var RULE_FEATURES11 = [
|
|
570
648
|
"CHK"
|
|
571
649
|
];
|
|
572
650
|
var no_script_url_default = createRule({
|
|
@@ -574,14 +652,14 @@ var no_script_url_default = createRule({
|
|
|
574
652
|
type: "problem",
|
|
575
653
|
docs: {
|
|
576
654
|
description: "disallow 'javascript:' URLs as JSX event handler prop's value",
|
|
577
|
-
[Symbol.for("rule_features")]:
|
|
655
|
+
[Symbol.for("rule_features")]: RULE_FEATURES11
|
|
578
656
|
},
|
|
579
657
|
messages: {
|
|
580
658
|
noScriptUrl: "Using a `javascript:` URL is a security risk and should be avoided."
|
|
581
659
|
},
|
|
582
660
|
schema: []
|
|
583
661
|
},
|
|
584
|
-
name:
|
|
662
|
+
name: RULE_NAME11,
|
|
585
663
|
create: create9,
|
|
586
664
|
defaultOptions: []
|
|
587
665
|
});
|
|
@@ -604,7 +682,7 @@ function create9(context) {
|
|
|
604
682
|
}
|
|
605
683
|
};
|
|
606
684
|
}
|
|
607
|
-
var
|
|
685
|
+
var RULE_NAME12 = "no-unknown-property";
|
|
608
686
|
var DEFAULTS = {
|
|
609
687
|
ignore: [],
|
|
610
688
|
requireDataLowercase: false
|
|
@@ -1567,7 +1645,7 @@ var no_unknown_property_default = createRule({
|
|
|
1567
1645
|
}
|
|
1568
1646
|
}]
|
|
1569
1647
|
},
|
|
1570
|
-
name:
|
|
1648
|
+
name: RULE_NAME12,
|
|
1571
1649
|
create: create10,
|
|
1572
1650
|
defaultOptions: []
|
|
1573
1651
|
});
|
|
@@ -1663,8 +1741,8 @@ function testReactVersion(context, comparator, version2) {
|
|
|
1663
1741
|
const { version: localVersion } = shared.getSettingsFromContext(context);
|
|
1664
1742
|
return compareVersions.compare(localVersion, version2, comparator);
|
|
1665
1743
|
}
|
|
1666
|
-
var
|
|
1667
|
-
var
|
|
1744
|
+
var RULE_NAME13 = "no-unsafe-iframe-sandbox";
|
|
1745
|
+
var RULE_FEATURES12 = [
|
|
1668
1746
|
"CHK"
|
|
1669
1747
|
];
|
|
1670
1748
|
var unsafeSandboxValues = [
|
|
@@ -1681,14 +1759,14 @@ var no_unsafe_iframe_sandbox_default = createRule({
|
|
|
1681
1759
|
type: "problem",
|
|
1682
1760
|
docs: {
|
|
1683
1761
|
description: "disallow unsafe iframe 'sandbox' attribute combinations",
|
|
1684
|
-
[Symbol.for("rule_features")]:
|
|
1762
|
+
[Symbol.for("rule_features")]: RULE_FEATURES12
|
|
1685
1763
|
},
|
|
1686
1764
|
messages: {
|
|
1687
1765
|
noUnsafeIframeSandbox: "Unsafe 'sandbox' attribute value on 'iframe' component."
|
|
1688
1766
|
},
|
|
1689
1767
|
schema: []
|
|
1690
1768
|
},
|
|
1691
|
-
name:
|
|
1769
|
+
name: RULE_NAME13,
|
|
1692
1770
|
create: create11,
|
|
1693
1771
|
defaultOptions: []
|
|
1694
1772
|
});
|
|
@@ -1735,8 +1813,8 @@ function create11(context) {
|
|
|
1735
1813
|
}
|
|
1736
1814
|
};
|
|
1737
1815
|
}
|
|
1738
|
-
var
|
|
1739
|
-
var
|
|
1816
|
+
var RULE_NAME14 = "no-unsafe-target-blank";
|
|
1817
|
+
var RULE_FEATURES13 = [
|
|
1740
1818
|
"CHK"
|
|
1741
1819
|
];
|
|
1742
1820
|
function isExternalLinkLike(value) {
|
|
@@ -1752,14 +1830,14 @@ var no_unsafe_target_blank_default = createRule({
|
|
|
1752
1830
|
type: "problem",
|
|
1753
1831
|
docs: {
|
|
1754
1832
|
description: `disallow 'target="_blank"' on an external link without 'rel="noreferrer noopener"'`,
|
|
1755
|
-
[Symbol.for("rule_features")]:
|
|
1833
|
+
[Symbol.for("rule_features")]: RULE_FEATURES13
|
|
1756
1834
|
},
|
|
1757
1835
|
messages: {
|
|
1758
1836
|
noUnsafeTargetBlank: `Using 'target="_blank"' on an external link without 'rel="noreferrer noopener"' is a security risk.`
|
|
1759
1837
|
},
|
|
1760
1838
|
schema: []
|
|
1761
1839
|
},
|
|
1762
|
-
name:
|
|
1840
|
+
name: RULE_NAME14,
|
|
1763
1841
|
create: create12,
|
|
1764
1842
|
defaultOptions: []
|
|
1765
1843
|
});
|
|
@@ -1810,8 +1888,8 @@ function create12(context) {
|
|
|
1810
1888
|
}
|
|
1811
1889
|
};
|
|
1812
1890
|
}
|
|
1813
|
-
var
|
|
1814
|
-
var
|
|
1891
|
+
var RULE_NAME15 = "no-use-form-state";
|
|
1892
|
+
var RULE_FEATURES14 = [
|
|
1815
1893
|
"CHK",
|
|
1816
1894
|
"MOD"
|
|
1817
1895
|
];
|
|
@@ -1820,7 +1898,7 @@ var no_use_form_state_default = createRule({
|
|
|
1820
1898
|
type: "problem",
|
|
1821
1899
|
docs: {
|
|
1822
1900
|
description: "replace usages of 'ReactDom.render()' with 'createRoot(node).render()'",
|
|
1823
|
-
[Symbol.for("rule_features")]:
|
|
1901
|
+
[Symbol.for("rule_features")]: RULE_FEATURES14
|
|
1824
1902
|
},
|
|
1825
1903
|
fixable: "code",
|
|
1826
1904
|
messages: {
|
|
@@ -1828,7 +1906,7 @@ var no_use_form_state_default = createRule({
|
|
|
1828
1906
|
},
|
|
1829
1907
|
schema: []
|
|
1830
1908
|
},
|
|
1831
|
-
name:
|
|
1909
|
+
name: RULE_NAME15,
|
|
1832
1910
|
create(context) {
|
|
1833
1911
|
if (!context.sourceCode.text.includes("useFormState")) return {};
|
|
1834
1912
|
const settings2 = shared.getSettingsFromContext(context);
|
|
@@ -1842,14 +1920,14 @@ var no_use_form_state_default = createRule({
|
|
|
1842
1920
|
context.report({
|
|
1843
1921
|
messageId: "noUseFormState",
|
|
1844
1922
|
node,
|
|
1845
|
-
fix:
|
|
1923
|
+
fix: getFix3(context, node)
|
|
1846
1924
|
});
|
|
1847
1925
|
return;
|
|
1848
1926
|
case (node.callee.type === types.AST_NODE_TYPES.MemberExpression && node.callee.object.type === types.AST_NODE_TYPES.Identifier && node.callee.property.type === types.AST_NODE_TYPES.Identifier && node.callee.property.name === "useFormState" && reactDomNames.has(node.callee.object.name)):
|
|
1849
1927
|
context.report({
|
|
1850
1928
|
messageId: "noUseFormState",
|
|
1851
1929
|
node,
|
|
1852
|
-
fix:
|
|
1930
|
+
fix: getFix3(context, node)
|
|
1853
1931
|
});
|
|
1854
1932
|
return;
|
|
1855
1933
|
}
|
|
@@ -1876,7 +1954,7 @@ var no_use_form_state_default = createRule({
|
|
|
1876
1954
|
},
|
|
1877
1955
|
defaultOptions: []
|
|
1878
1956
|
});
|
|
1879
|
-
function
|
|
1957
|
+
function getFix3(context, node) {
|
|
1880
1958
|
const { importSource } = shared.getSettingsFromContext(context);
|
|
1881
1959
|
return (fixer) => {
|
|
1882
1960
|
return [
|
|
@@ -1886,8 +1964,8 @@ function getFix2(context, node) {
|
|
|
1886
1964
|
];
|
|
1887
1965
|
};
|
|
1888
1966
|
}
|
|
1889
|
-
var
|
|
1890
|
-
var
|
|
1967
|
+
var RULE_NAME16 = "no-void-elements-with-children";
|
|
1968
|
+
var RULE_FEATURES15 = [
|
|
1891
1969
|
"CHK"
|
|
1892
1970
|
];
|
|
1893
1971
|
var voidElements = /* @__PURE__ */ new Set([
|
|
@@ -1913,14 +1991,14 @@ var no_void_elements_with_children_default = createRule({
|
|
|
1913
1991
|
type: "problem",
|
|
1914
1992
|
docs: {
|
|
1915
1993
|
description: "disallow void elements (AKA self-closing elements) from having children",
|
|
1916
|
-
[Symbol.for("rule_features")]:
|
|
1994
|
+
[Symbol.for("rule_features")]: RULE_FEATURES15
|
|
1917
1995
|
},
|
|
1918
1996
|
messages: {
|
|
1919
1997
|
noVoidElementsWithChildren: "'{{element}}' is a void element tag and must not have children."
|
|
1920
1998
|
},
|
|
1921
1999
|
schema: []
|
|
1922
2000
|
},
|
|
1923
|
-
name:
|
|
2001
|
+
name: RULE_NAME16,
|
|
1924
2002
|
create: create13,
|
|
1925
2003
|
defaultOptions: []
|
|
1926
2004
|
});
|
|
@@ -1967,6 +2045,7 @@ var plugin = {
|
|
|
1967
2045
|
"no-dangerously-set-innerhtml-with-children": no_dangerously_set_innerhtml_with_children_default,
|
|
1968
2046
|
"no-find-dom-node": no_find_dom_node_default,
|
|
1969
2047
|
"no-flush-sync": no_flush_sync_default,
|
|
2048
|
+
"no-hydrate": no_hydrate_default,
|
|
1970
2049
|
"no-missing-button-type": no_missing_button_type_default,
|
|
1971
2050
|
"no-missing-iframe-sandbox": no_missing_iframe_sandbox_default,
|
|
1972
2051
|
"no-namespace": no_namespace_default,
|
package/dist/index.mjs
CHANGED
|
@@ -24,6 +24,7 @@ var rules = {
|
|
|
24
24
|
"react-dom/no-dangerously-set-innerhtml-with-children": "error",
|
|
25
25
|
"react-dom/no-find-dom-node": "error",
|
|
26
26
|
"react-dom/no-flush-sync": "error",
|
|
27
|
+
"react-dom/no-hydrate": "error",
|
|
27
28
|
"react-dom/no-missing-button-type": "warn",
|
|
28
29
|
"react-dom/no-missing-iframe-sandbox": "warn",
|
|
29
30
|
"react-dom/no-namespace": "error",
|
|
@@ -42,7 +43,7 @@ var settings = {
|
|
|
42
43
|
|
|
43
44
|
// package.json
|
|
44
45
|
var name2 = "eslint-plugin-react-dom";
|
|
45
|
-
var version = "1.34.2-beta.
|
|
46
|
+
var version = "1.34.2-beta.3";
|
|
46
47
|
var createRule = createRuleForPlugin("dom");
|
|
47
48
|
|
|
48
49
|
// src/utils/find-custom-component.ts
|
|
@@ -230,8 +231,85 @@ function create4(context) {
|
|
|
230
231
|
}
|
|
231
232
|
};
|
|
232
233
|
}
|
|
233
|
-
var RULE_NAME5 = "no-
|
|
234
|
+
var RULE_NAME5 = "no-hydrate";
|
|
234
235
|
var RULE_FEATURES5 = [
|
|
236
|
+
"CHK",
|
|
237
|
+
"MOD"
|
|
238
|
+
];
|
|
239
|
+
var no_hydrate_default = createRule({
|
|
240
|
+
meta: {
|
|
241
|
+
type: "problem",
|
|
242
|
+
docs: {
|
|
243
|
+
description: "replaces usages of 'ReactDom.hydrate()' with 'hydrateRoot()'",
|
|
244
|
+
[Symbol.for("rule_features")]: RULE_FEATURES5
|
|
245
|
+
},
|
|
246
|
+
fixable: "code",
|
|
247
|
+
messages: {
|
|
248
|
+
noHydrate: "[Deprecated] Use 'hydrateRoot()' instead."
|
|
249
|
+
},
|
|
250
|
+
schema: []
|
|
251
|
+
},
|
|
252
|
+
name: RULE_NAME5,
|
|
253
|
+
create(context) {
|
|
254
|
+
if (!context.sourceCode.text.includes("hydrate")) return {};
|
|
255
|
+
const settings2 = getSettingsFromContext(context);
|
|
256
|
+
if (compare(settings2.version, "18.0.0", "<")) return {};
|
|
257
|
+
const reactDomNames = /* @__PURE__ */ new Set();
|
|
258
|
+
const hydrateNames = /* @__PURE__ */ new Set();
|
|
259
|
+
return {
|
|
260
|
+
CallExpression(node) {
|
|
261
|
+
switch (true) {
|
|
262
|
+
case (node.callee.type === AST_NODE_TYPES.Identifier && hydrateNames.has(node.callee.name)):
|
|
263
|
+
context.report({
|
|
264
|
+
messageId: "noHydrate",
|
|
265
|
+
node,
|
|
266
|
+
fix: getFix(context, node)
|
|
267
|
+
});
|
|
268
|
+
return;
|
|
269
|
+
case (node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.object.type === AST_NODE_TYPES.Identifier && node.callee.property.type === AST_NODE_TYPES.Identifier && node.callee.property.name === "hydrate" && reactDomNames.has(node.callee.object.name)):
|
|
270
|
+
context.report({
|
|
271
|
+
messageId: "noHydrate",
|
|
272
|
+
node,
|
|
273
|
+
fix: getFix(context, node)
|
|
274
|
+
});
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
ImportDeclaration(node) {
|
|
279
|
+
const [baseSource] = node.source.value.split("/");
|
|
280
|
+
if (baseSource !== "react-dom") return;
|
|
281
|
+
for (const specifier of node.specifiers) {
|
|
282
|
+
switch (specifier.type) {
|
|
283
|
+
case AST_NODE_TYPES.ImportSpecifier:
|
|
284
|
+
if (specifier.imported.type !== AST_NODE_TYPES.Identifier) continue;
|
|
285
|
+
if (specifier.imported.name === "hydrate") {
|
|
286
|
+
hydrateNames.add(specifier.local.name);
|
|
287
|
+
}
|
|
288
|
+
continue;
|
|
289
|
+
case AST_NODE_TYPES.ImportDefaultSpecifier:
|
|
290
|
+
case AST_NODE_TYPES.ImportNamespaceSpecifier:
|
|
291
|
+
reactDomNames.add(specifier.local.name);
|
|
292
|
+
continue;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
},
|
|
298
|
+
defaultOptions: []
|
|
299
|
+
});
|
|
300
|
+
function getFix(context, node) {
|
|
301
|
+
const getText2 = (n) => context.sourceCode.getText(n);
|
|
302
|
+
return (fixer) => {
|
|
303
|
+
const [arg0, arg1] = node.arguments;
|
|
304
|
+
if (arg0 == null || arg1 == null) return null;
|
|
305
|
+
return [
|
|
306
|
+
fixer.insertTextBefore(context.sourceCode.ast, 'import { hydrateRoot } from "react-dom/client";\n'),
|
|
307
|
+
fixer.replaceText(node, `hydrateRoot(${getText2(arg1)}, ${getText2(arg0)})`)
|
|
308
|
+
];
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
var RULE_NAME6 = "no-missing-button-type";
|
|
312
|
+
var RULE_FEATURES6 = [
|
|
235
313
|
"CHK"
|
|
236
314
|
];
|
|
237
315
|
var no_missing_button_type_default = createRule({
|
|
@@ -239,14 +317,14 @@ var no_missing_button_type_default = createRule({
|
|
|
239
317
|
type: "problem",
|
|
240
318
|
docs: {
|
|
241
319
|
description: "enforce that button component have an explicit 'type' attribute",
|
|
242
|
-
[Symbol.for("rule_features")]:
|
|
320
|
+
[Symbol.for("rule_features")]: RULE_FEATURES6
|
|
243
321
|
},
|
|
244
322
|
messages: {
|
|
245
323
|
noMissingButtonType: "Add missing 'type' attribute on 'button' component."
|
|
246
324
|
},
|
|
247
325
|
schema: []
|
|
248
326
|
},
|
|
249
|
-
name:
|
|
327
|
+
name: RULE_NAME6,
|
|
250
328
|
create: create5,
|
|
251
329
|
defaultOptions: []
|
|
252
330
|
});
|
|
@@ -292,8 +370,8 @@ function create5(context) {
|
|
|
292
370
|
}
|
|
293
371
|
};
|
|
294
372
|
}
|
|
295
|
-
var
|
|
296
|
-
var
|
|
373
|
+
var RULE_NAME7 = "no-missing-iframe-sandbox";
|
|
374
|
+
var RULE_FEATURES7 = [
|
|
297
375
|
"CHK"
|
|
298
376
|
];
|
|
299
377
|
var validTypes = [
|
|
@@ -322,14 +400,14 @@ var no_missing_iframe_sandbox_default = createRule({
|
|
|
322
400
|
type: "problem",
|
|
323
401
|
docs: {
|
|
324
402
|
description: "enforce that 'iframe' component have an explicit 'sandbox' attribute",
|
|
325
|
-
[Symbol.for("rule_features")]:
|
|
403
|
+
[Symbol.for("rule_features")]: RULE_FEATURES7
|
|
326
404
|
},
|
|
327
405
|
messages: {
|
|
328
406
|
noMissingIframeSandbox: "Add missing 'sandbox' attribute on 'iframe' component."
|
|
329
407
|
},
|
|
330
408
|
schema: []
|
|
331
409
|
},
|
|
332
|
-
name:
|
|
410
|
+
name: RULE_NAME7,
|
|
333
411
|
create: create6,
|
|
334
412
|
defaultOptions: []
|
|
335
413
|
});
|
|
@@ -374,8 +452,8 @@ function create6(context) {
|
|
|
374
452
|
}
|
|
375
453
|
};
|
|
376
454
|
}
|
|
377
|
-
var
|
|
378
|
-
var
|
|
455
|
+
var RULE_NAME8 = "no-namespace";
|
|
456
|
+
var RULE_FEATURES8 = [
|
|
379
457
|
"CHK"
|
|
380
458
|
];
|
|
381
459
|
var no_namespace_default = createRule({
|
|
@@ -383,14 +461,14 @@ var no_namespace_default = createRule({
|
|
|
383
461
|
type: "problem",
|
|
384
462
|
docs: {
|
|
385
463
|
description: "enforce that namespaces are not used in React elements",
|
|
386
|
-
[Symbol.for("rule_features")]:
|
|
464
|
+
[Symbol.for("rule_features")]: RULE_FEATURES8
|
|
387
465
|
},
|
|
388
466
|
messages: {
|
|
389
467
|
noNamespace: "A React component '{{name}}' must not be in a namespace, as React does not support them."
|
|
390
468
|
},
|
|
391
469
|
schema: []
|
|
392
470
|
},
|
|
393
|
-
name:
|
|
471
|
+
name: RULE_NAME8,
|
|
394
472
|
create: create7,
|
|
395
473
|
defaultOptions: []
|
|
396
474
|
});
|
|
@@ -411,8 +489,8 @@ function create7(context) {
|
|
|
411
489
|
}
|
|
412
490
|
};
|
|
413
491
|
}
|
|
414
|
-
var
|
|
415
|
-
var
|
|
492
|
+
var RULE_NAME9 = "no-render";
|
|
493
|
+
var RULE_FEATURES9 = [
|
|
416
494
|
"CHK",
|
|
417
495
|
"MOD"
|
|
418
496
|
];
|
|
@@ -421,7 +499,7 @@ var no_render_default = createRule({
|
|
|
421
499
|
type: "problem",
|
|
422
500
|
docs: {
|
|
423
501
|
description: "replace usages of 'ReactDom.render()' with 'createRoot(node).render()'",
|
|
424
|
-
[Symbol.for("rule_features")]:
|
|
502
|
+
[Symbol.for("rule_features")]: RULE_FEATURES9
|
|
425
503
|
},
|
|
426
504
|
fixable: "code",
|
|
427
505
|
messages: {
|
|
@@ -429,7 +507,7 @@ var no_render_default = createRule({
|
|
|
429
507
|
},
|
|
430
508
|
schema: []
|
|
431
509
|
},
|
|
432
|
-
name:
|
|
510
|
+
name: RULE_NAME9,
|
|
433
511
|
create(context) {
|
|
434
512
|
if (!context.sourceCode.text.includes("render")) return {};
|
|
435
513
|
const settings2 = getSettingsFromContext(context);
|
|
@@ -443,14 +521,14 @@ var no_render_default = createRule({
|
|
|
443
521
|
context.report({
|
|
444
522
|
messageId: "noRender",
|
|
445
523
|
node,
|
|
446
|
-
fix:
|
|
524
|
+
fix: getFix2(context, node)
|
|
447
525
|
});
|
|
448
526
|
return;
|
|
449
527
|
case (node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.object.type === AST_NODE_TYPES.Identifier && node.callee.property.type === AST_NODE_TYPES.Identifier && node.callee.property.name === "render" && reactDomNames.has(node.callee.object.name)):
|
|
450
528
|
context.report({
|
|
451
529
|
messageId: "noRender",
|
|
452
530
|
node,
|
|
453
|
-
fix:
|
|
531
|
+
fix: getFix2(context, node)
|
|
454
532
|
});
|
|
455
533
|
return;
|
|
456
534
|
}
|
|
@@ -477,7 +555,7 @@ var no_render_default = createRule({
|
|
|
477
555
|
},
|
|
478
556
|
defaultOptions: []
|
|
479
557
|
});
|
|
480
|
-
function
|
|
558
|
+
function getFix2(context, node) {
|
|
481
559
|
const getText2 = (n) => context.sourceCode.getText(n);
|
|
482
560
|
return (fixer) => {
|
|
483
561
|
const [arg0, arg1] = node.arguments;
|
|
@@ -488,8 +566,8 @@ function getFix(context, node) {
|
|
|
488
566
|
];
|
|
489
567
|
};
|
|
490
568
|
}
|
|
491
|
-
var
|
|
492
|
-
var
|
|
569
|
+
var RULE_NAME10 = "no-render-return-value";
|
|
570
|
+
var RULE_FEATURES10 = [
|
|
493
571
|
"CHK"
|
|
494
572
|
];
|
|
495
573
|
var banParentTypes = [
|
|
@@ -504,14 +582,14 @@ var no_render_return_value_default = createRule({
|
|
|
504
582
|
type: "problem",
|
|
505
583
|
docs: {
|
|
506
584
|
description: "disallow usage of the return value of 'ReactDOM.render'",
|
|
507
|
-
[Symbol.for("rule_features")]:
|
|
585
|
+
[Symbol.for("rule_features")]: RULE_FEATURES10
|
|
508
586
|
},
|
|
509
587
|
messages: {
|
|
510
588
|
noRenderReturnValue: "Do not depend on the return value from '{{objectName}}.render'."
|
|
511
589
|
},
|
|
512
590
|
schema: []
|
|
513
591
|
},
|
|
514
|
-
name:
|
|
592
|
+
name: RULE_NAME10,
|
|
515
593
|
create: create8,
|
|
516
594
|
defaultOptions: []
|
|
517
595
|
});
|
|
@@ -542,8 +620,8 @@ function create8(context) {
|
|
|
542
620
|
}
|
|
543
621
|
};
|
|
544
622
|
}
|
|
545
|
-
var
|
|
546
|
-
var
|
|
623
|
+
var RULE_NAME11 = "no-script-url";
|
|
624
|
+
var RULE_FEATURES11 = [
|
|
547
625
|
"CHK"
|
|
548
626
|
];
|
|
549
627
|
var no_script_url_default = createRule({
|
|
@@ -551,14 +629,14 @@ var no_script_url_default = createRule({
|
|
|
551
629
|
type: "problem",
|
|
552
630
|
docs: {
|
|
553
631
|
description: "disallow 'javascript:' URLs as JSX event handler prop's value",
|
|
554
|
-
[Symbol.for("rule_features")]:
|
|
632
|
+
[Symbol.for("rule_features")]: RULE_FEATURES11
|
|
555
633
|
},
|
|
556
634
|
messages: {
|
|
557
635
|
noScriptUrl: "Using a `javascript:` URL is a security risk and should be avoided."
|
|
558
636
|
},
|
|
559
637
|
schema: []
|
|
560
638
|
},
|
|
561
|
-
name:
|
|
639
|
+
name: RULE_NAME11,
|
|
562
640
|
create: create9,
|
|
563
641
|
defaultOptions: []
|
|
564
642
|
});
|
|
@@ -581,7 +659,7 @@ function create9(context) {
|
|
|
581
659
|
}
|
|
582
660
|
};
|
|
583
661
|
}
|
|
584
|
-
var
|
|
662
|
+
var RULE_NAME12 = "no-unknown-property";
|
|
585
663
|
var DEFAULTS = {
|
|
586
664
|
ignore: [],
|
|
587
665
|
requireDataLowercase: false
|
|
@@ -1544,7 +1622,7 @@ var no_unknown_property_default = createRule({
|
|
|
1544
1622
|
}
|
|
1545
1623
|
}]
|
|
1546
1624
|
},
|
|
1547
|
-
name:
|
|
1625
|
+
name: RULE_NAME12,
|
|
1548
1626
|
create: create10,
|
|
1549
1627
|
defaultOptions: []
|
|
1550
1628
|
});
|
|
@@ -1640,8 +1718,8 @@ function testReactVersion(context, comparator, version2) {
|
|
|
1640
1718
|
const { version: localVersion } = getSettingsFromContext(context);
|
|
1641
1719
|
return compare(localVersion, version2, comparator);
|
|
1642
1720
|
}
|
|
1643
|
-
var
|
|
1644
|
-
var
|
|
1721
|
+
var RULE_NAME13 = "no-unsafe-iframe-sandbox";
|
|
1722
|
+
var RULE_FEATURES12 = [
|
|
1645
1723
|
"CHK"
|
|
1646
1724
|
];
|
|
1647
1725
|
var unsafeSandboxValues = [
|
|
@@ -1658,14 +1736,14 @@ var no_unsafe_iframe_sandbox_default = createRule({
|
|
|
1658
1736
|
type: "problem",
|
|
1659
1737
|
docs: {
|
|
1660
1738
|
description: "disallow unsafe iframe 'sandbox' attribute combinations",
|
|
1661
|
-
[Symbol.for("rule_features")]:
|
|
1739
|
+
[Symbol.for("rule_features")]: RULE_FEATURES12
|
|
1662
1740
|
},
|
|
1663
1741
|
messages: {
|
|
1664
1742
|
noUnsafeIframeSandbox: "Unsafe 'sandbox' attribute value on 'iframe' component."
|
|
1665
1743
|
},
|
|
1666
1744
|
schema: []
|
|
1667
1745
|
},
|
|
1668
|
-
name:
|
|
1746
|
+
name: RULE_NAME13,
|
|
1669
1747
|
create: create11,
|
|
1670
1748
|
defaultOptions: []
|
|
1671
1749
|
});
|
|
@@ -1712,8 +1790,8 @@ function create11(context) {
|
|
|
1712
1790
|
}
|
|
1713
1791
|
};
|
|
1714
1792
|
}
|
|
1715
|
-
var
|
|
1716
|
-
var
|
|
1793
|
+
var RULE_NAME14 = "no-unsafe-target-blank";
|
|
1794
|
+
var RULE_FEATURES13 = [
|
|
1717
1795
|
"CHK"
|
|
1718
1796
|
];
|
|
1719
1797
|
function isExternalLinkLike(value) {
|
|
@@ -1729,14 +1807,14 @@ var no_unsafe_target_blank_default = createRule({
|
|
|
1729
1807
|
type: "problem",
|
|
1730
1808
|
docs: {
|
|
1731
1809
|
description: `disallow 'target="_blank"' on an external link without 'rel="noreferrer noopener"'`,
|
|
1732
|
-
[Symbol.for("rule_features")]:
|
|
1810
|
+
[Symbol.for("rule_features")]: RULE_FEATURES13
|
|
1733
1811
|
},
|
|
1734
1812
|
messages: {
|
|
1735
1813
|
noUnsafeTargetBlank: `Using 'target="_blank"' on an external link without 'rel="noreferrer noopener"' is a security risk.`
|
|
1736
1814
|
},
|
|
1737
1815
|
schema: []
|
|
1738
1816
|
},
|
|
1739
|
-
name:
|
|
1817
|
+
name: RULE_NAME14,
|
|
1740
1818
|
create: create12,
|
|
1741
1819
|
defaultOptions: []
|
|
1742
1820
|
});
|
|
@@ -1787,8 +1865,8 @@ function create12(context) {
|
|
|
1787
1865
|
}
|
|
1788
1866
|
};
|
|
1789
1867
|
}
|
|
1790
|
-
var
|
|
1791
|
-
var
|
|
1868
|
+
var RULE_NAME15 = "no-use-form-state";
|
|
1869
|
+
var RULE_FEATURES14 = [
|
|
1792
1870
|
"CHK",
|
|
1793
1871
|
"MOD"
|
|
1794
1872
|
];
|
|
@@ -1797,7 +1875,7 @@ var no_use_form_state_default = createRule({
|
|
|
1797
1875
|
type: "problem",
|
|
1798
1876
|
docs: {
|
|
1799
1877
|
description: "replace usages of 'ReactDom.render()' with 'createRoot(node).render()'",
|
|
1800
|
-
[Symbol.for("rule_features")]:
|
|
1878
|
+
[Symbol.for("rule_features")]: RULE_FEATURES14
|
|
1801
1879
|
},
|
|
1802
1880
|
fixable: "code",
|
|
1803
1881
|
messages: {
|
|
@@ -1805,7 +1883,7 @@ var no_use_form_state_default = createRule({
|
|
|
1805
1883
|
},
|
|
1806
1884
|
schema: []
|
|
1807
1885
|
},
|
|
1808
|
-
name:
|
|
1886
|
+
name: RULE_NAME15,
|
|
1809
1887
|
create(context) {
|
|
1810
1888
|
if (!context.sourceCode.text.includes("useFormState")) return {};
|
|
1811
1889
|
const settings2 = getSettingsFromContext(context);
|
|
@@ -1819,14 +1897,14 @@ var no_use_form_state_default = createRule({
|
|
|
1819
1897
|
context.report({
|
|
1820
1898
|
messageId: "noUseFormState",
|
|
1821
1899
|
node,
|
|
1822
|
-
fix:
|
|
1900
|
+
fix: getFix3(context, node)
|
|
1823
1901
|
});
|
|
1824
1902
|
return;
|
|
1825
1903
|
case (node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.object.type === AST_NODE_TYPES.Identifier && node.callee.property.type === AST_NODE_TYPES.Identifier && node.callee.property.name === "useFormState" && reactDomNames.has(node.callee.object.name)):
|
|
1826
1904
|
context.report({
|
|
1827
1905
|
messageId: "noUseFormState",
|
|
1828
1906
|
node,
|
|
1829
|
-
fix:
|
|
1907
|
+
fix: getFix3(context, node)
|
|
1830
1908
|
});
|
|
1831
1909
|
return;
|
|
1832
1910
|
}
|
|
@@ -1853,7 +1931,7 @@ var no_use_form_state_default = createRule({
|
|
|
1853
1931
|
},
|
|
1854
1932
|
defaultOptions: []
|
|
1855
1933
|
});
|
|
1856
|
-
function
|
|
1934
|
+
function getFix3(context, node) {
|
|
1857
1935
|
const { importSource } = getSettingsFromContext(context);
|
|
1858
1936
|
return (fixer) => {
|
|
1859
1937
|
return [
|
|
@@ -1863,8 +1941,8 @@ function getFix2(context, node) {
|
|
|
1863
1941
|
];
|
|
1864
1942
|
};
|
|
1865
1943
|
}
|
|
1866
|
-
var
|
|
1867
|
-
var
|
|
1944
|
+
var RULE_NAME16 = "no-void-elements-with-children";
|
|
1945
|
+
var RULE_FEATURES15 = [
|
|
1868
1946
|
"CHK"
|
|
1869
1947
|
];
|
|
1870
1948
|
var voidElements = /* @__PURE__ */ new Set([
|
|
@@ -1890,14 +1968,14 @@ var no_void_elements_with_children_default = createRule({
|
|
|
1890
1968
|
type: "problem",
|
|
1891
1969
|
docs: {
|
|
1892
1970
|
description: "disallow void elements (AKA self-closing elements) from having children",
|
|
1893
|
-
[Symbol.for("rule_features")]:
|
|
1971
|
+
[Symbol.for("rule_features")]: RULE_FEATURES15
|
|
1894
1972
|
},
|
|
1895
1973
|
messages: {
|
|
1896
1974
|
noVoidElementsWithChildren: "'{{element}}' is a void element tag and must not have children."
|
|
1897
1975
|
},
|
|
1898
1976
|
schema: []
|
|
1899
1977
|
},
|
|
1900
|
-
name:
|
|
1978
|
+
name: RULE_NAME16,
|
|
1901
1979
|
create: create13,
|
|
1902
1980
|
defaultOptions: []
|
|
1903
1981
|
});
|
|
@@ -1944,6 +2022,7 @@ var plugin = {
|
|
|
1944
2022
|
"no-dangerously-set-innerhtml-with-children": no_dangerously_set_innerhtml_with_children_default,
|
|
1945
2023
|
"no-find-dom-node": no_find_dom_node_default,
|
|
1946
2024
|
"no-flush-sync": no_flush_sync_default,
|
|
2025
|
+
"no-hydrate": no_hydrate_default,
|
|
1947
2026
|
"no-missing-button-type": no_missing_button_type_default,
|
|
1948
2027
|
"no-missing-iframe-sandbox": no_missing_iframe_sandbox_default,
|
|
1949
2028
|
"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.34.2-beta.
|
|
3
|
+
"version": "1.34.2-beta.3",
|
|
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/ast": "1.34.2-beta.
|
|
53
|
-
"@eslint-react/core": "1.34.2-beta.
|
|
54
|
-
"@eslint-react/
|
|
55
|
-
"@eslint-react/jsx": "1.34.2-beta.
|
|
56
|
-
"@eslint-react/
|
|
57
|
-
"@eslint-react/
|
|
52
|
+
"@eslint-react/ast": "1.34.2-beta.3",
|
|
53
|
+
"@eslint-react/core": "1.34.2-beta.3",
|
|
54
|
+
"@eslint-react/shared": "1.34.2-beta.3",
|
|
55
|
+
"@eslint-react/jsx": "1.34.2-beta.3",
|
|
56
|
+
"@eslint-react/eff": "1.34.2-beta.3",
|
|
57
|
+
"@eslint-react/var": "1.34.2-beta.3"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@types/react": "^19.0.10",
|