eslint-plugin-react-dom 5.1.0-beta.0 → 5.1.0-beta.1
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 +19 -18
- package/package.json +7 -6
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { DEFAULT_ESLINT_REACT_SETTINGS, RE_JAVASCRIPT_PROTOCOL,
|
|
1
|
+
import { DEFAULT_ESLINT_REACT_SETTINGS, RE_JAVASCRIPT_PROTOCOL, getSettingsFromContext } from "@eslint-react/shared";
|
|
2
|
+
import { merge } from "@eslint-react/eslint";
|
|
2
3
|
import { findAttribute, getAttributeStaticValue, getElementFullType, hasAnyAttribute, hasAttribute, isHostElement, isWhitespace, resolveAttributeValue } from "@eslint-react/jsx";
|
|
3
4
|
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
4
5
|
import { AST_NODE_TYPES } from "@typescript-eslint/types";
|
|
@@ -23,7 +24,7 @@ var __exportAll = (all, no_symbols) => {
|
|
|
23
24
|
//#endregion
|
|
24
25
|
//#region package.json
|
|
25
26
|
var name$2 = "eslint-plugin-react-dom";
|
|
26
|
-
var version = "5.1.0-beta.
|
|
27
|
+
var version = "5.1.0-beta.1";
|
|
27
28
|
|
|
28
29
|
//#endregion
|
|
29
30
|
//#region src/utils/create-jsx-element-resolver.ts
|
|
@@ -80,7 +81,7 @@ var no_dangerously_set_innerhtml_with_children_default = createRule({
|
|
|
80
81
|
const DSIH$1 = "dangerouslySetInnerHTML";
|
|
81
82
|
function create$15(context) {
|
|
82
83
|
if (!context.sourceCode.text.includes(DSIH$1)) return {};
|
|
83
|
-
return
|
|
84
|
+
return merge({ JSXElement(node) {
|
|
84
85
|
if (!hasAttribute(context, node, DSIH$1)) return;
|
|
85
86
|
const childrenPropOrNode = findAttribute(context, node, "children") ?? node.children.find((child) => !isWhitespace(child));
|
|
86
87
|
if (childrenPropOrNode == null) return;
|
|
@@ -108,7 +109,7 @@ var no_dangerously_set_innerhtml_default = createRule({
|
|
|
108
109
|
});
|
|
109
110
|
function create$14(context) {
|
|
110
111
|
if (!context.sourceCode.text.includes(DSIH)) return {};
|
|
111
|
-
return
|
|
112
|
+
return merge({ JSXElement(node) {
|
|
112
113
|
const dsihProp = findAttribute(context, node, DSIH);
|
|
113
114
|
if (dsihProp == null) return;
|
|
114
115
|
context.report({
|
|
@@ -135,7 +136,7 @@ var no_find_dom_node_default = createRule({
|
|
|
135
136
|
const findDOMNode = "findDOMNode";
|
|
136
137
|
function create$13(context) {
|
|
137
138
|
if (!context.sourceCode.text.includes(findDOMNode)) return {};
|
|
138
|
-
return
|
|
139
|
+
return merge({ CallExpression(node) {
|
|
139
140
|
const { callee } = node;
|
|
140
141
|
switch (callee.type) {
|
|
141
142
|
case AST_NODE_TYPES.Identifier:
|
|
@@ -171,7 +172,7 @@ var no_flush_sync_default = createRule({
|
|
|
171
172
|
const flushSync = "flushSync";
|
|
172
173
|
function create$12(context) {
|
|
173
174
|
if (!context.sourceCode.text.includes(flushSync)) return {};
|
|
174
|
-
return
|
|
175
|
+
return merge({ CallExpression(node) {
|
|
175
176
|
const { callee } = node;
|
|
176
177
|
switch (callee.type) {
|
|
177
178
|
case AST_NODE_TYPES.Identifier:
|
|
@@ -211,7 +212,7 @@ function create$11(context) {
|
|
|
211
212
|
if (compare(getSettingsFromContext(context).version, "18.0.0", "<")) return {};
|
|
212
213
|
const reactDomNames = /* @__PURE__ */ new Set();
|
|
213
214
|
const hydrateNames = /* @__PURE__ */ new Set();
|
|
214
|
-
return
|
|
215
|
+
return merge({
|
|
215
216
|
CallExpression(node) {
|
|
216
217
|
switch (true) {
|
|
217
218
|
case node.callee.type === AST_NODE_TYPES.Identifier && hydrateNames.has(node.callee.name):
|
|
@@ -280,7 +281,7 @@ var no_missing_button_type_default = createRule({
|
|
|
280
281
|
});
|
|
281
282
|
function create$10(context) {
|
|
282
283
|
const resolver = createJsxElementResolver(context);
|
|
283
|
-
return
|
|
284
|
+
return merge({ JSXElement(node) {
|
|
284
285
|
if (resolver.resolve(node).domElementType !== "button") return;
|
|
285
286
|
if (hasAttribute(context, node, "type")) return;
|
|
286
287
|
context.report({
|
|
@@ -316,7 +317,7 @@ var no_missing_iframe_sandbox_default = createRule({
|
|
|
316
317
|
});
|
|
317
318
|
function create$9(context) {
|
|
318
319
|
const resolver = createJsxElementResolver(context);
|
|
319
|
-
return
|
|
320
|
+
return merge({ JSXElement(node) {
|
|
320
321
|
const { domElementType } = resolver.resolve(node);
|
|
321
322
|
if (domElementType !== "iframe") return;
|
|
322
323
|
const sandboxProp = findAttribute(context, node, "sandbox");
|
|
@@ -376,7 +377,7 @@ var no_render_return_value_default = createRule({
|
|
|
376
377
|
function create$8(context) {
|
|
377
378
|
const reactDomNames = new Set(["ReactDOM", "ReactDOM"]);
|
|
378
379
|
const renderNames = /* @__PURE__ */ new Set();
|
|
379
|
-
return
|
|
380
|
+
return merge({
|
|
380
381
|
CallExpression(node) {
|
|
381
382
|
switch (true) {
|
|
382
383
|
case node.callee.type === AST_NODE_TYPES.Identifier && renderNames.has(node.callee.name) && banParentTypes.includes(node.parent.type):
|
|
@@ -430,7 +431,7 @@ function create$7(context) {
|
|
|
430
431
|
if (compare(getSettingsFromContext(context).version, "18.0.0", "<")) return {};
|
|
431
432
|
const reactDomNames = new Set(["ReactDOM", "ReactDOM"]);
|
|
432
433
|
const renderNames = /* @__PURE__ */ new Set();
|
|
433
|
-
return
|
|
434
|
+
return merge({
|
|
434
435
|
CallExpression(node) {
|
|
435
436
|
switch (true) {
|
|
436
437
|
case node.callee.type === AST_NODE_TYPES.Identifier && renderNames.has(node.callee.name):
|
|
@@ -495,7 +496,7 @@ var no_script_url_default = createRule({
|
|
|
495
496
|
defaultOptions: []
|
|
496
497
|
});
|
|
497
498
|
function create$6(context) {
|
|
498
|
-
return
|
|
499
|
+
return merge({ JSXAttribute(node) {
|
|
499
500
|
if (node.name.type !== AST_NODE_TYPES.JSXIdentifier || node.value == null) return;
|
|
500
501
|
const value = resolveAttributeValue(context, node).toStatic();
|
|
501
502
|
if (typeof value === "string" && RE_JAVASCRIPT_PROTOCOL.test(value)) context.report({
|
|
@@ -520,7 +521,7 @@ var no_string_style_prop_default = createRule({
|
|
|
520
521
|
defaultOptions: []
|
|
521
522
|
});
|
|
522
523
|
function create$5(context) {
|
|
523
|
-
return
|
|
524
|
+
return merge({ JSXElement(node) {
|
|
524
525
|
if (!isHostElement(node)) return;
|
|
525
526
|
const styleProp = findAttribute(context, node, "style");
|
|
526
527
|
if (styleProp == null) return;
|
|
@@ -1608,7 +1609,7 @@ function create$4(context) {
|
|
|
1608
1609
|
function getRequireDataLowercase() {
|
|
1609
1610
|
return context.options[0]?.requireDataLowercase ?? DEFAULTS.requireDataLowercase;
|
|
1610
1611
|
}
|
|
1611
|
-
return
|
|
1612
|
+
return merge({ JSXAttribute(node) {
|
|
1612
1613
|
const ignoreNames = getIgnoreConfig();
|
|
1613
1614
|
const actualName = getText(context, node.name);
|
|
1614
1615
|
if (ignoreNames.includes(actualName)) return;
|
|
@@ -1695,7 +1696,7 @@ var no_unsafe_iframe_sandbox_default = createRule({
|
|
|
1695
1696
|
});
|
|
1696
1697
|
function create$3(context) {
|
|
1697
1698
|
const resolver = createJsxElementResolver(context);
|
|
1698
|
-
return
|
|
1699
|
+
return merge({ JSXElement(node) {
|
|
1699
1700
|
if (resolver.resolve(node).domElementType !== "iframe") return;
|
|
1700
1701
|
const sandboxProp = findAttribute(context, node, "sandbox");
|
|
1701
1702
|
if (sandboxProp == null) return;
|
|
@@ -1748,7 +1749,7 @@ var no_unsafe_target_blank_default = createRule({
|
|
|
1748
1749
|
});
|
|
1749
1750
|
function create$2(context) {
|
|
1750
1751
|
const resolver = createJsxElementResolver(context);
|
|
1751
|
-
return
|
|
1752
|
+
return merge({ JSXElement(node) {
|
|
1752
1753
|
const { domElementType } = resolver.resolve(node);
|
|
1753
1754
|
if (domElementType !== "a") return;
|
|
1754
1755
|
if (getAttributeStaticValue(context, node, "target") !== "_blank") return;
|
|
@@ -1801,7 +1802,7 @@ function create$1(context) {
|
|
|
1801
1802
|
if (compare(getSettingsFromContext(context).version, "19.0.0", "<")) return {};
|
|
1802
1803
|
const reactDomNames = /* @__PURE__ */ new Set();
|
|
1803
1804
|
const useFormStateNames = /* @__PURE__ */ new Set();
|
|
1804
|
-
return
|
|
1805
|
+
return merge({
|
|
1805
1806
|
CallExpression(node) {
|
|
1806
1807
|
switch (true) {
|
|
1807
1808
|
case node.callee.type === AST_NODE_TYPES.Identifier && useFormStateNames.has(node.callee.name):
|
|
@@ -1877,7 +1878,7 @@ var no_void_elements_with_children_default = createRule({
|
|
|
1877
1878
|
});
|
|
1878
1879
|
function create(context) {
|
|
1879
1880
|
const resolver = createJsxElementResolver(context);
|
|
1880
|
-
return
|
|
1881
|
+
return merge({ JSXElement(node) {
|
|
1881
1882
|
const { domElementType } = resolver.resolve(node);
|
|
1882
1883
|
if (!voidElements.has(domElementType)) return;
|
|
1883
1884
|
if (node.children.length > 0 || hasAnyAttribute(context, node, ["children", "dangerouslySetInnerHTML"])) context.report({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-dom",
|
|
3
|
-
"version": "5.1.0-beta.
|
|
3
|
+
"version": "5.1.0-beta.1",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for DOM related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -43,11 +43,12 @@
|
|
|
43
43
|
"@typescript-eslint/utils": "^8.58.1",
|
|
44
44
|
"compare-versions": "^6.1.1",
|
|
45
45
|
"ts-pattern": "^5.9.0",
|
|
46
|
-
"@eslint-react/ast": "5.1.0-beta.
|
|
47
|
-
"@eslint-react/
|
|
48
|
-
"@eslint-react/
|
|
49
|
-
"@eslint-react/
|
|
50
|
-
"@eslint-react/
|
|
46
|
+
"@eslint-react/ast": "5.1.0-beta.1",
|
|
47
|
+
"@eslint-react/core": "5.1.0-beta.1",
|
|
48
|
+
"@eslint-react/shared": "5.1.0-beta.1",
|
|
49
|
+
"@eslint-react/eslint": "5.1.0-beta.1",
|
|
50
|
+
"@eslint-react/jsx": "5.1.0-beta.1",
|
|
51
|
+
"@eslint-react/var": "5.1.0-beta.1"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
54
|
"@types/react": "^19.2.14",
|