eslint-plugin-react-x 5.3.3-next.2 → 5.3.4-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 +59 -1
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -143,7 +143,7 @@ const rules$7 = {
|
|
|
143
143
|
//#endregion
|
|
144
144
|
//#region package.json
|
|
145
145
|
var name$6 = "eslint-plugin-react-x";
|
|
146
|
-
var version = "5.3.
|
|
146
|
+
var version = "5.3.4-beta.1";
|
|
147
147
|
|
|
148
148
|
//#endregion
|
|
149
149
|
//#region src/rules/component-hook-factories/lib.ts
|
|
@@ -1300,6 +1300,9 @@ function create$47(context) {
|
|
|
1300
1300
|
});
|
|
1301
1301
|
}
|
|
1302
1302
|
return merge(hc.visitor, fc.visitor, {
|
|
1303
|
+
/**
|
|
1304
|
+
* Detect `renderCount++`, `renderCount--`
|
|
1305
|
+
*/
|
|
1303
1306
|
UpdateExpression(node) {
|
|
1304
1307
|
const arg = Extract.unwrap(node.argument);
|
|
1305
1308
|
if (arg.type === AST_NODE_TYPES.Identifier) {
|
|
@@ -1314,6 +1317,9 @@ function create$47(context) {
|
|
|
1314
1317
|
recordViolation(node, "mutatingGlobalProperty", { name: context.sourceCode.getText(arg) });
|
|
1315
1318
|
}
|
|
1316
1319
|
},
|
|
1320
|
+
/**
|
|
1321
|
+
* Detect `renderCount = 1`, `window.currentUser = id`, `cache[id] = value`
|
|
1322
|
+
*/
|
|
1317
1323
|
AssignmentExpression(node) {
|
|
1318
1324
|
const left = Extract.unwrap(node.left);
|
|
1319
1325
|
if (left.type === AST_NODE_TYPES.Identifier) {
|
|
@@ -1328,6 +1334,9 @@ function create$47(context) {
|
|
|
1328
1334
|
recordViolation(node, "mutatingGlobalProperty", { name: context.sourceCode.getText(left) });
|
|
1329
1335
|
}
|
|
1330
1336
|
},
|
|
1337
|
+
/**
|
|
1338
|
+
* Detect `events.push(event)`, `cache.sort()`, etc.
|
|
1339
|
+
*/
|
|
1331
1340
|
CallExpression(node) {
|
|
1332
1341
|
const callee = Extract.unwrap(node.callee);
|
|
1333
1342
|
if (callee.type !== AST_NODE_TYPES.MemberExpression) return;
|
|
@@ -1452,6 +1461,16 @@ function create$46(context) {
|
|
|
1452
1461
|
return null;
|
|
1453
1462
|
}
|
|
1454
1463
|
return merge(hc.visitor, fc.visitor, {
|
|
1464
|
+
/**
|
|
1465
|
+
* Detect `state.push(…)`, `state.sort()`, etc.
|
|
1466
|
+
*
|
|
1467
|
+
* Pattern:
|
|
1468
|
+
* CallExpression
|
|
1469
|
+
* callee: MemberExpression
|
|
1470
|
+
* object: <state or props identifier>
|
|
1471
|
+
* property: <mutating method name>
|
|
1472
|
+
* @param node The CallExpression node to analyze.
|
|
1473
|
+
*/
|
|
1455
1474
|
CallExpression(node) {
|
|
1456
1475
|
const callee = Extract.unwrap(node.callee);
|
|
1457
1476
|
if (callee.type !== AST_NODE_TYPES.MemberExpression) return;
|
|
@@ -1477,6 +1496,15 @@ function create$46(context) {
|
|
|
1477
1496
|
...propsDefiningFunc != null ? { propsDefiningFunc } : {}
|
|
1478
1497
|
});
|
|
1479
1498
|
},
|
|
1499
|
+
/**
|
|
1500
|
+
* Detect `state.foo = bar`, `state.foo.bar = baz`, `props.foo = bar`.
|
|
1501
|
+
*
|
|
1502
|
+
* Pattern:
|
|
1503
|
+
* AssignmentExpression
|
|
1504
|
+
* left: MemberExpression
|
|
1505
|
+
* object: <state or props identifier (or deeper chain)>
|
|
1506
|
+
* @param node The AssignmentExpression node to analyze.
|
|
1507
|
+
*/
|
|
1480
1508
|
AssignmentExpression(node) {
|
|
1481
1509
|
if (node.left.type !== AST_NODE_TYPES.MemberExpression) return;
|
|
1482
1510
|
const rootId = Extract.getRootIdentifier(node.left);
|
|
@@ -7447,15 +7475,45 @@ const settings = { ...settings$1 };
|
|
|
7447
7475
|
const finalPlugin = {
|
|
7448
7476
|
...plugin,
|
|
7449
7477
|
configs: {
|
|
7478
|
+
/**
|
|
7479
|
+
* Disable rules in `eslint-plugin-react` that conflict with rules in this plugin
|
|
7480
|
+
*/
|
|
7450
7481
|
["disable-conflict-eslint-plugin-react"]: disable_conflict_eslint_plugin_react_exports,
|
|
7482
|
+
/**
|
|
7483
|
+
* Disable rules in `eslint-plugin-react-hooks` that conflict with rules in this plugin
|
|
7484
|
+
*/
|
|
7451
7485
|
["disable-conflict-eslint-plugin-react-hooks"]: disable_conflict_eslint_plugin_react_hooks_exports,
|
|
7486
|
+
/**
|
|
7487
|
+
* Disable experimental rules that might be subject to change in the future
|
|
7488
|
+
*/
|
|
7452
7489
|
["disable-experimental"]: disable_experimental_exports,
|
|
7490
|
+
/**
|
|
7491
|
+
* Disable rules that can be enforced by TypeScript
|
|
7492
|
+
*/
|
|
7453
7493
|
["disable-type-checked"]: disable_type_checked_exports,
|
|
7494
|
+
/**
|
|
7495
|
+
* Enforce rules that are recommended by ESLint React for general purpose React + React DOM projects
|
|
7496
|
+
*/
|
|
7454
7497
|
["recommended"]: recommended_exports,
|
|
7498
|
+
/**
|
|
7499
|
+
* Same as the `recommended-typescript` preset but enables additional rules that require type information
|
|
7500
|
+
*/
|
|
7455
7501
|
["recommended-type-checked"]: recommended_type_checked_exports,
|
|
7502
|
+
/**
|
|
7503
|
+
* Same as the `recommended` preset but disables rules that can be enforced by TypeScript
|
|
7504
|
+
*/
|
|
7456
7505
|
["recommended-typescript"]: recommended_typescript_exports,
|
|
7506
|
+
/**
|
|
7507
|
+
* More strict version of the `recommended` preset
|
|
7508
|
+
*/
|
|
7457
7509
|
["strict"]: strict_exports,
|
|
7510
|
+
/**
|
|
7511
|
+
* Same as the `strict-typescript` preset but enables additional rules that require type information
|
|
7512
|
+
*/
|
|
7458
7513
|
["strict-type-checked"]: strict_type_checked_exports,
|
|
7514
|
+
/**
|
|
7515
|
+
* Same as the `strict` preset but disables rules that can be enforced by TypeScript
|
|
7516
|
+
*/
|
|
7459
7517
|
["strict-typescript"]: strict_typescript_exports
|
|
7460
7518
|
}
|
|
7461
7519
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.4-beta.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,21 +46,21 @@
|
|
|
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.3.
|
|
50
|
-
"@eslint-react/eslint": "5.3.
|
|
51
|
-
"@eslint-react/jsx": "5.3.
|
|
52
|
-
"@eslint-react/
|
|
53
|
-
"@eslint-react/core": "5.3.
|
|
54
|
-
"@eslint-react/
|
|
49
|
+
"@eslint-react/ast": "5.3.4-beta.1",
|
|
50
|
+
"@eslint-react/eslint": "5.3.4-beta.1",
|
|
51
|
+
"@eslint-react/jsx": "5.3.4-beta.1",
|
|
52
|
+
"@eslint-react/var": "5.3.4-beta.1",
|
|
53
|
+
"@eslint-react/core": "5.3.4-beta.1",
|
|
54
|
+
"@eslint-react/shared": "5.3.4-beta.1"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/react": "^19.2.14",
|
|
58
58
|
"@types/react-dom": "^19.2.3",
|
|
59
59
|
"eslint": "^10.2.1",
|
|
60
|
-
"tsdown": "^0.21.
|
|
61
|
-
"tsl-dx": "^0.
|
|
62
|
-
"@local/
|
|
63
|
-
"@local/
|
|
60
|
+
"tsdown": "^0.21.10",
|
|
61
|
+
"tsl-dx": "^0.12.0",
|
|
62
|
+
"@local/configs": "0.0.0",
|
|
63
|
+
"@local/eff": "3.0.0-beta.72"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"eslint": "^10.2.1",
|