eslint-plugin-react-debug 2.7.4-next.0 → 2.7.4-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.js +3 -18
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DEFAULT_ESLINT_REACT_SETTINGS, WEBSITE_URL, defineRuleListener, getConfigAdapters, getSettingsFromContext, report } from "@eslint-react/shared";
|
|
2
|
-
import { ComponentFlag, DEFAULT_COMPONENT_DETECTION_HINT, JsxEmit, getJsxConfigFromAnnotation, getJsxConfigFromContext, getJsxElementType,
|
|
2
|
+
import { ComponentFlag, DEFAULT_COMPONENT_DETECTION_HINT, JsxEmit, getJsxConfigFromAnnotation, getJsxConfigFromContext, getJsxElementType, isFromReact, isJsxFragmentElement, useComponentCollector, useComponentCollectorLegacy, useHookCollector } from "@eslint-react/core";
|
|
3
3
|
import { AST_NODE_TYPES, ESLintUtils } from "@typescript-eslint/utils";
|
|
4
4
|
import { flow } from "@eslint-react/eff";
|
|
5
5
|
import { AST_NODE_TYPES as AST_NODE_TYPES$1 } from "@typescript-eslint/types";
|
|
@@ -41,7 +41,7 @@ const settings = { "react-x": DEFAULT_ESLINT_REACT_SETTINGS };
|
|
|
41
41
|
//#endregion
|
|
42
42
|
//#region package.json
|
|
43
43
|
var name = "eslint-plugin-react-debug";
|
|
44
|
-
var version = "2.7.4-next.
|
|
44
|
+
var version = "2.7.4-next.2";
|
|
45
45
|
|
|
46
46
|
//#endregion
|
|
47
47
|
//#region src/utils/create-rule.ts
|
|
@@ -163,7 +163,7 @@ function create$1(context) {
|
|
|
163
163
|
function visitorFunction(node) {
|
|
164
164
|
if (node.parent.type === AST_NODE_TYPES.ImportSpecifier && node.parent.imported === node && node.parent.imported.name === node.parent.local.name) return;
|
|
165
165
|
const name$2 = node.name;
|
|
166
|
-
if (!isFromReact(node,
|
|
166
|
+
if (!isFromReact(node, context.sourceCode.getScope(node), importSource)) return;
|
|
167
167
|
context.report({
|
|
168
168
|
messageId: "isFromReact",
|
|
169
169
|
node,
|
|
@@ -178,21 +178,6 @@ function create$1(context) {
|
|
|
178
178
|
JSXIdentifier: visitorFunction
|
|
179
179
|
};
|
|
180
180
|
}
|
|
181
|
-
/**
|
|
182
|
-
* Check if an identifier node is initialized from React
|
|
183
|
-
* @param node The identifier node to check
|
|
184
|
-
* @param importSource The import source to check against
|
|
185
|
-
* @param initialScope Initial scope to search for the identifier
|
|
186
|
-
* @returns Whether the identifier node is initialized from React
|
|
187
|
-
*/
|
|
188
|
-
function isFromReact(node, importSource, initialScope) {
|
|
189
|
-
const name$2 = node.name;
|
|
190
|
-
switch (true) {
|
|
191
|
-
case node.parent.type === AST_NODE_TYPES.MemberExpression && node.parent.property === node && node.parent.object.type === AST_NODE_TYPES.Identifier: return isInitializedFromReact(node.parent.object.name, initialScope, importSource);
|
|
192
|
-
case node.parent.type === AST_NODE_TYPES.JSXMemberExpression && node.parent.property === node && node.parent.object.type === AST_NODE_TYPES.JSXIdentifier: return isInitializedFromReact(node.parent.object.name, initialScope, importSource);
|
|
193
|
-
default: return isInitializedFromReact(name$2, initialScope, importSource);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
181
|
|
|
197
182
|
//#endregion
|
|
198
183
|
//#region src/rules/jsx.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-debug",
|
|
3
|
-
"version": "2.7.4-next.
|
|
3
|
+
"version": "2.7.4-next.2",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for debugging related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"directory": "packages/plugins/eslint-plugin-react-debug"
|
|
21
21
|
},
|
|
22
22
|
"license": "MIT",
|
|
23
|
-
"author": "Rel1cx
|
|
23
|
+
"author": "Rel1cx",
|
|
24
24
|
"sideEffects": false,
|
|
25
25
|
"type": "module",
|
|
26
26
|
"exports": {
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"@typescript-eslint/utils": "^8.53.1",
|
|
45
45
|
"string-ts": "^2.3.1",
|
|
46
46
|
"ts-pattern": "^5.9.0",
|
|
47
|
-
"@eslint-react/
|
|
48
|
-
"@eslint-react/
|
|
49
|
-
"@eslint-react/
|
|
50
|
-
"@eslint-react/
|
|
51
|
-
"@eslint-react/
|
|
47
|
+
"@eslint-react/core": "2.7.4-next.2",
|
|
48
|
+
"@eslint-react/ast": "2.7.4-next.2",
|
|
49
|
+
"@eslint-react/shared": "2.7.4-next.2",
|
|
50
|
+
"@eslint-react/var": "2.7.4-next.2",
|
|
51
|
+
"@eslint-react/eff": "2.7.4-next.2"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/react": "^19.2.9",
|