eslint-plugin-react-dom 2.8.2-next.4 → 2.8.2-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.js +38 -38
- package/package.json +6 -7
package/dist/index.js
CHANGED
|
@@ -23,7 +23,7 @@ var __exportAll = (all, symbols) => {
|
|
|
23
23
|
//#endregion
|
|
24
24
|
//#region package.json
|
|
25
25
|
var name$2 = "eslint-plugin-react-dom";
|
|
26
|
-
var version = "2.8.2-next.
|
|
26
|
+
var version = "2.8.2-next.6";
|
|
27
27
|
|
|
28
28
|
//#endregion
|
|
29
29
|
//#region src/utils/create-jsx-element-resolver.ts
|
|
@@ -74,7 +74,7 @@ var no_dangerously_set_innerhtml_default = createRule({
|
|
|
74
74
|
meta: {
|
|
75
75
|
type: "problem",
|
|
76
76
|
docs: { description: "Disallows DOM elements from using 'dangerouslySetInnerHTML'." },
|
|
77
|
-
messages: {
|
|
77
|
+
messages: { default: "Using 'dangerouslySetInnerHTML' may have security implications." },
|
|
78
78
|
schema: []
|
|
79
79
|
},
|
|
80
80
|
name: RULE_NAME$17,
|
|
@@ -87,7 +87,7 @@ function create$17(context) {
|
|
|
87
87
|
const dsihProp = core.getJsxAttribute(context, node)(DSIH$1);
|
|
88
88
|
if (dsihProp == null) return;
|
|
89
89
|
context.report({
|
|
90
|
-
messageId: "
|
|
90
|
+
messageId: "default",
|
|
91
91
|
node: dsihProp
|
|
92
92
|
});
|
|
93
93
|
} };
|
|
@@ -100,7 +100,7 @@ var no_dangerously_set_innerhtml_with_children_default = createRule({
|
|
|
100
100
|
meta: {
|
|
101
101
|
type: "problem",
|
|
102
102
|
docs: { description: "Disallows DOM elements from using 'dangerouslySetInnerHTML' and 'children' at the same time." },
|
|
103
|
-
messages: {
|
|
103
|
+
messages: { default: "A DOM component cannot use both children and 'dangerouslySetInnerHTML'." },
|
|
104
104
|
schema: []
|
|
105
105
|
},
|
|
106
106
|
name: RULE_NAME$16,
|
|
@@ -125,7 +125,7 @@ function create$16(context) {
|
|
|
125
125
|
const childrenPropOrNode = findJsxAttribute("children") ?? node.children.find(isSignificantChildren);
|
|
126
126
|
if (childrenPropOrNode == null) return;
|
|
127
127
|
context.report({
|
|
128
|
-
messageId: "
|
|
128
|
+
messageId: "default",
|
|
129
129
|
node: childrenPropOrNode
|
|
130
130
|
});
|
|
131
131
|
} };
|
|
@@ -138,7 +138,7 @@ var no_find_dom_node_default = createRule({
|
|
|
138
138
|
meta: {
|
|
139
139
|
type: "problem",
|
|
140
140
|
docs: { description: "Disallows 'findDOMNode'." },
|
|
141
|
-
messages: {
|
|
141
|
+
messages: { default: "[Deprecated] Use alternatives instead." },
|
|
142
142
|
schema: []
|
|
143
143
|
},
|
|
144
144
|
name: RULE_NAME$15,
|
|
@@ -153,13 +153,13 @@ function create$15(context) {
|
|
|
153
153
|
switch (callee.type) {
|
|
154
154
|
case AST_NODE_TYPES.Identifier:
|
|
155
155
|
if (callee.name === findDOMNode) context.report({
|
|
156
|
-
messageId: "
|
|
156
|
+
messageId: "default",
|
|
157
157
|
node
|
|
158
158
|
});
|
|
159
159
|
return;
|
|
160
160
|
case AST_NODE_TYPES.MemberExpression:
|
|
161
161
|
if (callee.property.type === AST_NODE_TYPES.Identifier && callee.property.name === findDOMNode) context.report({
|
|
162
|
-
messageId: "
|
|
162
|
+
messageId: "default",
|
|
163
163
|
node
|
|
164
164
|
});
|
|
165
165
|
return;
|
|
@@ -174,7 +174,7 @@ var no_flush_sync_default = createRule({
|
|
|
174
174
|
meta: {
|
|
175
175
|
type: "problem",
|
|
176
176
|
docs: { description: "Disallows 'flushSync'." },
|
|
177
|
-
messages: {
|
|
177
|
+
messages: { default: "Using 'flushSync' is uncommon and can hurt the performance of your app." },
|
|
178
178
|
schema: []
|
|
179
179
|
},
|
|
180
180
|
name: RULE_NAME$14,
|
|
@@ -189,13 +189,13 @@ function create$14(context) {
|
|
|
189
189
|
switch (callee.type) {
|
|
190
190
|
case AST_NODE_TYPES.Identifier:
|
|
191
191
|
if (callee.name === flushSync) context.report({
|
|
192
|
-
messageId: "
|
|
192
|
+
messageId: "default",
|
|
193
193
|
node
|
|
194
194
|
});
|
|
195
195
|
return;
|
|
196
196
|
case AST_NODE_TYPES.MemberExpression:
|
|
197
197
|
if (callee.property.type === AST_NODE_TYPES.Identifier && callee.property.name === flushSync) context.report({
|
|
198
|
-
messageId: "
|
|
198
|
+
messageId: "default",
|
|
199
199
|
node
|
|
200
200
|
});
|
|
201
201
|
return;
|
|
@@ -211,7 +211,7 @@ var no_hydrate_default = createRule({
|
|
|
211
211
|
type: "problem",
|
|
212
212
|
docs: { description: "Replaces usage of 'ReactDOM.hydrate()' with 'hydrateRoot()'." },
|
|
213
213
|
fixable: "code",
|
|
214
|
-
messages: {
|
|
214
|
+
messages: { default: "[Deprecated] Use 'hydrateRoot()' instead." },
|
|
215
215
|
schema: []
|
|
216
216
|
},
|
|
217
217
|
name: RULE_NAME$13,
|
|
@@ -229,14 +229,14 @@ function create$13(context) {
|
|
|
229
229
|
switch (true) {
|
|
230
230
|
case node.callee.type === AST_NODE_TYPES.Identifier && hydrateNames.has(node.callee.name):
|
|
231
231
|
context.report({
|
|
232
|
-
messageId: "
|
|
232
|
+
messageId: "default",
|
|
233
233
|
node,
|
|
234
234
|
fix: getFix$2(context, node)
|
|
235
235
|
});
|
|
236
236
|
return;
|
|
237
237
|
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):
|
|
238
238
|
context.report({
|
|
239
|
-
messageId: "
|
|
239
|
+
messageId: "default",
|
|
240
240
|
node,
|
|
241
241
|
fix: getFix$2(context, node)
|
|
242
242
|
});
|
|
@@ -371,7 +371,7 @@ var no_namespace_default = createRule({
|
|
|
371
371
|
meta: {
|
|
372
372
|
type: "problem",
|
|
373
373
|
docs: { description: "Enforces the absence of a 'namespace' in React elements." },
|
|
374
|
-
messages: {
|
|
374
|
+
messages: { default: "A React component '{{name}}' must not be in a namespace, as React does not support them." },
|
|
375
375
|
schema: []
|
|
376
376
|
},
|
|
377
377
|
name: RULE_NAME$10,
|
|
@@ -383,7 +383,7 @@ function create$10(context) {
|
|
|
383
383
|
const name = core.getJsxElementType(context, node);
|
|
384
384
|
if (typeof name !== "string" || !name.includes(":")) return;
|
|
385
385
|
context.report({
|
|
386
|
-
messageId: "
|
|
386
|
+
messageId: "default",
|
|
387
387
|
node: node.openingElement.name,
|
|
388
388
|
data: { name }
|
|
389
389
|
});
|
|
@@ -398,7 +398,7 @@ var no_render_default = createRule({
|
|
|
398
398
|
type: "problem",
|
|
399
399
|
docs: { description: "Replaces usage of 'ReactDOM.render()' with 'createRoot(node).render()'." },
|
|
400
400
|
fixable: "code",
|
|
401
|
-
messages: {
|
|
401
|
+
messages: { default: "[Deprecated] Use 'createRoot(node).render()' instead." },
|
|
402
402
|
schema: []
|
|
403
403
|
},
|
|
404
404
|
name: RULE_NAME$9,
|
|
@@ -415,14 +415,14 @@ function create$9(context) {
|
|
|
415
415
|
switch (true) {
|
|
416
416
|
case node.callee.type === AST_NODE_TYPES.Identifier && renderNames.has(node.callee.name):
|
|
417
417
|
context.report({
|
|
418
|
-
messageId: "
|
|
418
|
+
messageId: "default",
|
|
419
419
|
node,
|
|
420
420
|
fix: getFix$1(context, node)
|
|
421
421
|
});
|
|
422
422
|
return;
|
|
423
423
|
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):
|
|
424
424
|
context.report({
|
|
425
|
-
messageId: "
|
|
425
|
+
messageId: "default",
|
|
426
426
|
node,
|
|
427
427
|
fix: getFix$1(context, node)
|
|
428
428
|
});
|
|
@@ -474,7 +474,7 @@ var no_render_return_value_default = createRule({
|
|
|
474
474
|
meta: {
|
|
475
475
|
type: "problem",
|
|
476
476
|
docs: { description: "Disallows the return value of 'ReactDOM.render'." },
|
|
477
|
-
messages: {
|
|
477
|
+
messages: { default: "Do not depend on the return value from 'ReactDOM.render'." },
|
|
478
478
|
schema: []
|
|
479
479
|
},
|
|
480
480
|
name: RULE_NAME$8,
|
|
@@ -489,13 +489,13 @@ function create$8(context) {
|
|
|
489
489
|
switch (true) {
|
|
490
490
|
case node.callee.type === AST_NODE_TYPES.Identifier && renderNames.has(node.callee.name) && banParentTypes.includes(node.parent.type):
|
|
491
491
|
context.report({
|
|
492
|
-
messageId: "
|
|
492
|
+
messageId: "default",
|
|
493
493
|
node
|
|
494
494
|
});
|
|
495
495
|
return;
|
|
496
496
|
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) && banParentTypes.includes(node.parent.type):
|
|
497
497
|
context.report({
|
|
498
|
-
messageId: "
|
|
498
|
+
messageId: "default",
|
|
499
499
|
node
|
|
500
500
|
});
|
|
501
501
|
return;
|
|
@@ -525,7 +525,7 @@ var no_script_url_default = createRule({
|
|
|
525
525
|
meta: {
|
|
526
526
|
type: "problem",
|
|
527
527
|
docs: { description: "Disallows 'javascript:' URLs as attribute values." },
|
|
528
|
-
messages: {
|
|
528
|
+
messages: { default: "Using a `javascript:` URL is a security risk and should be avoided." },
|
|
529
529
|
schema: []
|
|
530
530
|
},
|
|
531
531
|
name: RULE_NAME$7,
|
|
@@ -537,7 +537,7 @@ function create$7(context) {
|
|
|
537
537
|
if (node.name.type !== AST_NODE_TYPES.JSXIdentifier || node.value == null) return;
|
|
538
538
|
const value = core.resolveJsxAttributeValue(context, node).toStatic();
|
|
539
539
|
if (typeof value === "string" && RE_JAVASCRIPT_PROTOCOL.test(value)) context.report({
|
|
540
|
-
messageId: "
|
|
540
|
+
messageId: "default",
|
|
541
541
|
node: node.value
|
|
542
542
|
});
|
|
543
543
|
} };
|
|
@@ -550,7 +550,7 @@ var no_string_style_prop_default = createRule({
|
|
|
550
550
|
meta: {
|
|
551
551
|
type: "problem",
|
|
552
552
|
docs: { description: "Disallows the use of string style prop in JSX. Use an object instead." },
|
|
553
|
-
messages: {
|
|
553
|
+
messages: { default: "Do not use string style prop. Use an object instead." },
|
|
554
554
|
schema: []
|
|
555
555
|
},
|
|
556
556
|
name: RULE_NAME$6,
|
|
@@ -564,7 +564,7 @@ function create$6(context) {
|
|
|
564
564
|
if (styleProp == null) return;
|
|
565
565
|
const styleValue = core.resolveJsxAttributeValue(context, styleProp);
|
|
566
566
|
if (typeof styleValue.toStatic() === "string") context.report({
|
|
567
|
-
messageId: "
|
|
567
|
+
messageId: "default",
|
|
568
568
|
node: styleValue.node ?? styleProp
|
|
569
569
|
});
|
|
570
570
|
} };
|
|
@@ -1723,7 +1723,7 @@ var no_unsafe_iframe_sandbox_default = createRule({
|
|
|
1723
1723
|
meta: {
|
|
1724
1724
|
type: "problem",
|
|
1725
1725
|
docs: { description: "Enforces that the 'sandbox' attribute for 'iframe' elements is not set to unsafe combinations." },
|
|
1726
|
-
messages: {
|
|
1726
|
+
messages: { default: "Unsafe 'sandbox' attribute value on 'iframe' component." },
|
|
1727
1727
|
schema: []
|
|
1728
1728
|
},
|
|
1729
1729
|
name: RULE_NAME$4,
|
|
@@ -1738,7 +1738,7 @@ function create$4(context) {
|
|
|
1738
1738
|
if (sandboxProp == null) return;
|
|
1739
1739
|
const sandboxValue = core.resolveJsxAttributeValue(context, sandboxProp);
|
|
1740
1740
|
if (isUnsafeSandboxCombination(sandboxValue.toStatic("sandbox"))) context.report({
|
|
1741
|
-
messageId: "
|
|
1741
|
+
messageId: "default",
|
|
1742
1742
|
node: sandboxValue.node ?? sandboxProp
|
|
1743
1743
|
});
|
|
1744
1744
|
} };
|
|
@@ -1775,7 +1775,7 @@ var no_unsafe_target_blank_default = createRule({
|
|
|
1775
1775
|
hasSuggestions: true,
|
|
1776
1776
|
messages: {
|
|
1777
1777
|
addRelNoreferrerNoopener: `Add 'rel="noreferrer noopener"' to the link to prevent security risks.`,
|
|
1778
|
-
|
|
1778
|
+
default: `Using 'target="_blank"' on an external link without 'rel="noreferrer noopener"' is a security risk.`
|
|
1779
1779
|
},
|
|
1780
1780
|
schema: []
|
|
1781
1781
|
},
|
|
@@ -1798,7 +1798,7 @@ function create$3(context) {
|
|
|
1798
1798
|
const relProp = findAttribute("rel");
|
|
1799
1799
|
if (relProp == null) {
|
|
1800
1800
|
context.report({
|
|
1801
|
-
messageId: "
|
|
1801
|
+
messageId: "default",
|
|
1802
1802
|
node: node.openingElement,
|
|
1803
1803
|
suggest: [{
|
|
1804
1804
|
messageId: "addRelNoreferrerNoopener",
|
|
@@ -1811,7 +1811,7 @@ function create$3(context) {
|
|
|
1811
1811
|
}
|
|
1812
1812
|
if (isSafeRel(core.resolveJsxAttributeValue(context, relProp).toStatic("rel"))) return;
|
|
1813
1813
|
context.report({
|
|
1814
|
-
messageId: "
|
|
1814
|
+
messageId: "default",
|
|
1815
1815
|
node: relProp,
|
|
1816
1816
|
suggest: [{
|
|
1817
1817
|
messageId: "addRelNoreferrerNoopener",
|
|
@@ -1831,7 +1831,7 @@ var no_use_form_state_default = createRule({
|
|
|
1831
1831
|
type: "problem",
|
|
1832
1832
|
docs: { description: "Replaces usage of 'useFormState' with 'useActionState'." },
|
|
1833
1833
|
fixable: "code",
|
|
1834
|
-
messages: {
|
|
1834
|
+
messages: { default: "[Deprecated] Use 'useActionState' from 'react' package instead." },
|
|
1835
1835
|
schema: []
|
|
1836
1836
|
},
|
|
1837
1837
|
name: RULE_NAME$2,
|
|
@@ -1848,14 +1848,14 @@ function create$2(context) {
|
|
|
1848
1848
|
switch (true) {
|
|
1849
1849
|
case node.callee.type === AST_NODE_TYPES.Identifier && useFormStateNames.has(node.callee.name):
|
|
1850
1850
|
context.report({
|
|
1851
|
-
messageId: "
|
|
1851
|
+
messageId: "default",
|
|
1852
1852
|
node,
|
|
1853
1853
|
fix: getFix(context, node)
|
|
1854
1854
|
});
|
|
1855
1855
|
return;
|
|
1856
1856
|
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):
|
|
1857
1857
|
context.report({
|
|
1858
|
-
messageId: "
|
|
1858
|
+
messageId: "default",
|
|
1859
1859
|
node,
|
|
1860
1860
|
fix: getFix(context, node)
|
|
1861
1861
|
});
|
|
@@ -1910,7 +1910,7 @@ var no_void_elements_with_children_default = createRule({
|
|
|
1910
1910
|
meta: {
|
|
1911
1911
|
type: "problem",
|
|
1912
1912
|
docs: { description: "Disallows 'children' in void DOM elements." },
|
|
1913
|
-
messages: {
|
|
1913
|
+
messages: { default: "'{{elementType}}' is a void element tag and must not have children." },
|
|
1914
1914
|
schema: []
|
|
1915
1915
|
},
|
|
1916
1916
|
name: RULE_NAME$1,
|
|
@@ -1926,7 +1926,7 @@ function create$1(context) {
|
|
|
1926
1926
|
const hasChildrenProp = findJsxAttribute("children") != null;
|
|
1927
1927
|
const hasDangerouslySetInnerHTML = findJsxAttribute("dangerouslySetInnerHTML") != null;
|
|
1928
1928
|
if (node.children.length > 0 || hasChildrenProp || hasDangerouslySetInnerHTML) context.report({
|
|
1929
|
-
messageId: "
|
|
1929
|
+
messageId: "default",
|
|
1930
1930
|
node,
|
|
1931
1931
|
data: { elementType: domElementType }
|
|
1932
1932
|
});
|
|
@@ -1941,7 +1941,7 @@ var prefer_namespace_import_default = createRule({
|
|
|
1941
1941
|
type: "problem",
|
|
1942
1942
|
docs: { description: "Enforces importing React DOM via a namespace import." },
|
|
1943
1943
|
fixable: "code",
|
|
1944
|
-
messages: {
|
|
1944
|
+
messages: { default: "Prefer importing React DOM via a namespace import." },
|
|
1945
1945
|
schema: []
|
|
1946
1946
|
},
|
|
1947
1947
|
name: RULE_NAME,
|
|
@@ -1959,7 +1959,7 @@ function create(context) {
|
|
|
1959
1959
|
if (!importSources.includes(importSource)) return;
|
|
1960
1960
|
const hasOtherSpecifiers = node.parent.specifiers.length > 1;
|
|
1961
1961
|
context.report({
|
|
1962
|
-
messageId: "
|
|
1962
|
+
messageId: "default",
|
|
1963
1963
|
node: hasOtherSpecifiers ? node : node.parent,
|
|
1964
1964
|
data: { importSource },
|
|
1965
1965
|
fix(fixer) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-dom",
|
|
3
|
-
"version": "2.8.2-next.
|
|
3
|
+
"version": "2.8.2-next.6",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for React DOM related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -42,13 +42,12 @@
|
|
|
42
42
|
"@typescript-eslint/types": "^8.54.0",
|
|
43
43
|
"@typescript-eslint/utils": "^8.54.0",
|
|
44
44
|
"compare-versions": "^6.1.1",
|
|
45
|
-
"string-ts": "^2.3.1",
|
|
46
45
|
"ts-pattern": "^5.9.0",
|
|
47
|
-
"@eslint-react/
|
|
48
|
-
"@eslint-react/eff": "2.8.2-next.
|
|
49
|
-
"@eslint-react/
|
|
50
|
-
"@eslint-react/
|
|
51
|
-
"@eslint-react/
|
|
46
|
+
"@eslint-react/core": "2.8.2-next.6",
|
|
47
|
+
"@eslint-react/eff": "2.8.2-next.6",
|
|
48
|
+
"@eslint-react/ast": "2.8.2-next.6",
|
|
49
|
+
"@eslint-react/shared": "2.8.2-next.6",
|
|
50
|
+
"@eslint-react/var": "2.8.2-next.6"
|
|
52
51
|
},
|
|
53
52
|
"devDependencies": {
|
|
54
53
|
"@types/react": "^19.2.10",
|