eslint-plugin-react-x 5.11.2 → 5.11.3
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 +7 -7
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -144,7 +144,7 @@ const rules$6 = {
|
|
|
144
144
|
//#endregion
|
|
145
145
|
//#region package.json
|
|
146
146
|
var name$6 = "eslint-plugin-react-x";
|
|
147
|
-
var version = "5.11.
|
|
147
|
+
var version = "5.11.3";
|
|
148
148
|
|
|
149
149
|
//#endregion
|
|
150
150
|
//#region src/utils/create-rule.ts
|
|
@@ -2424,8 +2424,8 @@ function create$31(context) {
|
|
|
2424
2424
|
return { CallExpression(node) {
|
|
2425
2425
|
if (!core.isForwardRefCall(context, node)) return;
|
|
2426
2426
|
const id = core.getFunctionId(node);
|
|
2427
|
-
const suggest =
|
|
2428
|
-
fix:
|
|
2427
|
+
const suggest = couldFix(context, node) ? [{
|
|
2428
|
+
fix: buildFix(context, node),
|
|
2429
2429
|
messageId: "replace"
|
|
2430
2430
|
}] : [];
|
|
2431
2431
|
context.report({
|
|
@@ -2443,7 +2443,7 @@ function create$31(context) {
|
|
|
2443
2443
|
* @param node The CallExpression node to check
|
|
2444
2444
|
* @returns True if the call can be auto-fixed, false otherwise
|
|
2445
2445
|
*/
|
|
2446
|
-
function
|
|
2446
|
+
function couldFix(context, node) {
|
|
2447
2447
|
const { importSource } = getSettingsFromContext(context);
|
|
2448
2448
|
const initialScope = context.sourceCode.getScope(node);
|
|
2449
2449
|
const callee = Extract.unwrap(node.callee);
|
|
@@ -2459,14 +2459,14 @@ function canFix(context, node) {
|
|
|
2459
2459
|
* @param node The `forwardRef` call expression
|
|
2460
2460
|
* @returns A fixer function that applies the changes
|
|
2461
2461
|
*/
|
|
2462
|
-
function
|
|
2462
|
+
function buildFix(context, node) {
|
|
2463
2463
|
return (fixer) => {
|
|
2464
2464
|
const [componentNode] = node.arguments;
|
|
2465
2465
|
if (componentNode == null || !Check.isFunction(componentNode)) return [];
|
|
2466
2466
|
return [
|
|
2467
2467
|
fixer.removeRange([node.range[0], componentNode.range[0]]),
|
|
2468
2468
|
fixer.removeRange([componentNode.range[1], node.range[1]]),
|
|
2469
|
-
...
|
|
2469
|
+
...buildFixForComponentProps(context, fixer, componentNode, node.typeArguments?.params ?? [])
|
|
2470
2470
|
];
|
|
2471
2471
|
};
|
|
2472
2472
|
}
|
|
@@ -2478,7 +2478,7 @@ function getFix(context, node) {
|
|
|
2478
2478
|
* @param typeArguments The type arguments from the `forwardRef` call
|
|
2479
2479
|
* @returns An array of fixes for the component's signature
|
|
2480
2480
|
*/
|
|
2481
|
-
function
|
|
2481
|
+
function buildFixForComponentProps(context, fixer, node, typeArguments) {
|
|
2482
2482
|
const getText = (node) => context.sourceCode.getText(node);
|
|
2483
2483
|
const [arg0, arg1] = node.params;
|
|
2484
2484
|
const [typeArg0, typeArg1] = typeArguments;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "5.11.
|
|
3
|
+
"version": "5.11.3",
|
|
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,12 +45,12 @@
|
|
|
45
45
|
"string-ts": "^2.3.1",
|
|
46
46
|
"ts-api-utils": "^2.5.0",
|
|
47
47
|
"ts-pattern": "^5.9.0",
|
|
48
|
-
"@eslint-react/
|
|
49
|
-
"@eslint-react/shared": "5.11.
|
|
50
|
-
"@eslint-react/var": "5.11.
|
|
51
|
-
"@eslint-react/
|
|
52
|
-
"@eslint-react/core": "5.11.
|
|
53
|
-
"@eslint-react/
|
|
48
|
+
"@eslint-react/ast": "5.11.3",
|
|
49
|
+
"@eslint-react/shared": "5.11.3",
|
|
50
|
+
"@eslint-react/var": "5.11.3",
|
|
51
|
+
"@eslint-react/jsx": "5.11.3",
|
|
52
|
+
"@eslint-react/core": "5.11.3",
|
|
53
|
+
"@eslint-react/eslint": "5.11.3"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/react": "^19.2.17",
|