eslint-plugin-react-x 3.0.0-next.50 → 3.0.0-next.53
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 +9 -2
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -68,7 +68,7 @@ const rules$7 = {
|
|
|
68
68
|
//#endregion
|
|
69
69
|
//#region package.json
|
|
70
70
|
var name$6 = "eslint-plugin-react-x";
|
|
71
|
-
var version = "3.0.0-next.
|
|
71
|
+
var version = "3.0.0-next.53";
|
|
72
72
|
|
|
73
73
|
//#endregion
|
|
74
74
|
//#region src/utils/create-rule.ts
|
|
@@ -2477,7 +2477,14 @@ function getComponentPropsFixes(context, fixer, node, typeArguments) {
|
|
|
2477
2477
|
const getText = (node) => context.sourceCode.getText(node);
|
|
2478
2478
|
const [arg0, arg1] = node.params;
|
|
2479
2479
|
const [typeArg0, typeArg1] = typeArguments;
|
|
2480
|
-
if (arg0 == null)
|
|
2480
|
+
if (arg0 == null) {
|
|
2481
|
+
const openParen = context.sourceCode.getFirstToken(node, { filter: (t) => t.value === "(" });
|
|
2482
|
+
if (openParen == null) return [];
|
|
2483
|
+
if (typeArg0 == null || typeArg1 == null) return [];
|
|
2484
|
+
const typeArg0Text = getText(typeArg0);
|
|
2485
|
+
const typeArg1Text = getText(typeArg1);
|
|
2486
|
+
return [fixer.insertTextAfter(openParen, `{ ref }: ${typeArg1Text} & { ref?: React.RefObject<${typeArg0Text} | null> }`)];
|
|
2487
|
+
}
|
|
2481
2488
|
const fixedArg0Text = match(arg0).with({ type: AST_NODE_TYPES.Identifier }, (n) => `...${n.name}`).with({ type: AST_NODE_TYPES.ObjectPattern }, (n) => n.properties.map(getText).join(", ")).otherwise(() => null);
|
|
2482
2489
|
const fixedArg1Text = match(arg1).with(P.nullish, () => "ref").with({
|
|
2483
2490
|
type: AST_NODE_TYPES.Identifier,
|
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.53",
|
|
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
|
"string-ts": "^2.3.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/
|
|
51
|
-
"@eslint-react/shared": "3.0.0-next.
|
|
52
|
-
"@eslint-react/
|
|
48
|
+
"@eslint-react/ast": "3.0.0-next.53",
|
|
49
|
+
"@eslint-react/core": "3.0.0-next.53",
|
|
50
|
+
"@eslint-react/eff": "3.0.0-next.53",
|
|
51
|
+
"@eslint-react/shared": "3.0.0-next.53",
|
|
52
|
+
"@eslint-react/var": "3.0.0-next.53"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/react": "^19.2.14",
|