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