eslint-plugin-react-dom 5.8.12 → 5.8.13
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 +34 -34
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_ESLINT_REACT_SETTINGS, RE_JAVASCRIPT_PROTOCOL, getSettingsFromContext } from "@eslint-react/shared";
|
|
2
2
|
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
3
|
-
import
|
|
3
|
+
import "@eslint-react/eslint";
|
|
4
4
|
import { findAttribute, getAttributeStaticValue, getElementFullType, hasAnyAttribute, hasAttribute, isHostElement, isWhitespace, resolveAttributeValue } from "@eslint-react/jsx";
|
|
5
5
|
import { AST_NODE_TYPES } from "@typescript-eslint/types";
|
|
6
6
|
import { Check, Extract } from "@eslint-react/ast";
|
|
@@ -25,7 +25,7 @@ var __exportAll = (all, no_symbols) => {
|
|
|
25
25
|
//#endregion
|
|
26
26
|
//#region package.json
|
|
27
27
|
var name$2 = "eslint-plugin-react-dom";
|
|
28
|
-
var version = "5.8.
|
|
28
|
+
var version = "5.8.13";
|
|
29
29
|
|
|
30
30
|
//#endregion
|
|
31
31
|
//#region src/utils/create-rule.ts
|
|
@@ -51,7 +51,7 @@ var no_dangerously_set_innerhtml_with_children_default = createRule({
|
|
|
51
51
|
const DSIH$1 = "dangerouslySetInnerHTML";
|
|
52
52
|
function create$15(context) {
|
|
53
53
|
if (!context.sourceCode.text.includes(DSIH$1)) return {};
|
|
54
|
-
return
|
|
54
|
+
return { JSXElement(node) {
|
|
55
55
|
if (!hasAttribute(context, node, DSIH$1)) return;
|
|
56
56
|
const childrenPropOrNode = findAttribute(context, node, "children") ?? node.children.find((child) => !isWhitespace(child));
|
|
57
57
|
if (childrenPropOrNode == null) return;
|
|
@@ -59,7 +59,7 @@ function create$15(context) {
|
|
|
59
59
|
messageId: "default",
|
|
60
60
|
node: childrenPropOrNode
|
|
61
61
|
});
|
|
62
|
-
} }
|
|
62
|
+
} };
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
//#endregion
|
|
@@ -79,14 +79,14 @@ var no_dangerously_set_innerhtml_default = createRule({
|
|
|
79
79
|
});
|
|
80
80
|
function create$14(context) {
|
|
81
81
|
if (!context.sourceCode.text.includes(DSIH)) return {};
|
|
82
|
-
return
|
|
82
|
+
return { JSXElement(node) {
|
|
83
83
|
const dsihProp = findAttribute(context, node, DSIH);
|
|
84
84
|
if (dsihProp == null) return;
|
|
85
85
|
context.report({
|
|
86
86
|
messageId: "default",
|
|
87
87
|
node: dsihProp
|
|
88
88
|
});
|
|
89
|
-
} }
|
|
89
|
+
} };
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
//#endregion
|
|
@@ -106,7 +106,7 @@ var no_find_dom_node_default = createRule({
|
|
|
106
106
|
const findDOMNode = "findDOMNode";
|
|
107
107
|
function create$13(context) {
|
|
108
108
|
if (!context.sourceCode.text.includes(findDOMNode)) return {};
|
|
109
|
-
return
|
|
109
|
+
return { CallExpression(node) {
|
|
110
110
|
const { callee } = node;
|
|
111
111
|
switch (callee.type) {
|
|
112
112
|
case AST_NODE_TYPES.Identifier:
|
|
@@ -122,7 +122,7 @@ function create$13(context) {
|
|
|
122
122
|
});
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
125
|
-
} }
|
|
125
|
+
} };
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
//#endregion
|
|
@@ -142,7 +142,7 @@ var no_flush_sync_default = createRule({
|
|
|
142
142
|
const flushSync = "flushSync";
|
|
143
143
|
function create$12(context) {
|
|
144
144
|
if (!context.sourceCode.text.includes(flushSync)) return {};
|
|
145
|
-
return
|
|
145
|
+
return { CallExpression(node) {
|
|
146
146
|
const { callee } = node;
|
|
147
147
|
switch (callee.type) {
|
|
148
148
|
case AST_NODE_TYPES.Identifier:
|
|
@@ -158,7 +158,7 @@ function create$12(context) {
|
|
|
158
158
|
});
|
|
159
159
|
return;
|
|
160
160
|
}
|
|
161
|
-
} }
|
|
161
|
+
} };
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
//#endregion
|
|
@@ -182,7 +182,7 @@ function create$11(context) {
|
|
|
182
182
|
if (compare(getSettingsFromContext(context).version, "18.0.0", "<")) return {};
|
|
183
183
|
const reactDomNames = /* @__PURE__ */ new Set();
|
|
184
184
|
const hydrateNames = /* @__PURE__ */ new Set();
|
|
185
|
-
return
|
|
185
|
+
return {
|
|
186
186
|
CallExpression(node) {
|
|
187
187
|
const callee = Extract.unwrap(node.callee);
|
|
188
188
|
switch (true) {
|
|
@@ -216,7 +216,7 @@ function create$11(context) {
|
|
|
216
216
|
continue;
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
|
-
}
|
|
219
|
+
};
|
|
220
220
|
}
|
|
221
221
|
function getFix$2(context, node) {
|
|
222
222
|
const getText = (n) => context.sourceCode.getText(n);
|
|
@@ -290,7 +290,7 @@ var no_missing_button_type_default = createRule({
|
|
|
290
290
|
});
|
|
291
291
|
function create$10(context) {
|
|
292
292
|
const resolver = createJsxElementResolver(context);
|
|
293
|
-
return
|
|
293
|
+
return { JSXElement(node) {
|
|
294
294
|
if (resolver.resolve(node).domElementType !== "button") return;
|
|
295
295
|
if (hasAttribute(context, node, "type")) return;
|
|
296
296
|
context.report({
|
|
@@ -302,7 +302,7 @@ function create$10(context) {
|
|
|
302
302
|
messageId: "addTypeAttribute"
|
|
303
303
|
}))
|
|
304
304
|
});
|
|
305
|
-
} }
|
|
305
|
+
} };
|
|
306
306
|
}
|
|
307
307
|
|
|
308
308
|
//#endregion
|
|
@@ -326,7 +326,7 @@ var no_missing_iframe_sandbox_default = createRule({
|
|
|
326
326
|
});
|
|
327
327
|
function create$9(context) {
|
|
328
328
|
const resolver = createJsxElementResolver(context);
|
|
329
|
-
return
|
|
329
|
+
return { JSXElement(node) {
|
|
330
330
|
const { domElementType } = resolver.resolve(node);
|
|
331
331
|
if (domElementType !== "iframe") return;
|
|
332
332
|
const sandboxProp = findAttribute(context, node, "sandbox");
|
|
@@ -359,7 +359,7 @@ function create$9(context) {
|
|
|
359
359
|
messageId: "addSandboxAttribute"
|
|
360
360
|
}]
|
|
361
361
|
});
|
|
362
|
-
} }
|
|
362
|
+
} };
|
|
363
363
|
}
|
|
364
364
|
|
|
365
365
|
//#endregion
|
|
@@ -391,7 +391,7 @@ var no_render_return_value_default = createRule({
|
|
|
391
391
|
function create$8(context) {
|
|
392
392
|
const reactDomNames = new Set(["ReactDOM", "ReactDOM"]);
|
|
393
393
|
const renderNames = /* @__PURE__ */ new Set();
|
|
394
|
-
return
|
|
394
|
+
return {
|
|
395
395
|
CallExpression(node) {
|
|
396
396
|
const callee = Extract.unwrap(node.callee);
|
|
397
397
|
switch (true) {
|
|
@@ -423,7 +423,7 @@ function create$8(context) {
|
|
|
423
423
|
continue;
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
|
-
}
|
|
426
|
+
};
|
|
427
427
|
}
|
|
428
428
|
|
|
429
429
|
//#endregion
|
|
@@ -446,7 +446,7 @@ function create$7(context) {
|
|
|
446
446
|
if (compare(getSettingsFromContext(context).version, "18.0.0", "<")) return {};
|
|
447
447
|
const reactDomNames = new Set(["ReactDOM", "ReactDOM"]);
|
|
448
448
|
const renderNames = /* @__PURE__ */ new Set();
|
|
449
|
-
return
|
|
449
|
+
return {
|
|
450
450
|
CallExpression(node) {
|
|
451
451
|
const callee = Extract.unwrap(node.callee);
|
|
452
452
|
switch (true) {
|
|
@@ -480,7 +480,7 @@ function create$7(context) {
|
|
|
480
480
|
continue;
|
|
481
481
|
}
|
|
482
482
|
}
|
|
483
|
-
}
|
|
483
|
+
};
|
|
484
484
|
}
|
|
485
485
|
/**
|
|
486
486
|
* Provides a fixer function to replace `render(app, container)` with `createRoot(container).render(app)`
|
|
@@ -512,14 +512,14 @@ var no_script_url_default = createRule({
|
|
|
512
512
|
defaultOptions: []
|
|
513
513
|
});
|
|
514
514
|
function create$6(context) {
|
|
515
|
-
return
|
|
515
|
+
return { JSXAttribute(node) {
|
|
516
516
|
if (node.name.type !== AST_NODE_TYPES.JSXIdentifier || node.value == null) return;
|
|
517
517
|
const value = resolveAttributeValue(context, node).toStatic();
|
|
518
518
|
if (typeof value === "string" && RE_JAVASCRIPT_PROTOCOL.test(value)) context.report({
|
|
519
519
|
messageId: "default",
|
|
520
520
|
node: node.value
|
|
521
521
|
});
|
|
522
|
-
} }
|
|
522
|
+
} };
|
|
523
523
|
}
|
|
524
524
|
|
|
525
525
|
//#endregion
|
|
@@ -537,7 +537,7 @@ var no_string_style_prop_default = createRule({
|
|
|
537
537
|
defaultOptions: []
|
|
538
538
|
});
|
|
539
539
|
function create$5(context) {
|
|
540
|
-
return
|
|
540
|
+
return { JSXElement(node) {
|
|
541
541
|
if (!isHostElement(node)) return;
|
|
542
542
|
const styleProp = findAttribute(context, node, "style");
|
|
543
543
|
if (styleProp == null) return;
|
|
@@ -546,7 +546,7 @@ function create$5(context) {
|
|
|
546
546
|
messageId: "default",
|
|
547
547
|
node: styleValue.node ?? styleProp
|
|
548
548
|
});
|
|
549
|
-
} }
|
|
549
|
+
} };
|
|
550
550
|
}
|
|
551
551
|
|
|
552
552
|
//#endregion
|
|
@@ -1652,7 +1652,7 @@ function create$4(context) {
|
|
|
1652
1652
|
function getRequireDataLowercase() {
|
|
1653
1653
|
return context.options[0]?.requireDataLowercase ?? DEFAULTS.requireDataLowercase;
|
|
1654
1654
|
}
|
|
1655
|
-
return
|
|
1655
|
+
return { JSXAttribute(node) {
|
|
1656
1656
|
const ignoreNames = getIgnoreConfig();
|
|
1657
1657
|
const actualName = getText(context, node.name);
|
|
1658
1658
|
if (ignoreNames.includes(actualName)) return;
|
|
@@ -1709,7 +1709,7 @@ function create$4(context) {
|
|
|
1709
1709
|
messageId: "unknownProp",
|
|
1710
1710
|
node
|
|
1711
1711
|
});
|
|
1712
|
-
} }
|
|
1712
|
+
} };
|
|
1713
1713
|
}
|
|
1714
1714
|
|
|
1715
1715
|
//#endregion
|
|
@@ -1743,7 +1743,7 @@ var no_unsafe_iframe_sandbox_default = createRule({
|
|
|
1743
1743
|
});
|
|
1744
1744
|
function create$3(context) {
|
|
1745
1745
|
const resolver = createJsxElementResolver(context);
|
|
1746
|
-
return
|
|
1746
|
+
return { JSXElement(node) {
|
|
1747
1747
|
if (resolver.resolve(node).domElementType !== "iframe") return;
|
|
1748
1748
|
const sandboxProp = findAttribute(context, node, "sandbox");
|
|
1749
1749
|
if (sandboxProp == null) return;
|
|
@@ -1752,7 +1752,7 @@ function create$3(context) {
|
|
|
1752
1752
|
messageId: "default",
|
|
1753
1753
|
node: sandboxValue.node ?? sandboxProp
|
|
1754
1754
|
});
|
|
1755
|
-
} }
|
|
1755
|
+
} };
|
|
1756
1756
|
}
|
|
1757
1757
|
|
|
1758
1758
|
//#endregion
|
|
@@ -1799,7 +1799,7 @@ var no_unsafe_target_blank_default = createRule({
|
|
|
1799
1799
|
});
|
|
1800
1800
|
function create$2(context) {
|
|
1801
1801
|
const resolver = createJsxElementResolver(context);
|
|
1802
|
-
return
|
|
1802
|
+
return { JSXElement(node) {
|
|
1803
1803
|
const { domElementType } = resolver.resolve(node);
|
|
1804
1804
|
if (domElementType !== "a") return;
|
|
1805
1805
|
if (getAttributeStaticValue(context, node, "target") !== "_blank") return;
|
|
@@ -1829,7 +1829,7 @@ function create$2(context) {
|
|
|
1829
1829
|
messageId: "addRelNoreferrerNoopener"
|
|
1830
1830
|
}]
|
|
1831
1831
|
});
|
|
1832
|
-
} }
|
|
1832
|
+
} };
|
|
1833
1833
|
}
|
|
1834
1834
|
|
|
1835
1835
|
//#endregion
|
|
@@ -1852,7 +1852,7 @@ function create$1(context) {
|
|
|
1852
1852
|
if (compare(getSettingsFromContext(context).version, "19.0.0", "<")) return {};
|
|
1853
1853
|
const reactDomNames = /* @__PURE__ */ new Set();
|
|
1854
1854
|
const useFormStateNames = /* @__PURE__ */ new Set();
|
|
1855
|
-
return
|
|
1855
|
+
return {
|
|
1856
1856
|
CallExpression(node) {
|
|
1857
1857
|
const callee = Extract.unwrap(node.callee);
|
|
1858
1858
|
switch (true) {
|
|
@@ -1886,7 +1886,7 @@ function create$1(context) {
|
|
|
1886
1886
|
continue;
|
|
1887
1887
|
}
|
|
1888
1888
|
}
|
|
1889
|
-
}
|
|
1889
|
+
};
|
|
1890
1890
|
}
|
|
1891
1891
|
function getFix(context, node) {
|
|
1892
1892
|
const { importSource } = getSettingsFromContext(context);
|
|
@@ -1932,7 +1932,7 @@ var no_void_elements_with_children_default = createRule({
|
|
|
1932
1932
|
});
|
|
1933
1933
|
function create(context) {
|
|
1934
1934
|
const resolver = createJsxElementResolver(context);
|
|
1935
|
-
return
|
|
1935
|
+
return { JSXElement(node) {
|
|
1936
1936
|
const { domElementType } = resolver.resolve(node);
|
|
1937
1937
|
if (!VOID_ELEMENTS.has(domElementType)) return;
|
|
1938
1938
|
if (node.children.length > 0 || hasAnyAttribute(context, node, ["children", "dangerouslySetInnerHTML"])) context.report({
|
|
@@ -1940,7 +1940,7 @@ function create(context) {
|
|
|
1940
1940
|
messageId: "default",
|
|
1941
1941
|
node
|
|
1942
1942
|
});
|
|
1943
|
-
} }
|
|
1943
|
+
} };
|
|
1944
1944
|
}
|
|
1945
1945
|
|
|
1946
1946
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-dom",
|
|
3
|
-
"version": "5.8.
|
|
3
|
+
"version": "5.8.13",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for DOM related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -40,17 +40,17 @@
|
|
|
40
40
|
"@typescript-eslint/types": "^8.60.1",
|
|
41
41
|
"@typescript-eslint/utils": "^8.60.1",
|
|
42
42
|
"compare-versions": "^6.1.1",
|
|
43
|
-
"@eslint-react/ast": "5.8.
|
|
44
|
-
"@eslint-react/eslint": "5.8.
|
|
45
|
-
"@eslint-react/jsx": "5.8.
|
|
46
|
-
"@eslint-react/shared": "5.8.
|
|
43
|
+
"@eslint-react/ast": "5.8.13",
|
|
44
|
+
"@eslint-react/eslint": "5.8.13",
|
|
45
|
+
"@eslint-react/jsx": "5.8.13",
|
|
46
|
+
"@eslint-react/shared": "5.8.13"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/react": "^19.2.16",
|
|
50
50
|
"@types/react-dom": "^19.2.3",
|
|
51
51
|
"dedent": "^1.7.2",
|
|
52
52
|
"eslint": "^10.4.1",
|
|
53
|
-
"tsdown": "^0.22.
|
|
53
|
+
"tsdown": "^0.22.2",
|
|
54
54
|
"typescript": "6.0.3",
|
|
55
55
|
"@local/configs": "0.0.0",
|
|
56
56
|
"@local/eff": "0.0.0"
|