eslint-plugin-react-dom 5.20.0 → 5.20.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 +39 -8
- package/package.json +7 -6
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { DEFAULT_ESLINT_REACT_SETTINGS, RE_JAVASCRIPT_PROTOCOL, getSettingsFromC
|
|
|
2
2
|
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
3
3
|
import "@eslint-react/eslint";
|
|
4
4
|
import { findAttribute, getAttributeStaticValue, getElementFullType, hasAnyAttribute, hasAttribute, isHostElement, isPaddingWhitespace, resolveAttributeValue } from "@eslint-react/jsx";
|
|
5
|
+
import * as core from "@eslint-react/core";
|
|
5
6
|
import { Check, Extract } from "@eslint-react/ast";
|
|
6
7
|
import { AST_NODE_TYPES } from "@typescript-eslint/types";
|
|
7
8
|
import { compare } from "compare-versions";
|
|
@@ -25,7 +26,7 @@ var __exportAll = (all, no_symbols) => {
|
|
|
25
26
|
//#endregion
|
|
26
27
|
//#region package.json
|
|
27
28
|
var name$2 = "eslint-plugin-react-dom";
|
|
28
|
-
var version = "5.20.
|
|
29
|
+
var version = "5.20.1";
|
|
29
30
|
|
|
30
31
|
//#endregion
|
|
31
32
|
//#region src/utils/create-rule.ts
|
|
@@ -89,6 +90,7 @@ function create$14(context) {
|
|
|
89
90
|
|
|
90
91
|
//#endregion
|
|
91
92
|
//#region src/rules/no-find-dom-node/no-find-dom-node.ts
|
|
93
|
+
const isFindDOMNodeCall = core.isAPICall("findDOMNode");
|
|
92
94
|
const RULE_NAME$13 = "no-find-dom-node";
|
|
93
95
|
var no_find_dom_node_default = createRule({
|
|
94
96
|
meta: {
|
|
@@ -104,7 +106,7 @@ var no_find_dom_node_default = createRule({
|
|
|
104
106
|
function create$13(context) {
|
|
105
107
|
if (!context.sourceCode.text.includes("findDOMNode")) return {};
|
|
106
108
|
return { CallExpression(node) {
|
|
107
|
-
if (
|
|
109
|
+
if (isFindDOMNodeCall(context, node)) context.report({
|
|
108
110
|
messageId: "default",
|
|
109
111
|
node
|
|
110
112
|
});
|
|
@@ -127,12 +129,41 @@ var no_flush_sync_default = createRule({
|
|
|
127
129
|
});
|
|
128
130
|
function create$12(context) {
|
|
129
131
|
if (!context.sourceCode.text.includes("flushSync")) return {};
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
132
|
+
const reactDomNames = /* @__PURE__ */ new Set();
|
|
133
|
+
const flushSyncNames = /* @__PURE__ */ new Set();
|
|
134
|
+
return {
|
|
135
|
+
CallExpression(node) {
|
|
136
|
+
const callee = Extract.unwrap(node.callee);
|
|
137
|
+
switch (true) {
|
|
138
|
+
case Check.isIdentifier(callee) && flushSyncNames.has(callee.name):
|
|
139
|
+
context.report({
|
|
140
|
+
messageId: "default",
|
|
141
|
+
node
|
|
142
|
+
});
|
|
143
|
+
return;
|
|
144
|
+
case callee.type === AST_NODE_TYPES.MemberExpression && Check.isIdentifier(callee.object) && Extract.getCalleeName(node) === "flushSync" && reactDomNames.has(callee.object.name):
|
|
145
|
+
context.report({
|
|
146
|
+
messageId: "default",
|
|
147
|
+
node
|
|
148
|
+
});
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
ImportDeclaration(node) {
|
|
153
|
+
const [baseSource] = node.source.value.split("/");
|
|
154
|
+
if (baseSource !== "react-dom") return;
|
|
155
|
+
for (const specifier of node.specifiers) switch (specifier.type) {
|
|
156
|
+
case AST_NODE_TYPES.ImportSpecifier:
|
|
157
|
+
if (!Check.isIdentifier(specifier.imported)) continue;
|
|
158
|
+
if (specifier.imported.name === "flushSync") flushSyncNames.add(specifier.local.name);
|
|
159
|
+
continue;
|
|
160
|
+
case AST_NODE_TYPES.ImportDefaultSpecifier:
|
|
161
|
+
case AST_NODE_TYPES.ImportNamespaceSpecifier:
|
|
162
|
+
reactDomNames.add(specifier.local.name);
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
};
|
|
136
167
|
}
|
|
137
168
|
|
|
138
169
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-dom",
|
|
3
|
-
"version": "5.20.
|
|
3
|
+
"version": "5.20.1",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for DOM related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -37,10 +37,11 @@
|
|
|
37
37
|
"dist"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@eslint-react/ast": "5.20.
|
|
41
|
-
"@eslint-react/
|
|
42
|
-
"@eslint-react/
|
|
43
|
-
"@eslint-react/
|
|
40
|
+
"@eslint-react/ast": "5.20.1",
|
|
41
|
+
"@eslint-react/core": "5.20.1",
|
|
42
|
+
"@eslint-react/eslint": "5.20.1",
|
|
43
|
+
"@eslint-react/jsx": "5.20.1",
|
|
44
|
+
"@eslint-react/shared": "5.20.1",
|
|
44
45
|
"@typescript-eslint/types": "^8.70.0",
|
|
45
46
|
"@typescript-eslint/utils": "^8.70.0",
|
|
46
47
|
"compare-versions": "^6.1.1"
|
|
@@ -51,7 +52,7 @@
|
|
|
51
52
|
"@types/react": "^19.3.0",
|
|
52
53
|
"@types/react-dom": "^19.3.0",
|
|
53
54
|
"dedent": "^1.7.2",
|
|
54
|
-
"eslint": "^10.
|
|
55
|
+
"eslint": "^10.11.0",
|
|
55
56
|
"tsdown": "^0.23.0",
|
|
56
57
|
"typescript": "6.0.3"
|
|
57
58
|
},
|