eslint-plugin-nextfriday 1.7.0 → 1.8.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/CHANGELOG.md +10 -0
- package/README.md +11 -8
- package/docs/rules/NO_LAZY_IDENTIFIERS.md +106 -0
- package/lib/index.cjs +270 -131
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +14 -0
- package/lib/index.d.ts +14 -0
- package/lib/index.js +270 -131
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// package.json
|
|
2
2
|
var package_default = {
|
|
3
3
|
name: "eslint-plugin-nextfriday",
|
|
4
|
-
version: "1.
|
|
4
|
+
version: "1.8.0",
|
|
5
5
|
description: "A comprehensive ESLint plugin providing custom rules and configurations for Next Friday development workflows.",
|
|
6
6
|
keywords: [
|
|
7
7
|
"eslint",
|
|
@@ -1101,11 +1101,147 @@ var noLogicInParams = createRule14({
|
|
|
1101
1101
|
});
|
|
1102
1102
|
var no_logic_in_params_default = noLogicInParams;
|
|
1103
1103
|
|
|
1104
|
-
// src/rules/no-
|
|
1104
|
+
// src/rules/no-lazy-identifiers.ts
|
|
1105
1105
|
import { ESLintUtils as ESLintUtils15, AST_NODE_TYPES as AST_NODE_TYPES12 } from "@typescript-eslint/utils";
|
|
1106
1106
|
var createRule15 = ESLintUtils15.RuleCreator(
|
|
1107
1107
|
(name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
|
|
1108
1108
|
);
|
|
1109
|
+
var KEYBOARD_ROWS = ["qwertyuiop", "asdfghjkl", "zxcvbnm", "1234567890"];
|
|
1110
|
+
var MIN_LENGTH = 3;
|
|
1111
|
+
var MIN_SEQUENCE_LENGTH = 4;
|
|
1112
|
+
var hasRepeatedChars = (name) => {
|
|
1113
|
+
const lowerName = name.toLowerCase();
|
|
1114
|
+
return lowerName.split("").some((char, index) => {
|
|
1115
|
+
if (index > lowerName.length - 3) {
|
|
1116
|
+
return false;
|
|
1117
|
+
}
|
|
1118
|
+
return char === lowerName[index + 1] && char === lowerName[index + 2];
|
|
1119
|
+
});
|
|
1120
|
+
};
|
|
1121
|
+
var hasKeyboardSequence = (name) => {
|
|
1122
|
+
const lowerName = name.toLowerCase();
|
|
1123
|
+
if (lowerName.length < MIN_SEQUENCE_LENGTH) {
|
|
1124
|
+
return false;
|
|
1125
|
+
}
|
|
1126
|
+
return KEYBOARD_ROWS.some((row) => {
|
|
1127
|
+
const positions = Array.from({ length: row.length - MIN_SEQUENCE_LENGTH + 1 }, (_, i) => i);
|
|
1128
|
+
return positions.some((start) => {
|
|
1129
|
+
const sequence = row.slice(start, start + MIN_SEQUENCE_LENGTH);
|
|
1130
|
+
const reverseSequence = sequence.split("").reverse().join("");
|
|
1131
|
+
return lowerName.includes(sequence) || lowerName.includes(reverseSequence);
|
|
1132
|
+
});
|
|
1133
|
+
});
|
|
1134
|
+
};
|
|
1135
|
+
var isLazyIdentifier = (name) => {
|
|
1136
|
+
if (name.length < MIN_LENGTH) {
|
|
1137
|
+
return false;
|
|
1138
|
+
}
|
|
1139
|
+
if (name.startsWith("_")) {
|
|
1140
|
+
return false;
|
|
1141
|
+
}
|
|
1142
|
+
if (hasRepeatedChars(name)) {
|
|
1143
|
+
return true;
|
|
1144
|
+
}
|
|
1145
|
+
if (hasKeyboardSequence(name)) {
|
|
1146
|
+
return true;
|
|
1147
|
+
}
|
|
1148
|
+
return false;
|
|
1149
|
+
};
|
|
1150
|
+
var noLazyIdentifiers = createRule15({
|
|
1151
|
+
name: "no-lazy-identifiers",
|
|
1152
|
+
meta: {
|
|
1153
|
+
type: "problem",
|
|
1154
|
+
docs: {
|
|
1155
|
+
description: "Disallow lazy, meaningless variable names that hurt code readability"
|
|
1156
|
+
},
|
|
1157
|
+
messages: {
|
|
1158
|
+
noLazyIdentifier: "Avoid lazy identifier '{{name}}'. Use a descriptive name that clearly indicates the purpose."
|
|
1159
|
+
},
|
|
1160
|
+
schema: []
|
|
1161
|
+
},
|
|
1162
|
+
defaultOptions: [],
|
|
1163
|
+
create(context) {
|
|
1164
|
+
const checkIdentifier = (node) => {
|
|
1165
|
+
const { name } = node;
|
|
1166
|
+
if (!isLazyIdentifier(name)) {
|
|
1167
|
+
return;
|
|
1168
|
+
}
|
|
1169
|
+
context.report({
|
|
1170
|
+
node,
|
|
1171
|
+
messageId: "noLazyIdentifier",
|
|
1172
|
+
data: { name }
|
|
1173
|
+
});
|
|
1174
|
+
};
|
|
1175
|
+
const checkPattern = (pattern) => {
|
|
1176
|
+
if (pattern.type === AST_NODE_TYPES12.Identifier) {
|
|
1177
|
+
checkIdentifier(pattern);
|
|
1178
|
+
} else if (pattern.type === AST_NODE_TYPES12.ObjectPattern) {
|
|
1179
|
+
pattern.properties.forEach((prop) => {
|
|
1180
|
+
if (prop.type === AST_NODE_TYPES12.Property && prop.value.type === AST_NODE_TYPES12.Identifier) {
|
|
1181
|
+
checkIdentifier(prop.value);
|
|
1182
|
+
} else if (prop.type === AST_NODE_TYPES12.RestElement && prop.argument.type === AST_NODE_TYPES12.Identifier) {
|
|
1183
|
+
checkIdentifier(prop.argument);
|
|
1184
|
+
}
|
|
1185
|
+
});
|
|
1186
|
+
} else if (pattern.type === AST_NODE_TYPES12.ArrayPattern) {
|
|
1187
|
+
pattern.elements.forEach((element) => {
|
|
1188
|
+
if (element?.type === AST_NODE_TYPES12.Identifier) {
|
|
1189
|
+
checkIdentifier(element);
|
|
1190
|
+
} else if (element?.type === AST_NODE_TYPES12.RestElement && element.argument.type === AST_NODE_TYPES12.Identifier) {
|
|
1191
|
+
checkIdentifier(element.argument);
|
|
1192
|
+
}
|
|
1193
|
+
});
|
|
1194
|
+
} else if (pattern.type === AST_NODE_TYPES12.AssignmentPattern && pattern.left.type === AST_NODE_TYPES12.Identifier) {
|
|
1195
|
+
checkIdentifier(pattern.left);
|
|
1196
|
+
} else if (pattern.type === AST_NODE_TYPES12.RestElement && pattern.argument.type === AST_NODE_TYPES12.Identifier) {
|
|
1197
|
+
checkIdentifier(pattern.argument);
|
|
1198
|
+
}
|
|
1199
|
+
};
|
|
1200
|
+
return {
|
|
1201
|
+
VariableDeclarator(node) {
|
|
1202
|
+
checkPattern(node.id);
|
|
1203
|
+
},
|
|
1204
|
+
FunctionDeclaration(node) {
|
|
1205
|
+
if (node.id) {
|
|
1206
|
+
checkIdentifier(node.id);
|
|
1207
|
+
}
|
|
1208
|
+
node.params.forEach((param) => checkPattern(param));
|
|
1209
|
+
},
|
|
1210
|
+
FunctionExpression(node) {
|
|
1211
|
+
if (node.id) {
|
|
1212
|
+
checkIdentifier(node.id);
|
|
1213
|
+
}
|
|
1214
|
+
node.params.forEach((param) => checkPattern(param));
|
|
1215
|
+
},
|
|
1216
|
+
ArrowFunctionExpression(node) {
|
|
1217
|
+
node.params.forEach((param) => checkPattern(param));
|
|
1218
|
+
},
|
|
1219
|
+
CatchClause(node) {
|
|
1220
|
+
if (node.param) {
|
|
1221
|
+
checkPattern(node.param);
|
|
1222
|
+
}
|
|
1223
|
+
},
|
|
1224
|
+
ClassDeclaration(node) {
|
|
1225
|
+
if (node.id) {
|
|
1226
|
+
checkIdentifier(node.id);
|
|
1227
|
+
}
|
|
1228
|
+
},
|
|
1229
|
+
TSTypeAliasDeclaration(node) {
|
|
1230
|
+
checkIdentifier(node.id);
|
|
1231
|
+
},
|
|
1232
|
+
TSInterfaceDeclaration(node) {
|
|
1233
|
+
checkIdentifier(node.id);
|
|
1234
|
+
}
|
|
1235
|
+
};
|
|
1236
|
+
}
|
|
1237
|
+
});
|
|
1238
|
+
var no_lazy_identifiers_default = noLazyIdentifiers;
|
|
1239
|
+
|
|
1240
|
+
// src/rules/no-single-char-variables.ts
|
|
1241
|
+
import { ESLintUtils as ESLintUtils16, AST_NODE_TYPES as AST_NODE_TYPES13 } from "@typescript-eslint/utils";
|
|
1242
|
+
var createRule16 = ESLintUtils16.RuleCreator(
|
|
1243
|
+
(name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
|
|
1244
|
+
);
|
|
1109
1245
|
var ALLOWED_IN_FOR_LOOPS = /* @__PURE__ */ new Set(["i", "j", "k", "n"]);
|
|
1110
1246
|
var ALLOWED_UNDERSCORE = "_";
|
|
1111
1247
|
var isForLoopInit = (node) => {
|
|
@@ -1115,7 +1251,7 @@ var isForLoopInit = (node) => {
|
|
|
1115
1251
|
if (!parentNode) {
|
|
1116
1252
|
return false;
|
|
1117
1253
|
}
|
|
1118
|
-
if (parentNode.type ===
|
|
1254
|
+
if (parentNode.type === AST_NODE_TYPES13.ForStatement) {
|
|
1119
1255
|
const { init } = parentNode;
|
|
1120
1256
|
if (init && init === current) {
|
|
1121
1257
|
return true;
|
|
@@ -1134,7 +1270,7 @@ var isAllowedInContext = (name, node) => {
|
|
|
1134
1270
|
}
|
|
1135
1271
|
return false;
|
|
1136
1272
|
};
|
|
1137
|
-
var noSingleCharVariables =
|
|
1273
|
+
var noSingleCharVariables = createRule16({
|
|
1138
1274
|
name: "no-single-char-variables",
|
|
1139
1275
|
meta: {
|
|
1140
1276
|
type: "suggestion",
|
|
@@ -1163,27 +1299,27 @@ var noSingleCharVariables = createRule15({
|
|
|
1163
1299
|
});
|
|
1164
1300
|
};
|
|
1165
1301
|
const checkPattern = (pattern, declarationNode) => {
|
|
1166
|
-
if (pattern.type ===
|
|
1302
|
+
if (pattern.type === AST_NODE_TYPES13.Identifier) {
|
|
1167
1303
|
checkIdentifier(pattern, declarationNode);
|
|
1168
|
-
} else if (pattern.type ===
|
|
1304
|
+
} else if (pattern.type === AST_NODE_TYPES13.ObjectPattern) {
|
|
1169
1305
|
pattern.properties.forEach((prop) => {
|
|
1170
|
-
if (prop.type ===
|
|
1306
|
+
if (prop.type === AST_NODE_TYPES13.Property && prop.value.type === AST_NODE_TYPES13.Identifier) {
|
|
1171
1307
|
checkIdentifier(prop.value, declarationNode);
|
|
1172
|
-
} else if (prop.type ===
|
|
1308
|
+
} else if (prop.type === AST_NODE_TYPES13.RestElement && prop.argument.type === AST_NODE_TYPES13.Identifier) {
|
|
1173
1309
|
checkIdentifier(prop.argument, declarationNode);
|
|
1174
1310
|
}
|
|
1175
1311
|
});
|
|
1176
|
-
} else if (pattern.type ===
|
|
1312
|
+
} else if (pattern.type === AST_NODE_TYPES13.ArrayPattern) {
|
|
1177
1313
|
pattern.elements.forEach((element) => {
|
|
1178
|
-
if (element?.type ===
|
|
1314
|
+
if (element?.type === AST_NODE_TYPES13.Identifier) {
|
|
1179
1315
|
checkIdentifier(element, declarationNode);
|
|
1180
|
-
} else if (element?.type ===
|
|
1316
|
+
} else if (element?.type === AST_NODE_TYPES13.RestElement && element.argument.type === AST_NODE_TYPES13.Identifier) {
|
|
1181
1317
|
checkIdentifier(element.argument, declarationNode);
|
|
1182
1318
|
}
|
|
1183
1319
|
});
|
|
1184
|
-
} else if (pattern.type ===
|
|
1320
|
+
} else if (pattern.type === AST_NODE_TYPES13.AssignmentPattern && pattern.left.type === AST_NODE_TYPES13.Identifier) {
|
|
1185
1321
|
checkIdentifier(pattern.left, declarationNode);
|
|
1186
|
-
} else if (pattern.type ===
|
|
1322
|
+
} else if (pattern.type === AST_NODE_TYPES13.RestElement && pattern.argument.type === AST_NODE_TYPES13.Identifier) {
|
|
1187
1323
|
checkIdentifier(pattern.argument, declarationNode);
|
|
1188
1324
|
}
|
|
1189
1325
|
};
|
|
@@ -1217,11 +1353,11 @@ var noSingleCharVariables = createRule15({
|
|
|
1217
1353
|
var no_single_char_variables_default = noSingleCharVariables;
|
|
1218
1354
|
|
|
1219
1355
|
// src/rules/prefer-destructuring-params.ts
|
|
1220
|
-
import { AST_NODE_TYPES as
|
|
1221
|
-
var
|
|
1356
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES14, ESLintUtils as ESLintUtils17 } from "@typescript-eslint/utils";
|
|
1357
|
+
var createRule17 = ESLintUtils17.RuleCreator(
|
|
1222
1358
|
(name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
|
|
1223
1359
|
);
|
|
1224
|
-
var preferDestructuringParams =
|
|
1360
|
+
var preferDestructuringParams = createRule17({
|
|
1225
1361
|
name: "prefer-destructuring-params",
|
|
1226
1362
|
meta: {
|
|
1227
1363
|
type: "suggestion",
|
|
@@ -1237,18 +1373,18 @@ var preferDestructuringParams = createRule16({
|
|
|
1237
1373
|
create(context) {
|
|
1238
1374
|
const isCallbackFunction2 = (node) => {
|
|
1239
1375
|
const { parent } = node;
|
|
1240
|
-
return parent?.type ===
|
|
1376
|
+
return parent?.type === AST_NODE_TYPES14.CallExpression;
|
|
1241
1377
|
};
|
|
1242
1378
|
const isDeveloperFunction = (node) => {
|
|
1243
|
-
if (node.type ===
|
|
1379
|
+
if (node.type === AST_NODE_TYPES14.FunctionDeclaration) {
|
|
1244
1380
|
return true;
|
|
1245
1381
|
}
|
|
1246
|
-
if (node.type ===
|
|
1382
|
+
if (node.type === AST_NODE_TYPES14.FunctionExpression || node.type === AST_NODE_TYPES14.ArrowFunctionExpression) {
|
|
1247
1383
|
if (isCallbackFunction2(node)) {
|
|
1248
1384
|
return false;
|
|
1249
1385
|
}
|
|
1250
1386
|
const { parent } = node;
|
|
1251
|
-
return parent?.type ===
|
|
1387
|
+
return parent?.type === AST_NODE_TYPES14.VariableDeclarator || parent?.type === AST_NODE_TYPES14.AssignmentExpression || parent?.type === AST_NODE_TYPES14.Property || parent?.type === AST_NODE_TYPES14.MethodDefinition;
|
|
1252
1388
|
}
|
|
1253
1389
|
return false;
|
|
1254
1390
|
};
|
|
@@ -1260,7 +1396,7 @@ var preferDestructuringParams = createRule16({
|
|
|
1260
1396
|
if (!isDeveloperFunction(node)) {
|
|
1261
1397
|
return;
|
|
1262
1398
|
}
|
|
1263
|
-
if (node.type ===
|
|
1399
|
+
if (node.type === AST_NODE_TYPES14.FunctionDeclaration && node.id) {
|
|
1264
1400
|
const functionName = node.id.name;
|
|
1265
1401
|
if (functionName.startsWith("_") || functionName.includes("$") || /^[A-Z][a-zA-Z]*$/.test(functionName)) {
|
|
1266
1402
|
return;
|
|
@@ -1270,7 +1406,7 @@ var preferDestructuringParams = createRule16({
|
|
|
1270
1406
|
return;
|
|
1271
1407
|
}
|
|
1272
1408
|
const hasNonDestructuredParams = node.params.some(
|
|
1273
|
-
(param) => param.type !==
|
|
1409
|
+
(param) => param.type !== AST_NODE_TYPES14.ObjectPattern && param.type !== AST_NODE_TYPES14.RestElement
|
|
1274
1410
|
);
|
|
1275
1411
|
if (hasNonDestructuredParams) {
|
|
1276
1412
|
context.report({
|
|
@@ -1289,8 +1425,8 @@ var preferDestructuringParams = createRule16({
|
|
|
1289
1425
|
var prefer_destructuring_params_default = preferDestructuringParams;
|
|
1290
1426
|
|
|
1291
1427
|
// src/rules/prefer-function-declaration.ts
|
|
1292
|
-
import { ESLintUtils as
|
|
1293
|
-
var
|
|
1428
|
+
import { ESLintUtils as ESLintUtils18, AST_NODE_TYPES as AST_NODE_TYPES15 } from "@typescript-eslint/utils";
|
|
1429
|
+
var createRule18 = ESLintUtils18.RuleCreator(
|
|
1294
1430
|
(name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
|
|
1295
1431
|
);
|
|
1296
1432
|
var isTsFile = (filename) => filename.endsWith(".ts") && !filename.endsWith(".d.ts");
|
|
@@ -1299,33 +1435,33 @@ var isCallbackContext = (node) => {
|
|
|
1299
1435
|
if (!parent) {
|
|
1300
1436
|
return false;
|
|
1301
1437
|
}
|
|
1302
|
-
if (parent.type ===
|
|
1438
|
+
if (parent.type === AST_NODE_TYPES15.CallExpression && parent.arguments.includes(node)) {
|
|
1303
1439
|
return true;
|
|
1304
1440
|
}
|
|
1305
|
-
if (parent.type ===
|
|
1441
|
+
if (parent.type === AST_NODE_TYPES15.NewExpression && parent.arguments.includes(node)) {
|
|
1306
1442
|
return true;
|
|
1307
1443
|
}
|
|
1308
|
-
if (parent.type ===
|
|
1444
|
+
if (parent.type === AST_NODE_TYPES15.ReturnStatement) {
|
|
1309
1445
|
return true;
|
|
1310
1446
|
}
|
|
1311
|
-
if (parent.type ===
|
|
1447
|
+
if (parent.type === AST_NODE_TYPES15.Property) {
|
|
1312
1448
|
return true;
|
|
1313
1449
|
}
|
|
1314
|
-
if (parent.type ===
|
|
1450
|
+
if (parent.type === AST_NODE_TYPES15.ArrayExpression) {
|
|
1315
1451
|
return true;
|
|
1316
1452
|
}
|
|
1317
|
-
if (parent.type ===
|
|
1453
|
+
if (parent.type === AST_NODE_TYPES15.ConditionalExpression) {
|
|
1318
1454
|
return true;
|
|
1319
1455
|
}
|
|
1320
|
-
if (parent.type ===
|
|
1456
|
+
if (parent.type === AST_NODE_TYPES15.LogicalExpression) {
|
|
1321
1457
|
return true;
|
|
1322
1458
|
}
|
|
1323
|
-
if (parent.type ===
|
|
1459
|
+
if (parent.type === AST_NODE_TYPES15.AssignmentExpression && parent.left !== node) {
|
|
1324
1460
|
return true;
|
|
1325
1461
|
}
|
|
1326
1462
|
return false;
|
|
1327
1463
|
};
|
|
1328
|
-
var preferFunctionDeclaration =
|
|
1464
|
+
var preferFunctionDeclaration = createRule18({
|
|
1329
1465
|
name: "prefer-function-declaration",
|
|
1330
1466
|
meta: {
|
|
1331
1467
|
type: "suggestion",
|
|
@@ -1346,14 +1482,14 @@ var preferFunctionDeclaration = createRule17({
|
|
|
1346
1482
|
}
|
|
1347
1483
|
return {
|
|
1348
1484
|
VariableDeclarator(node) {
|
|
1349
|
-
if (node.id.type !==
|
|
1485
|
+
if (node.id.type !== AST_NODE_TYPES15.Identifier) {
|
|
1350
1486
|
return;
|
|
1351
1487
|
}
|
|
1352
1488
|
const { init } = node;
|
|
1353
1489
|
if (!init) {
|
|
1354
1490
|
return;
|
|
1355
1491
|
}
|
|
1356
|
-
if (init.type ===
|
|
1492
|
+
if (init.type === AST_NODE_TYPES15.ArrowFunctionExpression) {
|
|
1357
1493
|
if (isCallbackContext(init)) {
|
|
1358
1494
|
return;
|
|
1359
1495
|
}
|
|
@@ -1363,7 +1499,7 @@ var preferFunctionDeclaration = createRule17({
|
|
|
1363
1499
|
data: { name: node.id.name }
|
|
1364
1500
|
});
|
|
1365
1501
|
}
|
|
1366
|
-
if (init.type ===
|
|
1502
|
+
if (init.type === AST_NODE_TYPES15.FunctionExpression) {
|
|
1367
1503
|
if (isCallbackContext(init)) {
|
|
1368
1504
|
return;
|
|
1369
1505
|
}
|
|
@@ -1380,11 +1516,11 @@ var preferFunctionDeclaration = createRule17({
|
|
|
1380
1516
|
var prefer_function_declaration_default = preferFunctionDeclaration;
|
|
1381
1517
|
|
|
1382
1518
|
// src/rules/prefer-import-type.ts
|
|
1383
|
-
import { AST_NODE_TYPES as
|
|
1384
|
-
var
|
|
1519
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES16, ESLintUtils as ESLintUtils19 } from "@typescript-eslint/utils";
|
|
1520
|
+
var createRule19 = ESLintUtils19.RuleCreator(
|
|
1385
1521
|
(name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
|
|
1386
1522
|
);
|
|
1387
|
-
var preferImportType =
|
|
1523
|
+
var preferImportType = createRule19({
|
|
1388
1524
|
name: "prefer-import-type",
|
|
1389
1525
|
meta: {
|
|
1390
1526
|
type: "suggestion",
|
|
@@ -1403,22 +1539,22 @@ var preferImportType = createRule18({
|
|
|
1403
1539
|
let current = node;
|
|
1404
1540
|
while (current) {
|
|
1405
1541
|
switch (current.type) {
|
|
1406
|
-
case
|
|
1407
|
-
case
|
|
1408
|
-
case
|
|
1409
|
-
case
|
|
1410
|
-
case
|
|
1411
|
-
case
|
|
1412
|
-
case
|
|
1413
|
-
case
|
|
1414
|
-
case
|
|
1415
|
-
case
|
|
1416
|
-
case
|
|
1417
|
-
case
|
|
1418
|
-
case
|
|
1542
|
+
case AST_NODE_TYPES16.TSTypeReference:
|
|
1543
|
+
case AST_NODE_TYPES16.TSTypeAnnotation:
|
|
1544
|
+
case AST_NODE_TYPES16.TSTypeParameterInstantiation:
|
|
1545
|
+
case AST_NODE_TYPES16.TSInterfaceHeritage:
|
|
1546
|
+
case AST_NODE_TYPES16.TSClassImplements:
|
|
1547
|
+
case AST_NODE_TYPES16.TSTypeQuery:
|
|
1548
|
+
case AST_NODE_TYPES16.TSTypeAssertion:
|
|
1549
|
+
case AST_NODE_TYPES16.TSAsExpression:
|
|
1550
|
+
case AST_NODE_TYPES16.TSSatisfiesExpression:
|
|
1551
|
+
case AST_NODE_TYPES16.TSTypeAliasDeclaration:
|
|
1552
|
+
case AST_NODE_TYPES16.TSInterfaceDeclaration:
|
|
1553
|
+
case AST_NODE_TYPES16.TSTypeParameter:
|
|
1554
|
+
case AST_NODE_TYPES16.TSQualifiedName:
|
|
1419
1555
|
return true;
|
|
1420
|
-
case
|
|
1421
|
-
case
|
|
1556
|
+
case AST_NODE_TYPES16.MemberExpression:
|
|
1557
|
+
case AST_NODE_TYPES16.Identifier:
|
|
1422
1558
|
current = current.parent;
|
|
1423
1559
|
break;
|
|
1424
1560
|
default:
|
|
@@ -1448,26 +1584,26 @@ var preferImportType = createRule18({
|
|
|
1448
1584
|
return false;
|
|
1449
1585
|
}
|
|
1450
1586
|
switch (parent.type) {
|
|
1451
|
-
case
|
|
1452
|
-
case
|
|
1453
|
-
case
|
|
1454
|
-
case
|
|
1455
|
-
case
|
|
1456
|
-
case
|
|
1457
|
-
case
|
|
1458
|
-
case
|
|
1459
|
-
case
|
|
1460
|
-
case
|
|
1461
|
-
case
|
|
1462
|
-
case
|
|
1463
|
-
case
|
|
1464
|
-
case
|
|
1465
|
-
case
|
|
1466
|
-
case
|
|
1467
|
-
case
|
|
1468
|
-
case
|
|
1469
|
-
case
|
|
1470
|
-
case
|
|
1587
|
+
case AST_NODE_TYPES16.CallExpression:
|
|
1588
|
+
case AST_NODE_TYPES16.NewExpression:
|
|
1589
|
+
case AST_NODE_TYPES16.JSXOpeningElement:
|
|
1590
|
+
case AST_NODE_TYPES16.JSXClosingElement:
|
|
1591
|
+
case AST_NODE_TYPES16.MemberExpression:
|
|
1592
|
+
case AST_NODE_TYPES16.VariableDeclarator:
|
|
1593
|
+
case AST_NODE_TYPES16.TaggedTemplateExpression:
|
|
1594
|
+
case AST_NODE_TYPES16.SpreadElement:
|
|
1595
|
+
case AST_NODE_TYPES16.ExportSpecifier:
|
|
1596
|
+
case AST_NODE_TYPES16.ArrayExpression:
|
|
1597
|
+
case AST_NODE_TYPES16.ObjectExpression:
|
|
1598
|
+
case AST_NODE_TYPES16.BinaryExpression:
|
|
1599
|
+
case AST_NODE_TYPES16.LogicalExpression:
|
|
1600
|
+
case AST_NODE_TYPES16.UnaryExpression:
|
|
1601
|
+
case AST_NODE_TYPES16.ReturnStatement:
|
|
1602
|
+
case AST_NODE_TYPES16.ArrowFunctionExpression:
|
|
1603
|
+
case AST_NODE_TYPES16.ConditionalExpression:
|
|
1604
|
+
case AST_NODE_TYPES16.AwaitExpression:
|
|
1605
|
+
case AST_NODE_TYPES16.YieldExpression:
|
|
1606
|
+
case AST_NODE_TYPES16.Property:
|
|
1471
1607
|
return true;
|
|
1472
1608
|
default:
|
|
1473
1609
|
return false;
|
|
@@ -1491,13 +1627,13 @@ var preferImportType = createRule18({
|
|
|
1491
1627
|
}
|
|
1492
1628
|
const scope = context.sourceCode.getScope(node);
|
|
1493
1629
|
const isTypeOnlyImport = node.specifiers.every((specifier) => {
|
|
1494
|
-
if (specifier.type ===
|
|
1630
|
+
if (specifier.type === AST_NODE_TYPES16.ImportDefaultSpecifier) {
|
|
1495
1631
|
return false;
|
|
1496
1632
|
}
|
|
1497
|
-
if (specifier.type ===
|
|
1633
|
+
if (specifier.type === AST_NODE_TYPES16.ImportNamespaceSpecifier) {
|
|
1498
1634
|
return false;
|
|
1499
1635
|
}
|
|
1500
|
-
if (specifier.type ===
|
|
1636
|
+
if (specifier.type === AST_NODE_TYPES16.ImportSpecifier) {
|
|
1501
1637
|
const localName = specifier.local.name;
|
|
1502
1638
|
return !isUsedAsValue(localName, scope);
|
|
1503
1639
|
}
|
|
@@ -1523,11 +1659,11 @@ var preferImportType = createRule18({
|
|
|
1523
1659
|
var prefer_import_type_default = preferImportType;
|
|
1524
1660
|
|
|
1525
1661
|
// src/rules/prefer-interface-over-inline-types.ts
|
|
1526
|
-
import { AST_NODE_TYPES as
|
|
1527
|
-
var
|
|
1662
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES17, ESLintUtils as ESLintUtils20 } from "@typescript-eslint/utils";
|
|
1663
|
+
var createRule20 = ESLintUtils20.RuleCreator(
|
|
1528
1664
|
(name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
|
|
1529
1665
|
);
|
|
1530
|
-
var preferInterfaceOverInlineTypes =
|
|
1666
|
+
var preferInterfaceOverInlineTypes = createRule20({
|
|
1531
1667
|
name: "prefer-interface-over-inline-types",
|
|
1532
1668
|
meta: {
|
|
1533
1669
|
type: "suggestion",
|
|
@@ -1543,54 +1679,54 @@ var preferInterfaceOverInlineTypes = createRule19({
|
|
|
1543
1679
|
defaultOptions: [],
|
|
1544
1680
|
create(context) {
|
|
1545
1681
|
function hasJSXInConditional(node) {
|
|
1546
|
-
return node.consequent.type ===
|
|
1682
|
+
return node.consequent.type === AST_NODE_TYPES17.JSXElement || node.consequent.type === AST_NODE_TYPES17.JSXFragment || node.alternate.type === AST_NODE_TYPES17.JSXElement || node.alternate.type === AST_NODE_TYPES17.JSXFragment;
|
|
1547
1683
|
}
|
|
1548
1684
|
function hasJSXInLogical(node) {
|
|
1549
|
-
return node.right.type ===
|
|
1685
|
+
return node.right.type === AST_NODE_TYPES17.JSXElement || node.right.type === AST_NODE_TYPES17.JSXFragment;
|
|
1550
1686
|
}
|
|
1551
1687
|
function hasJSXReturn(block) {
|
|
1552
1688
|
return block.body.some((stmt) => {
|
|
1553
|
-
if (stmt.type ===
|
|
1554
|
-
return stmt.argument.type ===
|
|
1689
|
+
if (stmt.type === AST_NODE_TYPES17.ReturnStatement && stmt.argument) {
|
|
1690
|
+
return stmt.argument.type === AST_NODE_TYPES17.JSXElement || stmt.argument.type === AST_NODE_TYPES17.JSXFragment || stmt.argument.type === AST_NODE_TYPES17.ConditionalExpression && hasJSXInConditional(stmt.argument) || stmt.argument.type === AST_NODE_TYPES17.LogicalExpression && hasJSXInLogical(stmt.argument);
|
|
1555
1691
|
}
|
|
1556
1692
|
return false;
|
|
1557
1693
|
});
|
|
1558
1694
|
}
|
|
1559
1695
|
function isReactComponent2(node) {
|
|
1560
|
-
if (node.type ===
|
|
1561
|
-
if (node.body.type ===
|
|
1696
|
+
if (node.type === AST_NODE_TYPES17.ArrowFunctionExpression) {
|
|
1697
|
+
if (node.body.type === AST_NODE_TYPES17.JSXElement || node.body.type === AST_NODE_TYPES17.JSXFragment) {
|
|
1562
1698
|
return true;
|
|
1563
1699
|
}
|
|
1564
|
-
if (node.body.type ===
|
|
1700
|
+
if (node.body.type === AST_NODE_TYPES17.BlockStatement) {
|
|
1565
1701
|
return hasJSXReturn(node.body);
|
|
1566
1702
|
}
|
|
1567
|
-
} else if (node.type ===
|
|
1568
|
-
if (node.body && node.body.type ===
|
|
1703
|
+
} else if (node.type === AST_NODE_TYPES17.FunctionExpression || node.type === AST_NODE_TYPES17.FunctionDeclaration) {
|
|
1704
|
+
if (node.body && node.body.type === AST_NODE_TYPES17.BlockStatement) {
|
|
1569
1705
|
return hasJSXReturn(node.body);
|
|
1570
1706
|
}
|
|
1571
1707
|
}
|
|
1572
1708
|
return false;
|
|
1573
1709
|
}
|
|
1574
1710
|
function isInlineTypeAnnotation(node) {
|
|
1575
|
-
if (node.type ===
|
|
1711
|
+
if (node.type === AST_NODE_TYPES17.TSTypeLiteral) {
|
|
1576
1712
|
return true;
|
|
1577
1713
|
}
|
|
1578
|
-
if (node.type ===
|
|
1579
|
-
return node.typeArguments.params.some((param) => param.type ===
|
|
1714
|
+
if (node.type === AST_NODE_TYPES17.TSTypeReference && node.typeArguments) {
|
|
1715
|
+
return node.typeArguments.params.some((param) => param.type === AST_NODE_TYPES17.TSTypeLiteral);
|
|
1580
1716
|
}
|
|
1581
|
-
if (node.type ===
|
|
1717
|
+
if (node.type === AST_NODE_TYPES17.TSUnionType) {
|
|
1582
1718
|
return node.types.some((type) => isInlineTypeAnnotation(type));
|
|
1583
1719
|
}
|
|
1584
1720
|
return false;
|
|
1585
1721
|
}
|
|
1586
1722
|
function hasInlineObjectType(node) {
|
|
1587
|
-
if (node.type ===
|
|
1723
|
+
if (node.type === AST_NODE_TYPES17.TSTypeLiteral) {
|
|
1588
1724
|
return true;
|
|
1589
1725
|
}
|
|
1590
|
-
if (node.type ===
|
|
1591
|
-
return node.typeArguments.params.some((param) => param.type ===
|
|
1726
|
+
if (node.type === AST_NODE_TYPES17.TSTypeReference && node.typeArguments) {
|
|
1727
|
+
return node.typeArguments.params.some((param) => param.type === AST_NODE_TYPES17.TSTypeLiteral);
|
|
1592
1728
|
}
|
|
1593
|
-
if (node.type ===
|
|
1729
|
+
if (node.type === AST_NODE_TYPES17.TSUnionType) {
|
|
1594
1730
|
return node.types.some((type) => hasInlineObjectType(type));
|
|
1595
1731
|
}
|
|
1596
1732
|
return false;
|
|
@@ -1603,7 +1739,7 @@ var preferInterfaceOverInlineTypes = createRule19({
|
|
|
1603
1739
|
return;
|
|
1604
1740
|
}
|
|
1605
1741
|
const param = node.params[0];
|
|
1606
|
-
if (param.type ===
|
|
1742
|
+
if (param.type === AST_NODE_TYPES17.Identifier && param.typeAnnotation) {
|
|
1607
1743
|
const { typeAnnotation } = param.typeAnnotation;
|
|
1608
1744
|
if (isInlineTypeAnnotation(typeAnnotation) && hasInlineObjectType(typeAnnotation)) {
|
|
1609
1745
|
context.report({
|
|
@@ -1623,11 +1759,11 @@ var preferInterfaceOverInlineTypes = createRule19({
|
|
|
1623
1759
|
var prefer_interface_over_inline_types_default = preferInterfaceOverInlineTypes;
|
|
1624
1760
|
|
|
1625
1761
|
// src/rules/prefer-jsx-template-literals.ts
|
|
1626
|
-
import { AST_NODE_TYPES as
|
|
1627
|
-
var
|
|
1762
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES18, ESLintUtils as ESLintUtils21 } from "@typescript-eslint/utils";
|
|
1763
|
+
var createRule21 = ESLintUtils21.RuleCreator(
|
|
1628
1764
|
(name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
|
|
1629
1765
|
);
|
|
1630
|
-
var preferJSXTemplateLiterals =
|
|
1766
|
+
var preferJSXTemplateLiterals = createRule21({
|
|
1631
1767
|
name: "prefer-jsx-template-literals",
|
|
1632
1768
|
meta: {
|
|
1633
1769
|
type: "suggestion",
|
|
@@ -1696,9 +1832,9 @@ var preferJSXTemplateLiterals = createRule20({
|
|
|
1696
1832
|
if (!child || !nextChild) {
|
|
1697
1833
|
return;
|
|
1698
1834
|
}
|
|
1699
|
-
if (child.type ===
|
|
1835
|
+
if (child.type === AST_NODE_TYPES18.JSXText && nextChild.type === AST_NODE_TYPES18.JSXExpressionContainer) {
|
|
1700
1836
|
handleTextBeforeExpression(child, nextChild);
|
|
1701
|
-
} else if (child.type ===
|
|
1837
|
+
} else if (child.type === AST_NODE_TYPES18.JSXExpressionContainer && nextChild.type === AST_NODE_TYPES18.JSXText) {
|
|
1702
1838
|
handleExpressionBeforeText(child, nextChild);
|
|
1703
1839
|
}
|
|
1704
1840
|
}
|
|
@@ -1711,11 +1847,11 @@ var preferJSXTemplateLiterals = createRule20({
|
|
|
1711
1847
|
var prefer_jsx_template_literals_default = preferJSXTemplateLiterals;
|
|
1712
1848
|
|
|
1713
1849
|
// src/rules/prefer-named-param-types.ts
|
|
1714
|
-
import { AST_NODE_TYPES as
|
|
1715
|
-
var
|
|
1850
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES19, ESLintUtils as ESLintUtils22 } from "@typescript-eslint/utils";
|
|
1851
|
+
var createRule22 = ESLintUtils22.RuleCreator(
|
|
1716
1852
|
(name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
|
|
1717
1853
|
);
|
|
1718
|
-
var preferNamedParamTypes =
|
|
1854
|
+
var preferNamedParamTypes = createRule22({
|
|
1719
1855
|
name: "prefer-named-param-types",
|
|
1720
1856
|
meta: {
|
|
1721
1857
|
type: "suggestion",
|
|
@@ -1730,16 +1866,16 @@ var preferNamedParamTypes = createRule21({
|
|
|
1730
1866
|
defaultOptions: [],
|
|
1731
1867
|
create(context) {
|
|
1732
1868
|
function hasInlineObjectType(param) {
|
|
1733
|
-
if (param.type ===
|
|
1869
|
+
if (param.type === AST_NODE_TYPES19.AssignmentPattern) {
|
|
1734
1870
|
return hasInlineObjectType(param.left);
|
|
1735
1871
|
}
|
|
1736
|
-
if (param.type ===
|
|
1737
|
-
if (param.typeAnnotation?.typeAnnotation.type ===
|
|
1872
|
+
if (param.type === AST_NODE_TYPES19.ObjectPattern) {
|
|
1873
|
+
if (param.typeAnnotation?.typeAnnotation.type === AST_NODE_TYPES19.TSTypeLiteral) {
|
|
1738
1874
|
return true;
|
|
1739
1875
|
}
|
|
1740
1876
|
}
|
|
1741
|
-
if (param.type ===
|
|
1742
|
-
if (param.typeAnnotation?.typeAnnotation.type ===
|
|
1877
|
+
if (param.type === AST_NODE_TYPES19.Identifier) {
|
|
1878
|
+
if (param.typeAnnotation?.typeAnnotation.type === AST_NODE_TYPES19.TSTypeLiteral) {
|
|
1743
1879
|
return true;
|
|
1744
1880
|
}
|
|
1745
1881
|
}
|
|
@@ -1773,11 +1909,11 @@ var preferNamedParamTypes = createRule21({
|
|
|
1773
1909
|
var prefer_named_param_types_default = preferNamedParamTypes;
|
|
1774
1910
|
|
|
1775
1911
|
// src/rules/prefer-react-import-types.ts
|
|
1776
|
-
import { AST_NODE_TYPES as
|
|
1777
|
-
var
|
|
1912
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES20, ESLintUtils as ESLintUtils23 } from "@typescript-eslint/utils";
|
|
1913
|
+
var createRule23 = ESLintUtils23.RuleCreator(
|
|
1778
1914
|
(name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
|
|
1779
1915
|
);
|
|
1780
|
-
var preferReactImportTypes =
|
|
1916
|
+
var preferReactImportTypes = createRule23({
|
|
1781
1917
|
name: "prefer-react-import-types",
|
|
1782
1918
|
meta: {
|
|
1783
1919
|
type: "suggestion",
|
|
@@ -1853,7 +1989,7 @@ var preferReactImportTypes = createRule22({
|
|
|
1853
1989
|
]);
|
|
1854
1990
|
const allReactExports = /* @__PURE__ */ new Set([...reactTypes, ...reactRuntimeExports]);
|
|
1855
1991
|
function checkMemberExpression(node) {
|
|
1856
|
-
if (node.object.type ===
|
|
1992
|
+
if (node.object.type === AST_NODE_TYPES20.Identifier && node.object.name === "React" && node.property.type === AST_NODE_TYPES20.Identifier && allReactExports.has(node.property.name)) {
|
|
1857
1993
|
const typeName = node.property.name;
|
|
1858
1994
|
const isType = reactTypes.has(typeName);
|
|
1859
1995
|
const importStatement = isType ? `import type { ${typeName} } from "react"` : `import { ${typeName} } from "react"`;
|
|
@@ -1870,7 +2006,7 @@ var preferReactImportTypes = createRule22({
|
|
|
1870
2006
|
return {
|
|
1871
2007
|
MemberExpression: checkMemberExpression,
|
|
1872
2008
|
"TSTypeReference > TSQualifiedName": (node) => {
|
|
1873
|
-
if (node.left.type ===
|
|
2009
|
+
if (node.left.type === AST_NODE_TYPES20.Identifier && node.left.name === "React" && node.right.type === AST_NODE_TYPES20.Identifier && allReactExports.has(node.right.name)) {
|
|
1874
2010
|
const typeName = node.right.name;
|
|
1875
2011
|
const isType = reactTypes.has(typeName);
|
|
1876
2012
|
const importStatement = isType ? `import type { ${typeName} } from "react"` : `import { ${typeName} } from "react"`;
|
|
@@ -1890,11 +2026,11 @@ var preferReactImportTypes = createRule22({
|
|
|
1890
2026
|
var prefer_react_import_types_default = preferReactImportTypes;
|
|
1891
2027
|
|
|
1892
2028
|
// src/rules/react-props-destructure.ts
|
|
1893
|
-
import { AST_NODE_TYPES as
|
|
1894
|
-
var
|
|
2029
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES21, ESLintUtils as ESLintUtils24 } from "@typescript-eslint/utils";
|
|
2030
|
+
var createRule24 = ESLintUtils24.RuleCreator(
|
|
1895
2031
|
(name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
|
|
1896
2032
|
);
|
|
1897
|
-
var reactPropsDestructure =
|
|
2033
|
+
var reactPropsDestructure = createRule24({
|
|
1898
2034
|
name: "react-props-destructure",
|
|
1899
2035
|
meta: {
|
|
1900
2036
|
type: "suggestion",
|
|
@@ -1910,29 +2046,29 @@ var reactPropsDestructure = createRule23({
|
|
|
1910
2046
|
defaultOptions: [],
|
|
1911
2047
|
create(context) {
|
|
1912
2048
|
function hasJSXInConditional(node) {
|
|
1913
|
-
return node.consequent.type ===
|
|
2049
|
+
return node.consequent.type === AST_NODE_TYPES21.JSXElement || node.consequent.type === AST_NODE_TYPES21.JSXFragment || node.alternate.type === AST_NODE_TYPES21.JSXElement || node.alternate.type === AST_NODE_TYPES21.JSXFragment;
|
|
1914
2050
|
}
|
|
1915
2051
|
function hasJSXInLogical(node) {
|
|
1916
|
-
return node.right.type ===
|
|
2052
|
+
return node.right.type === AST_NODE_TYPES21.JSXElement || node.right.type === AST_NODE_TYPES21.JSXFragment;
|
|
1917
2053
|
}
|
|
1918
2054
|
function hasJSXReturn(block) {
|
|
1919
2055
|
return block.body.some((stmt) => {
|
|
1920
|
-
if (stmt.type ===
|
|
1921
|
-
return stmt.argument.type ===
|
|
2056
|
+
if (stmt.type === AST_NODE_TYPES21.ReturnStatement && stmt.argument) {
|
|
2057
|
+
return stmt.argument.type === AST_NODE_TYPES21.JSXElement || stmt.argument.type === AST_NODE_TYPES21.JSXFragment || stmt.argument.type === AST_NODE_TYPES21.ConditionalExpression && hasJSXInConditional(stmt.argument) || stmt.argument.type === AST_NODE_TYPES21.LogicalExpression && hasJSXInLogical(stmt.argument);
|
|
1922
2058
|
}
|
|
1923
2059
|
return false;
|
|
1924
2060
|
});
|
|
1925
2061
|
}
|
|
1926
2062
|
function isReactComponent2(node) {
|
|
1927
|
-
if (node.type ===
|
|
1928
|
-
if (node.body.type ===
|
|
2063
|
+
if (node.type === AST_NODE_TYPES21.ArrowFunctionExpression) {
|
|
2064
|
+
if (node.body.type === AST_NODE_TYPES21.JSXElement || node.body.type === AST_NODE_TYPES21.JSXFragment) {
|
|
1929
2065
|
return true;
|
|
1930
2066
|
}
|
|
1931
|
-
if (node.body.type ===
|
|
2067
|
+
if (node.body.type === AST_NODE_TYPES21.BlockStatement) {
|
|
1932
2068
|
return hasJSXReturn(node.body);
|
|
1933
2069
|
}
|
|
1934
|
-
} else if (node.type ===
|
|
1935
|
-
if (node.body && node.body.type ===
|
|
2070
|
+
} else if (node.type === AST_NODE_TYPES21.FunctionExpression || node.type === AST_NODE_TYPES21.FunctionDeclaration) {
|
|
2071
|
+
if (node.body && node.body.type === AST_NODE_TYPES21.BlockStatement) {
|
|
1936
2072
|
return hasJSXReturn(node.body);
|
|
1937
2073
|
}
|
|
1938
2074
|
}
|
|
@@ -1946,9 +2082,9 @@ var reactPropsDestructure = createRule23({
|
|
|
1946
2082
|
return;
|
|
1947
2083
|
}
|
|
1948
2084
|
const param = node.params[0];
|
|
1949
|
-
if (param.type ===
|
|
1950
|
-
const properties = param.properties.filter((prop) => prop.type ===
|
|
1951
|
-
if (prop.key.type ===
|
|
2085
|
+
if (param.type === AST_NODE_TYPES21.ObjectPattern) {
|
|
2086
|
+
const properties = param.properties.filter((prop) => prop.type === AST_NODE_TYPES21.Property).map((prop) => {
|
|
2087
|
+
if (prop.key.type === AST_NODE_TYPES21.Identifier) {
|
|
1952
2088
|
return prop.key.name;
|
|
1953
2089
|
}
|
|
1954
2090
|
return null;
|
|
@@ -1993,6 +2129,7 @@ var rules = {
|
|
|
1993
2129
|
"no-emoji": no_emoji_default,
|
|
1994
2130
|
"no-env-fallback": no_env_fallback_default,
|
|
1995
2131
|
"require-explicit-return-type": require_explicit_return_type_default,
|
|
2132
|
+
"no-lazy-identifiers": no_lazy_identifiers_default,
|
|
1996
2133
|
"no-logic-in-params": no_logic_in_params_default,
|
|
1997
2134
|
"no-single-char-variables": no_single_char_variables_default,
|
|
1998
2135
|
"prefer-destructuring-params": prefer_destructuring_params_default,
|
|
@@ -2024,6 +2161,7 @@ var baseRules = {
|
|
|
2024
2161
|
"nextfriday/no-direct-date": "warn",
|
|
2025
2162
|
"nextfriday/no-logic-in-params": "warn",
|
|
2026
2163
|
"nextfriday/no-env-fallback": "warn",
|
|
2164
|
+
"nextfriday/no-lazy-identifiers": "warn",
|
|
2027
2165
|
"nextfriday/no-single-char-variables": "warn"
|
|
2028
2166
|
};
|
|
2029
2167
|
var baseRecommendedRules = {
|
|
@@ -2042,6 +2180,7 @@ var baseRecommendedRules = {
|
|
|
2042
2180
|
"nextfriday/no-direct-date": "error",
|
|
2043
2181
|
"nextfriday/no-logic-in-params": "error",
|
|
2044
2182
|
"nextfriday/no-env-fallback": "error",
|
|
2183
|
+
"nextfriday/no-lazy-identifiers": "error",
|
|
2045
2184
|
"nextfriday/no-single-char-variables": "error"
|
|
2046
2185
|
};
|
|
2047
2186
|
var jsxRules = {
|