eslint-plugin-react-x 5.5.3-next.0 → 5.5.3-next.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 +20 -20
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -142,7 +142,7 @@ const rules$6 = {
|
|
|
142
142
|
//#endregion
|
|
143
143
|
//#region package.json
|
|
144
144
|
var name$6 = "eslint-plugin-react-x";
|
|
145
|
-
var version = "5.5.3-next.
|
|
145
|
+
var version = "5.5.3-next.1";
|
|
146
146
|
|
|
147
147
|
//#endregion
|
|
148
148
|
//#region src/utils/create-rule.ts
|
|
@@ -1326,8 +1326,8 @@ function create$47(context) {
|
|
|
1326
1326
|
}
|
|
1327
1327
|
/**
|
|
1328
1328
|
* Check if `name` appears anywhere inside a parameter pattern.
|
|
1329
|
-
* @param pattern
|
|
1330
|
-
* @param name
|
|
1329
|
+
* @param pattern - The parameter pattern to search in.
|
|
1330
|
+
* @param name - The identifier name to look for.
|
|
1331
1331
|
*/
|
|
1332
1332
|
function identifierExistsInPattern(pattern, name) {
|
|
1333
1333
|
switch (pattern.type) {
|
|
@@ -4003,9 +4003,9 @@ var purity_default = createRule({
|
|
|
4003
4003
|
* Follows simple assignment chains like `const M = Math` or `const w = window`.
|
|
4004
4004
|
* Returns `null` if the identifier is locally defined (parameter, import, function declaration, etc.)
|
|
4005
4005
|
* or resolves to a non-builtin source.
|
|
4006
|
-
* @param context
|
|
4007
|
-
* @param node
|
|
4008
|
-
* @param visited
|
|
4006
|
+
* @param context - The rule context.
|
|
4007
|
+
* @param node - The identifier node to resolve.
|
|
4008
|
+
* @param visited - A set of already visited identifier names to prevent infinite loops.
|
|
4009
4009
|
*/
|
|
4010
4010
|
function resolveBuiltinObjectName(context, node, visited = /* @__PURE__ */ new Set()) {
|
|
4011
4011
|
if (visited.has(node.name)) return null;
|
|
@@ -6967,27 +6967,27 @@ function findVariableForIdentifier(context, identifier) {
|
|
|
6967
6967
|
}
|
|
6968
6968
|
function getDynamicComponentSource(context, variable, isInsideRender, seen = /* @__PURE__ */ new Set()) {
|
|
6969
6969
|
if (seen.has(variable)) return {
|
|
6970
|
-
|
|
6971
|
-
|
|
6970
|
+
creationNode: null,
|
|
6971
|
+
isDynamic: false
|
|
6972
6972
|
};
|
|
6973
6973
|
seen.add(variable);
|
|
6974
6974
|
for (const def of variable.defs) {
|
|
6975
6975
|
const defNode = def.node;
|
|
6976
6976
|
if (!isInsideRender(defNode)) continue;
|
|
6977
6977
|
if (defNode.type === AST_NODE_TYPES.FunctionDeclaration) return {
|
|
6978
|
-
|
|
6979
|
-
|
|
6978
|
+
creationNode: defNode,
|
|
6979
|
+
isDynamic: true
|
|
6980
6980
|
};
|
|
6981
6981
|
if (defNode.type === AST_NODE_TYPES.ClassDeclaration) return {
|
|
6982
|
-
|
|
6983
|
-
|
|
6982
|
+
creationNode: defNode,
|
|
6983
|
+
isDynamic: true
|
|
6984
6984
|
};
|
|
6985
6985
|
if (defNode.type === AST_NODE_TYPES.VariableDeclarator) {
|
|
6986
6986
|
if (defNode.init != null) {
|
|
6987
6987
|
const source = resolveDynamicValue(context, defNode.init, isInsideRender, seen);
|
|
6988
6988
|
if (source != null) return {
|
|
6989
|
-
|
|
6990
|
-
|
|
6989
|
+
creationNode: source,
|
|
6990
|
+
isDynamic: true
|
|
6991
6991
|
};
|
|
6992
6992
|
}
|
|
6993
6993
|
for (const ref of variable.references) {
|
|
@@ -6996,16 +6996,16 @@ function getDynamicComponentSource(context, variable, isInsideRender, seen = /*
|
|
|
6996
6996
|
if (id.parent?.type === AST_NODE_TYPES.AssignmentExpression && id.parent.left === id) {
|
|
6997
6997
|
const source = resolveDynamicValue(context, id.parent.right, isInsideRender, seen);
|
|
6998
6998
|
if (source != null) return {
|
|
6999
|
-
|
|
7000
|
-
|
|
6999
|
+
creationNode: source,
|
|
7000
|
+
isDynamic: true
|
|
7001
7001
|
};
|
|
7002
7002
|
}
|
|
7003
7003
|
}
|
|
7004
7004
|
}
|
|
7005
7005
|
}
|
|
7006
7006
|
return {
|
|
7007
|
-
|
|
7008
|
-
|
|
7007
|
+
creationNode: null,
|
|
7008
|
+
isDynamic: false
|
|
7009
7009
|
};
|
|
7010
7010
|
}
|
|
7011
7011
|
|
|
@@ -7198,10 +7198,10 @@ var use_memo_default = createRule({
|
|
|
7198
7198
|
type: "problem",
|
|
7199
7199
|
docs: { description: "Validates that 'useMemo' is called with a callback that returns a value." },
|
|
7200
7200
|
messages: {
|
|
7201
|
-
|
|
7201
|
+
mustReturnAValue: "useMemo() callbacks must return a value.\n\nThis useMemo() callback doesn't return a value. useMemo() is for computing and caching values, not for arbitrary side effects.",
|
|
7202
7202
|
noAsyncOrGeneratorFunctions: "useMemo() callbacks may not be async or generator functions.\n\nuseMemo() callbacks are called once and must synchronously return a value.",
|
|
7203
|
+
noParameters: "useMemo() callbacks may not accept parameters.\n\nuseMemo() callbacks are called by React to cache calculations across re-renders. They should not take parameters. Instead, directly reference the props, state, or local variables needed for the computation.",
|
|
7203
7204
|
noReassigningOuterVariables: "useMemo() callbacks may not reassign variables declared outside of the callback.\n\nuseMemo() callbacks must be pure functions and cannot reassign variables defined outside of the callback function.",
|
|
7204
|
-
mustReturnAValue: "useMemo() callbacks must return a value.\n\nThis useMemo() callback doesn't return a value. useMemo() is for computing and caching values, not for arbitrary side effects.",
|
|
7205
7205
|
resultMustBeUsed: "useMemo() result is unused.\n\nThis useMemo() value is unused. useMemo() is for computing and caching values, not for arbitrary side effects."
|
|
7206
7206
|
},
|
|
7207
7207
|
schema: []
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "5.5.3-next.
|
|
3
|
+
"version": "5.5.3-next.1",
|
|
4
4
|
"description": "A set of composable ESLint rules for libraries and frameworks that use React as a UI runtime.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"string-ts": "^2.3.1",
|
|
47
47
|
"ts-api-utils": "^2.5.0",
|
|
48
48
|
"ts-pattern": "^5.9.0",
|
|
49
|
-
"@eslint-react/ast": "5.5.3-next.
|
|
50
|
-
"@eslint-react/core": "5.5.3-next.
|
|
51
|
-
"@eslint-react/
|
|
52
|
-
"@eslint-react/jsx": "5.5.3-next.
|
|
53
|
-
"@eslint-react/
|
|
54
|
-
"@eslint-react/var": "5.5.3-next.
|
|
49
|
+
"@eslint-react/ast": "5.5.3-next.1",
|
|
50
|
+
"@eslint-react/core": "5.5.3-next.1",
|
|
51
|
+
"@eslint-react/eslint": "5.5.3-next.1",
|
|
52
|
+
"@eslint-react/jsx": "5.5.3-next.1",
|
|
53
|
+
"@eslint-react/shared": "5.5.3-next.1",
|
|
54
|
+
"@eslint-react/var": "5.5.3-next.1"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/react": "^19.2.14",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"tsdown": "^0.21.10",
|
|
64
64
|
"tsl": "^1.0.30",
|
|
65
65
|
"tsl-dx": "^0.12.0",
|
|
66
|
-
"@local/
|
|
67
|
-
"@local/
|
|
66
|
+
"@local/eff": "3.0.0-beta.72",
|
|
67
|
+
"@local/configs": "0.0.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"eslint": "^10.2.1",
|