eslint-plugin-react-x 1.19.0-next.0 → 1.19.0-next.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 +9 -6
- package/dist/index.mjs +9 -6
- 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-next.
|
|
44
|
+
var version = "1.19.0-next.1";
|
|
45
45
|
var createRule = shared.createRuleForPlugin("x");
|
|
46
46
|
|
|
47
47
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -1207,16 +1207,20 @@ function getFix(node, context) {
|
|
|
1207
1207
|
};
|
|
1208
1208
|
}
|
|
1209
1209
|
function getComponentPropsFixes(node, typeArguments, fixer, context) {
|
|
1210
|
+
const getText = (node2) => context.sourceCode.getText(node2);
|
|
1210
1211
|
const [arg0, arg1] = node.params;
|
|
1211
1212
|
const [typeArg0, typeArg1] = typeArguments;
|
|
1212
|
-
if (arg0
|
|
1213
|
+
if (!arg0) return [];
|
|
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;
|
|
1213
1217
|
if (!arg1) {
|
|
1214
1218
|
return [fixer.replaceText(
|
|
1215
1219
|
arg0,
|
|
1216
1220
|
[
|
|
1217
1221
|
"{",
|
|
1218
1222
|
"ref,",
|
|
1219
|
-
|
|
1223
|
+
fixedPropsText,
|
|
1220
1224
|
"}"
|
|
1221
1225
|
].join(" ")
|
|
1222
1226
|
)];
|
|
@@ -1229,7 +1233,7 @@ function getComponentPropsFixes(node, typeArguments, fixer, context) {
|
|
|
1229
1233
|
[
|
|
1230
1234
|
"{",
|
|
1231
1235
|
arg1.name === "ref" ? `ref,` : `ref: ${arg1.name},`,
|
|
1232
|
-
|
|
1236
|
+
fixedPropsText,
|
|
1233
1237
|
"}"
|
|
1234
1238
|
].join(" ")
|
|
1235
1239
|
),
|
|
@@ -1237,14 +1241,13 @@ function getComponentPropsFixes(node, typeArguments, fixer, context) {
|
|
|
1237
1241
|
fixer.removeRange([arg0.range[1], arg1.range[0]])
|
|
1238
1242
|
];
|
|
1239
1243
|
}
|
|
1240
|
-
const getText = (node2) => context.sourceCode.getText(node2);
|
|
1241
1244
|
return [
|
|
1242
1245
|
fixer.replaceText(
|
|
1243
1246
|
arg0,
|
|
1244
1247
|
[
|
|
1245
1248
|
"{",
|
|
1246
1249
|
arg1.name === "ref" ? `ref,` : `ref: ${arg1.name},`,
|
|
1247
|
-
|
|
1250
|
+
fixedPropsText,
|
|
1248
1251
|
"}:",
|
|
1249
1252
|
getText(typeArg1),
|
|
1250
1253
|
"&",
|
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-next.
|
|
17
|
+
var version = "1.19.0-next.1";
|
|
18
18
|
var createRule = createRuleForPlugin("x");
|
|
19
19
|
|
|
20
20
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -1180,16 +1180,20 @@ function getFix(node, context) {
|
|
|
1180
1180
|
};
|
|
1181
1181
|
}
|
|
1182
1182
|
function getComponentPropsFixes(node, typeArguments, fixer, context) {
|
|
1183
|
+
const getText = (node2) => context.sourceCode.getText(node2);
|
|
1183
1184
|
const [arg0, arg1] = node.params;
|
|
1184
1185
|
const [typeArg0, typeArg1] = typeArguments;
|
|
1185
|
-
if (arg0
|
|
1186
|
+
if (!arg0) return [];
|
|
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;
|
|
1186
1190
|
if (!arg1) {
|
|
1187
1191
|
return [fixer.replaceText(
|
|
1188
1192
|
arg0,
|
|
1189
1193
|
[
|
|
1190
1194
|
"{",
|
|
1191
1195
|
"ref,",
|
|
1192
|
-
|
|
1196
|
+
fixedPropsText,
|
|
1193
1197
|
"}"
|
|
1194
1198
|
].join(" ")
|
|
1195
1199
|
)];
|
|
@@ -1202,7 +1206,7 @@ function getComponentPropsFixes(node, typeArguments, fixer, context) {
|
|
|
1202
1206
|
[
|
|
1203
1207
|
"{",
|
|
1204
1208
|
arg1.name === "ref" ? `ref,` : `ref: ${arg1.name},`,
|
|
1205
|
-
|
|
1209
|
+
fixedPropsText,
|
|
1206
1210
|
"}"
|
|
1207
1211
|
].join(" ")
|
|
1208
1212
|
),
|
|
@@ -1210,14 +1214,13 @@ function getComponentPropsFixes(node, typeArguments, fixer, context) {
|
|
|
1210
1214
|
fixer.removeRange([arg0.range[1], arg1.range[0]])
|
|
1211
1215
|
];
|
|
1212
1216
|
}
|
|
1213
|
-
const getText = (node2) => context.sourceCode.getText(node2);
|
|
1214
1217
|
return [
|
|
1215
1218
|
fixer.replaceText(
|
|
1216
1219
|
arg0,
|
|
1217
1220
|
[
|
|
1218
1221
|
"{",
|
|
1219
1222
|
arg1.name === "ref" ? `ref,` : `ref: ${arg1.name},`,
|
|
1220
|
-
|
|
1223
|
+
fixedPropsText,
|
|
1221
1224
|
"}:",
|
|
1222
1225
|
getText(typeArg1),
|
|
1223
1226
|
"&",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "1.19.0-next.
|
|
3
|
+
"version": "1.19.0-next.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
|
"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-next.
|
|
53
|
-
"@eslint-react/core": "1.19.0-next.
|
|
54
|
-
"@eslint-react/
|
|
55
|
-
"@eslint-react/
|
|
56
|
-
"@eslint-react/
|
|
57
|
-
"@eslint-react/
|
|
58
|
-
"@eslint-react/
|
|
52
|
+
"@eslint-react/ast": "1.19.0-next.1",
|
|
53
|
+
"@eslint-react/core": "1.19.0-next.1",
|
|
54
|
+
"@eslint-react/jsx": "1.19.0-next.1",
|
|
55
|
+
"@eslint-react/shared": "1.19.0-next.1",
|
|
56
|
+
"@eslint-react/types": "1.19.0-next.1",
|
|
57
|
+
"@eslint-react/var": "1.19.0-next.1",
|
|
58
|
+
"@eslint-react/tools": "1.19.0-next.1"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/react": "^19.0.1",
|