eslint-plugin-react-x 1.19.0-beta.1 → 1.19.0-next.0
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 +6 -9
- package/dist/index.mjs +6 -9
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -41,7 +41,7 @@ var ts__default = /*#__PURE__*/_interopDefault(ts);
|
|
|
41
41
|
|
|
42
42
|
// package.json
|
|
43
43
|
var name = "eslint-plugin-react-x";
|
|
44
|
-
var version = "1.19.0-
|
|
44
|
+
var version = "1.19.0-next.0";
|
|
45
45
|
var createRule = shared.createRuleForPlugin("x");
|
|
46
46
|
|
|
47
47
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -1207,20 +1207,16 @@ function getFix(node, context) {
|
|
|
1207
1207
|
};
|
|
1208
1208
|
}
|
|
1209
1209
|
function getComponentPropsFixes(node, typeArguments, fixer, context) {
|
|
1210
|
-
const getText = (node2) => context.sourceCode.getText(node2);
|
|
1211
1210
|
const [arg0, arg1] = node.params;
|
|
1212
1211
|
const [typeArg0, typeArg1] = typeArguments;
|
|
1213
|
-
if (
|
|
1214
|
-
const fixedArg0Text = tsPattern.match(arg0).with({ type: types.AST_NODE_TYPES.Identifier }, (n) => tools.O.some(`...${n.name}`)).with({ type: types.AST_NODE_TYPES.ObjectPattern }, (n) => tools.O.some(n.properties.map(getText).join(", "))).otherwise(tools.O.none);
|
|
1215
|
-
if (tools.O.isNone(fixedArg0Text)) return [];
|
|
1216
|
-
const fixedPropsText = fixedArg0Text.value;
|
|
1212
|
+
if (arg0?.type !== types.AST_NODE_TYPES.Identifier) return [];
|
|
1217
1213
|
if (!arg1) {
|
|
1218
1214
|
return [fixer.replaceText(
|
|
1219
1215
|
arg0,
|
|
1220
1216
|
[
|
|
1221
1217
|
"{",
|
|
1222
1218
|
"ref,",
|
|
1223
|
-
|
|
1219
|
+
`...${arg0.name}`,
|
|
1224
1220
|
"}"
|
|
1225
1221
|
].join(" ")
|
|
1226
1222
|
)];
|
|
@@ -1233,7 +1229,7 @@ function getComponentPropsFixes(node, typeArguments, fixer, context) {
|
|
|
1233
1229
|
[
|
|
1234
1230
|
"{",
|
|
1235
1231
|
arg1.name === "ref" ? `ref,` : `ref: ${arg1.name},`,
|
|
1236
|
-
|
|
1232
|
+
`...${arg0.name}`,
|
|
1237
1233
|
"}"
|
|
1238
1234
|
].join(" ")
|
|
1239
1235
|
),
|
|
@@ -1241,13 +1237,14 @@ function getComponentPropsFixes(node, typeArguments, fixer, context) {
|
|
|
1241
1237
|
fixer.removeRange([arg0.range[1], arg1.range[0]])
|
|
1242
1238
|
];
|
|
1243
1239
|
}
|
|
1240
|
+
const getText = (node2) => context.sourceCode.getText(node2);
|
|
1244
1241
|
return [
|
|
1245
1242
|
fixer.replaceText(
|
|
1246
1243
|
arg0,
|
|
1247
1244
|
[
|
|
1248
1245
|
"{",
|
|
1249
1246
|
arg1.name === "ref" ? `ref,` : `ref: ${arg1.name},`,
|
|
1250
|
-
|
|
1247
|
+
`...${arg0.name}`,
|
|
1251
1248
|
"}:",
|
|
1252
1249
|
getText(typeArg1),
|
|
1253
1250
|
"&",
|
package/dist/index.mjs
CHANGED
|
@@ -14,7 +14,7 @@ import { getTypeImmutability, isUnknown, isImmutable, isReadonlyShallow, isReado
|
|
|
14
14
|
|
|
15
15
|
// package.json
|
|
16
16
|
var name = "eslint-plugin-react-x";
|
|
17
|
-
var version = "1.19.0-
|
|
17
|
+
var version = "1.19.0-next.0";
|
|
18
18
|
var createRule = createRuleForPlugin("x");
|
|
19
19
|
|
|
20
20
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -1180,20 +1180,16 @@ function getFix(node, context) {
|
|
|
1180
1180
|
};
|
|
1181
1181
|
}
|
|
1182
1182
|
function getComponentPropsFixes(node, typeArguments, fixer, context) {
|
|
1183
|
-
const getText = (node2) => context.sourceCode.getText(node2);
|
|
1184
1183
|
const [arg0, arg1] = node.params;
|
|
1185
1184
|
const [typeArg0, typeArg1] = typeArguments;
|
|
1186
|
-
if (
|
|
1187
|
-
const fixedArg0Text = match(arg0).with({ type: AST_NODE_TYPES.Identifier }, (n) => O.some(`...${n.name}`)).with({ type: AST_NODE_TYPES.ObjectPattern }, (n) => O.some(n.properties.map(getText).join(", "))).otherwise(O.none);
|
|
1188
|
-
if (O.isNone(fixedArg0Text)) return [];
|
|
1189
|
-
const fixedPropsText = fixedArg0Text.value;
|
|
1185
|
+
if (arg0?.type !== AST_NODE_TYPES.Identifier) return [];
|
|
1190
1186
|
if (!arg1) {
|
|
1191
1187
|
return [fixer.replaceText(
|
|
1192
1188
|
arg0,
|
|
1193
1189
|
[
|
|
1194
1190
|
"{",
|
|
1195
1191
|
"ref,",
|
|
1196
|
-
|
|
1192
|
+
`...${arg0.name}`,
|
|
1197
1193
|
"}"
|
|
1198
1194
|
].join(" ")
|
|
1199
1195
|
)];
|
|
@@ -1206,7 +1202,7 @@ function getComponentPropsFixes(node, typeArguments, fixer, context) {
|
|
|
1206
1202
|
[
|
|
1207
1203
|
"{",
|
|
1208
1204
|
arg1.name === "ref" ? `ref,` : `ref: ${arg1.name},`,
|
|
1209
|
-
|
|
1205
|
+
`...${arg0.name}`,
|
|
1210
1206
|
"}"
|
|
1211
1207
|
].join(" ")
|
|
1212
1208
|
),
|
|
@@ -1214,13 +1210,14 @@ function getComponentPropsFixes(node, typeArguments, fixer, context) {
|
|
|
1214
1210
|
fixer.removeRange([arg0.range[1], arg1.range[0]])
|
|
1215
1211
|
];
|
|
1216
1212
|
}
|
|
1213
|
+
const getText = (node2) => context.sourceCode.getText(node2);
|
|
1217
1214
|
return [
|
|
1218
1215
|
fixer.replaceText(
|
|
1219
1216
|
arg0,
|
|
1220
1217
|
[
|
|
1221
1218
|
"{",
|
|
1222
1219
|
arg1.name === "ref" ? `ref,` : `ref: ${arg1.name},`,
|
|
1223
|
-
|
|
1220
|
+
`...${arg0.name}`,
|
|
1224
1221
|
"}:",
|
|
1225
1222
|
getText(typeArg1),
|
|
1226
1223
|
"&",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "1.19.0-
|
|
3
|
+
"version": "1.19.0-next.0",
|
|
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
|
"eslint",
|
|
@@ -49,13 +49,13 @@
|
|
|
49
49
|
"compare-versions": "^6.1.1",
|
|
50
50
|
"is-immutable-type": "^5.0.0",
|
|
51
51
|
"ts-pattern": "^5.5.0",
|
|
52
|
-
"@eslint-react/ast": "1.19.0-
|
|
53
|
-
"@eslint-react/core": "1.19.0-
|
|
54
|
-
"@eslint-react/
|
|
55
|
-
"@eslint-react/
|
|
56
|
-
"@eslint-react/
|
|
57
|
-
"@eslint-react/
|
|
58
|
-
"@eslint-react/
|
|
52
|
+
"@eslint-react/ast": "1.19.0-next.0",
|
|
53
|
+
"@eslint-react/core": "1.19.0-next.0",
|
|
54
|
+
"@eslint-react/shared": "1.19.0-next.0",
|
|
55
|
+
"@eslint-react/jsx": "1.19.0-next.0",
|
|
56
|
+
"@eslint-react/tools": "1.19.0-next.0",
|
|
57
|
+
"@eslint-react/types": "1.19.0-next.0",
|
|
58
|
+
"@eslint-react/var": "1.19.0-next.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/react": "^19.0.1",
|