eslint-plugin-react-x 3.0.0-next.15 → 3.0.0-next.16
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 +8 -7
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -48,7 +48,8 @@ const rules$8 = {
|
|
|
48
48
|
"react-x/no-unused-props": "off",
|
|
49
49
|
"react-x/prefer-read-only-props": "off",
|
|
50
50
|
"react-x/refs": "off",
|
|
51
|
-
"react-x/rules-of-hooks": "off"
|
|
51
|
+
"react-x/rules-of-hooks": "off",
|
|
52
|
+
"react-x/set-state-in-render": "off"
|
|
52
53
|
};
|
|
53
54
|
|
|
54
55
|
//#endregion
|
|
@@ -68,7 +69,7 @@ const rules$7 = {
|
|
|
68
69
|
//#endregion
|
|
69
70
|
//#region package.json
|
|
70
71
|
var name$6 = "eslint-plugin-react-x";
|
|
71
|
-
var version = "3.0.0-next.
|
|
72
|
+
var version = "3.0.0-next.16";
|
|
72
73
|
|
|
73
74
|
//#endregion
|
|
74
75
|
//#region src/utils/create-rule.ts
|
|
@@ -3861,7 +3862,7 @@ function isWriteAfterNullCheckIf(node, refName) {
|
|
|
3861
3862
|
var refs_default = createRule({
|
|
3862
3863
|
meta: {
|
|
3863
3864
|
type: "problem",
|
|
3864
|
-
docs: { description: "Validates correct usage of refs by checking that ref.current is not read or written during render." },
|
|
3865
|
+
docs: { description: "Validates correct usage of refs by checking that 'ref.current' is not read or written during render." },
|
|
3865
3866
|
messages: {
|
|
3866
3867
|
readDuringRender: "Do not read 'ref.current' during render. Refs are not available during rendering and their values may be stale or inconsistent. Move this read into an effect or event handler.",
|
|
3867
3868
|
writeDuringRender: "Do not write to 'ref.current' during render. Refs should only be mutated in effects or event handlers. Move this write into an effect or event handler."
|
|
@@ -4413,15 +4414,15 @@ function create$1(context) {
|
|
|
4413
4414
|
}
|
|
4414
4415
|
return false;
|
|
4415
4416
|
}
|
|
4416
|
-
function
|
|
4417
|
+
function isComponentOrHookLikeFunction(node) {
|
|
4417
4418
|
const id = ast.getFunctionId(node);
|
|
4418
4419
|
if (id == null) return false;
|
|
4419
|
-
if (id.type === AST_NODE_TYPES.Identifier) return core.isComponentName(id.name);
|
|
4420
|
-
if (id.type === AST_NODE_TYPES.MemberExpression && id.property.type === AST_NODE_TYPES.Identifier) return core.isComponentName(id.property.name);
|
|
4420
|
+
if (id.type === AST_NODE_TYPES.Identifier) return core.isComponentName(id.name) || core.isHookName(id.name);
|
|
4421
|
+
if (id.type === AST_NODE_TYPES.MemberExpression && id.property.type === AST_NODE_TYPES.Identifier) return core.isComponentName(id.property.name) || core.isHookName(id.property.name);
|
|
4421
4422
|
return false;
|
|
4422
4423
|
}
|
|
4423
4424
|
function getFunctionKind(node) {
|
|
4424
|
-
if (
|
|
4425
|
+
if (isComponentOrHookLikeFunction(node)) return "component";
|
|
4425
4426
|
const parent = ast.findParentNode(node, not(ast.isTypeExpression)) ?? node.parent;
|
|
4426
4427
|
if (parent.type === AST_NODE_TYPES.CallExpression && parent.callee !== node) return "callback";
|
|
4427
4428
|
return "other";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "3.0.0-next.
|
|
3
|
+
"version": "3.0.0-next.16",
|
|
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",
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
"is-immutable-type": "^5.0.1",
|
|
46
46
|
"ts-api-utils": "^2.4.0",
|
|
47
47
|
"ts-pattern": "^5.9.0",
|
|
48
|
-
"@eslint-react/ast": "3.0.0-next.
|
|
49
|
-
"@eslint-react/core": "3.0.0-next.
|
|
50
|
-
"@eslint-react/eff": "3.0.0-next.
|
|
51
|
-
"@eslint-react/
|
|
52
|
-
"@eslint-react/
|
|
48
|
+
"@eslint-react/ast": "3.0.0-next.16",
|
|
49
|
+
"@eslint-react/core": "3.0.0-next.16",
|
|
50
|
+
"@eslint-react/eff": "3.0.0-next.16",
|
|
51
|
+
"@eslint-react/shared": "3.0.0-next.16",
|
|
52
|
+
"@eslint-react/var": "3.0.0-next.16"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/react": "^19.2.14",
|