eslint-plugin-nextfriday 1.8.0 → 1.9.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/lib/index.cjs CHANGED
@@ -40,7 +40,7 @@ module.exports = __toCommonJS(index_exports);
40
40
  // package.json
41
41
  var package_default = {
42
42
  name: "eslint-plugin-nextfriday",
43
- version: "1.8.0",
43
+ version: "1.9.0",
44
44
  description: "A comprehensive ESLint plugin providing custom rules and configurations for Next Friday development workflows.",
45
45
  keywords: [
46
46
  "eslint",
@@ -892,58 +892,124 @@ var noEnvFallback = createRule11({
892
892
  });
893
893
  var no_env_fallback_default = noEnvFallback;
894
894
 
895
- // src/rules/require-explicit-return-type.ts
895
+ // src/rules/no-inline-default-export.ts
896
896
  var import_utils12 = require("@typescript-eslint/utils");
897
897
  var createRule12 = import_utils12.ESLintUtils.RuleCreator(
898
898
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
899
899
  );
900
+ var noInlineDefaultExport = createRule12({
901
+ name: "no-inline-default-export",
902
+ meta: {
903
+ type: "suggestion",
904
+ docs: {
905
+ description: "Disallow inline default exports. Prefer declaring first, then exporting separately."
906
+ },
907
+ messages: {
908
+ noInlineDefaultExport: "Avoid inline default export. Declare the {{type}} first, then export it separately: `export default {{name}};`",
909
+ noAnonymousDefaultExport: "Avoid anonymous default export. Declare a named {{type}} first, then export it separately."
910
+ },
911
+ schema: []
912
+ },
913
+ defaultOptions: [],
914
+ create(context) {
915
+ return {
916
+ ExportDefaultDeclaration(node) {
917
+ const { declaration } = node;
918
+ if (declaration.type === import_utils12.AST_NODE_TYPES.FunctionDeclaration) {
919
+ if (declaration.id) {
920
+ context.report({
921
+ node,
922
+ messageId: "noInlineDefaultExport",
923
+ data: { type: "function", name: declaration.id.name }
924
+ });
925
+ } else {
926
+ context.report({
927
+ node,
928
+ messageId: "noAnonymousDefaultExport",
929
+ data: { type: "function" }
930
+ });
931
+ }
932
+ }
933
+ if (declaration.type === import_utils12.AST_NODE_TYPES.ClassDeclaration) {
934
+ if (declaration.id) {
935
+ context.report({
936
+ node,
937
+ messageId: "noInlineDefaultExport",
938
+ data: { type: "class", name: declaration.id.name }
939
+ });
940
+ } else {
941
+ context.report({
942
+ node,
943
+ messageId: "noAnonymousDefaultExport",
944
+ data: { type: "class" }
945
+ });
946
+ }
947
+ }
948
+ if (declaration.type === import_utils12.AST_NODE_TYPES.ArrowFunctionExpression || declaration.type === import_utils12.AST_NODE_TYPES.FunctionExpression) {
949
+ context.report({
950
+ node,
951
+ messageId: "noAnonymousDefaultExport",
952
+ data: { type: "function" }
953
+ });
954
+ }
955
+ }
956
+ };
957
+ }
958
+ });
959
+ var no_inline_default_export_default = noInlineDefaultExport;
960
+
961
+ // src/rules/require-explicit-return-type.ts
962
+ var import_utils13 = require("@typescript-eslint/utils");
963
+ var createRule13 = import_utils13.ESLintUtils.RuleCreator(
964
+ (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
965
+ );
900
966
  var isReactComponent = (node) => {
901
- if (node.type === import_utils12.AST_NODE_TYPES.ArrowFunctionExpression) {
967
+ if (node.type === import_utils13.AST_NODE_TYPES.ArrowFunctionExpression) {
902
968
  const { parent } = node;
903
- if (parent?.type === import_utils12.AST_NODE_TYPES.VariableDeclarator) {
969
+ if (parent?.type === import_utils13.AST_NODE_TYPES.VariableDeclarator) {
904
970
  const { id } = parent;
905
- if (id.type === import_utils12.AST_NODE_TYPES.Identifier) {
971
+ if (id.type === import_utils13.AST_NODE_TYPES.Identifier) {
906
972
  return /^[A-Z]/.test(id.name);
907
973
  }
908
974
  }
909
975
  }
910
- if (node.type === import_utils12.AST_NODE_TYPES.FunctionDeclaration && node.id) {
976
+ if (node.type === import_utils13.AST_NODE_TYPES.FunctionDeclaration && node.id) {
911
977
  return /^[A-Z]/.test(node.id.name);
912
978
  }
913
979
  return false;
914
980
  };
915
981
  var isCallbackFunction = (node) => {
916
- if (node.type === import_utils12.AST_NODE_TYPES.FunctionDeclaration) {
982
+ if (node.type === import_utils13.AST_NODE_TYPES.FunctionDeclaration) {
917
983
  return false;
918
984
  }
919
985
  const { parent } = node;
920
986
  if (!parent) {
921
987
  return false;
922
988
  }
923
- if (parent.type === import_utils12.AST_NODE_TYPES.CallExpression && parent.arguments.includes(node)) {
989
+ if (parent.type === import_utils13.AST_NODE_TYPES.CallExpression && parent.arguments.includes(node)) {
924
990
  return true;
925
991
  }
926
- if (parent.type === import_utils12.AST_NODE_TYPES.Property) {
992
+ if (parent.type === import_utils13.AST_NODE_TYPES.Property) {
927
993
  return true;
928
994
  }
929
- if (parent.type === import_utils12.AST_NODE_TYPES.ArrayExpression) {
995
+ if (parent.type === import_utils13.AST_NODE_TYPES.ArrayExpression) {
930
996
  return true;
931
997
  }
932
998
  return false;
933
999
  };
934
1000
  var getFunctionName = (node) => {
935
- if (node.type === import_utils12.AST_NODE_TYPES.FunctionDeclaration && node.id) {
1001
+ if (node.type === import_utils13.AST_NODE_TYPES.FunctionDeclaration && node.id) {
936
1002
  return node.id.name;
937
1003
  }
938
- if (node.type === import_utils12.AST_NODE_TYPES.FunctionExpression && node.id) {
1004
+ if (node.type === import_utils13.AST_NODE_TYPES.FunctionExpression && node.id) {
939
1005
  return node.id.name;
940
1006
  }
941
- if ((node.type === import_utils12.AST_NODE_TYPES.ArrowFunctionExpression || node.type === import_utils12.AST_NODE_TYPES.FunctionExpression) && node.parent?.type === import_utils12.AST_NODE_TYPES.VariableDeclarator && node.parent.id.type === import_utils12.AST_NODE_TYPES.Identifier) {
1007
+ if ((node.type === import_utils13.AST_NODE_TYPES.ArrowFunctionExpression || node.type === import_utils13.AST_NODE_TYPES.FunctionExpression) && node.parent?.type === import_utils13.AST_NODE_TYPES.VariableDeclarator && node.parent.id.type === import_utils13.AST_NODE_TYPES.Identifier) {
942
1008
  return node.parent.id.name;
943
1009
  }
944
1010
  return null;
945
1011
  };
946
- var requireExplicitReturnType = createRule12({
1012
+ var requireExplicitReturnType = createRule13({
947
1013
  name: "require-explicit-return-type",
948
1014
  meta: {
949
1015
  type: "suggestion",
@@ -992,18 +1058,18 @@ var requireExplicitReturnType = createRule12({
992
1058
  var require_explicit_return_type_default = requireExplicitReturnType;
993
1059
 
994
1060
  // src/rules/jsx-no-non-component-function.ts
995
- var import_utils14 = require("@typescript-eslint/utils");
1061
+ var import_utils15 = require("@typescript-eslint/utils");
996
1062
 
997
1063
  // src/utils.ts
998
1064
  var import_node_path = require("path");
999
- var import_utils13 = require("@typescript-eslint/utils");
1065
+ var import_utils14 = require("@typescript-eslint/utils");
1000
1066
  var getFileExtension = (filename) => (0, import_node_path.extname)(filename).slice(1);
1001
1067
 
1002
1068
  // src/rules/jsx-no-non-component-function.ts
1003
- var createRule13 = import_utils14.ESLintUtils.RuleCreator(
1069
+ var createRule14 = import_utils15.ESLintUtils.RuleCreator(
1004
1070
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1005
1071
  );
1006
- var jsxNoNonComponentFunction = createRule13({
1072
+ var jsxNoNonComponentFunction = createRule14({
1007
1073
  name: "jsx-no-non-component-function",
1008
1074
  meta: {
1009
1075
  type: "problem",
@@ -1023,13 +1089,13 @@ var jsxNoNonComponentFunction = createRule13({
1023
1089
  return {};
1024
1090
  }
1025
1091
  function isReactComponent2(node) {
1026
- const functionName = node.type === import_utils14.AST_NODE_TYPES.FunctionDeclaration && node.id ? node.id.name : null;
1092
+ const functionName = node.type === import_utils15.AST_NODE_TYPES.FunctionDeclaration && node.id ? node.id.name : null;
1027
1093
  if (functionName && /^[A-Z]/.test(functionName)) {
1028
1094
  return true;
1029
1095
  }
1030
1096
  if (node.returnType?.typeAnnotation) {
1031
1097
  const returnTypeNode = node.returnType.typeAnnotation;
1032
- if (returnTypeNode.type === import_utils14.AST_NODE_TYPES.TSTypeReference && returnTypeNode.typeName.type === import_utils14.AST_NODE_TYPES.Identifier) {
1098
+ if (returnTypeNode.type === import_utils15.AST_NODE_TYPES.TSTypeReference && returnTypeNode.typeName.type === import_utils15.AST_NODE_TYPES.Identifier) {
1033
1099
  const typeName = returnTypeNode.typeName.name;
1034
1100
  if (typeName === "JSX" || typeName === "ReactElement" || typeName === "ReactNode") {
1035
1101
  return true;
@@ -1046,13 +1112,13 @@ var jsxNoNonComponentFunction = createRule13({
1046
1112
  if (!parent) {
1047
1113
  return;
1048
1114
  }
1049
- if (parent.type === import_utils14.AST_NODE_TYPES.ExportDefaultDeclaration || parent.type === import_utils14.AST_NODE_TYPES.ExportNamedDeclaration) {
1115
+ if (parent.type === import_utils15.AST_NODE_TYPES.ExportDefaultDeclaration || parent.type === import_utils15.AST_NODE_TYPES.ExportNamedDeclaration) {
1050
1116
  return;
1051
1117
  }
1052
- if (declaratorNode?.parent?.parent?.type === import_utils14.AST_NODE_TYPES.ExportNamedDeclaration) {
1118
+ if (declaratorNode?.parent?.parent?.type === import_utils15.AST_NODE_TYPES.ExportNamedDeclaration) {
1053
1119
  return;
1054
1120
  }
1055
- if (declaratorNode?.id.type === import_utils14.AST_NODE_TYPES.Identifier) {
1121
+ if (declaratorNode?.id.type === import_utils15.AST_NODE_TYPES.Identifier) {
1056
1122
  const varName = declaratorNode.id.name;
1057
1123
  if (/^[A-Z]/.test(varName)) {
1058
1124
  return;
@@ -1077,11 +1143,11 @@ var jsxNoNonComponentFunction = createRule13({
1077
1143
  var jsx_no_non_component_function_default = jsxNoNonComponentFunction;
1078
1144
 
1079
1145
  // src/rules/no-logic-in-params.ts
1080
- var import_utils16 = require("@typescript-eslint/utils");
1081
- var createRule14 = import_utils16.ESLintUtils.RuleCreator(
1146
+ var import_utils17 = require("@typescript-eslint/utils");
1147
+ var createRule15 = import_utils17.ESLintUtils.RuleCreator(
1082
1148
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1083
1149
  );
1084
- var noLogicInParams = createRule14({
1150
+ var noLogicInParams = createRule15({
1085
1151
  name: "no-logic-in-params",
1086
1152
  meta: {
1087
1153
  type: "suggestion",
@@ -1096,20 +1162,20 @@ var noLogicInParams = createRule14({
1096
1162
  defaultOptions: [],
1097
1163
  create(context) {
1098
1164
  const isComplexExpression = (node) => {
1099
- if (node.type === import_utils16.AST_NODE_TYPES.SpreadElement) {
1165
+ if (node.type === import_utils17.AST_NODE_TYPES.SpreadElement) {
1100
1166
  return false;
1101
1167
  }
1102
- if (node.type === import_utils16.AST_NODE_TYPES.ConditionalExpression) {
1168
+ if (node.type === import_utils17.AST_NODE_TYPES.ConditionalExpression) {
1103
1169
  return true;
1104
1170
  }
1105
- if (node.type === import_utils16.AST_NODE_TYPES.LogicalExpression) {
1171
+ if (node.type === import_utils17.AST_NODE_TYPES.LogicalExpression) {
1106
1172
  return true;
1107
1173
  }
1108
- if (node.type === import_utils16.AST_NODE_TYPES.BinaryExpression) {
1174
+ if (node.type === import_utils17.AST_NODE_TYPES.BinaryExpression) {
1109
1175
  const logicalOperators = ["==", "===", "!=", "!==", "<", ">", "<=", ">=", "in", "instanceof"];
1110
1176
  return logicalOperators.includes(node.operator);
1111
1177
  }
1112
- if (node.type === import_utils16.AST_NODE_TYPES.UnaryExpression) {
1178
+ if (node.type === import_utils17.AST_NODE_TYPES.UnaryExpression) {
1113
1179
  return node.operator === "!";
1114
1180
  }
1115
1181
  return false;
@@ -1141,8 +1207,8 @@ var noLogicInParams = createRule14({
1141
1207
  var no_logic_in_params_default = noLogicInParams;
1142
1208
 
1143
1209
  // src/rules/no-lazy-identifiers.ts
1144
- var import_utils17 = require("@typescript-eslint/utils");
1145
- var createRule15 = import_utils17.ESLintUtils.RuleCreator(
1210
+ var import_utils18 = require("@typescript-eslint/utils");
1211
+ var createRule16 = import_utils18.ESLintUtils.RuleCreator(
1146
1212
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1147
1213
  );
1148
1214
  var KEYBOARD_ROWS = ["qwertyuiop", "asdfghjkl", "zxcvbnm", "1234567890"];
@@ -1186,7 +1252,7 @@ var isLazyIdentifier = (name) => {
1186
1252
  }
1187
1253
  return false;
1188
1254
  };
1189
- var noLazyIdentifiers = createRule15({
1255
+ var noLazyIdentifiers = createRule16({
1190
1256
  name: "no-lazy-identifiers",
1191
1257
  meta: {
1192
1258
  type: "problem",
@@ -1212,27 +1278,27 @@ var noLazyIdentifiers = createRule15({
1212
1278
  });
1213
1279
  };
1214
1280
  const checkPattern = (pattern) => {
1215
- if (pattern.type === import_utils17.AST_NODE_TYPES.Identifier) {
1281
+ if (pattern.type === import_utils18.AST_NODE_TYPES.Identifier) {
1216
1282
  checkIdentifier(pattern);
1217
- } else if (pattern.type === import_utils17.AST_NODE_TYPES.ObjectPattern) {
1283
+ } else if (pattern.type === import_utils18.AST_NODE_TYPES.ObjectPattern) {
1218
1284
  pattern.properties.forEach((prop) => {
1219
- if (prop.type === import_utils17.AST_NODE_TYPES.Property && prop.value.type === import_utils17.AST_NODE_TYPES.Identifier) {
1285
+ if (prop.type === import_utils18.AST_NODE_TYPES.Property && prop.value.type === import_utils18.AST_NODE_TYPES.Identifier) {
1220
1286
  checkIdentifier(prop.value);
1221
- } else if (prop.type === import_utils17.AST_NODE_TYPES.RestElement && prop.argument.type === import_utils17.AST_NODE_TYPES.Identifier) {
1287
+ } else if (prop.type === import_utils18.AST_NODE_TYPES.RestElement && prop.argument.type === import_utils18.AST_NODE_TYPES.Identifier) {
1222
1288
  checkIdentifier(prop.argument);
1223
1289
  }
1224
1290
  });
1225
- } else if (pattern.type === import_utils17.AST_NODE_TYPES.ArrayPattern) {
1291
+ } else if (pattern.type === import_utils18.AST_NODE_TYPES.ArrayPattern) {
1226
1292
  pattern.elements.forEach((element) => {
1227
- if (element?.type === import_utils17.AST_NODE_TYPES.Identifier) {
1293
+ if (element?.type === import_utils18.AST_NODE_TYPES.Identifier) {
1228
1294
  checkIdentifier(element);
1229
- } else if (element?.type === import_utils17.AST_NODE_TYPES.RestElement && element.argument.type === import_utils17.AST_NODE_TYPES.Identifier) {
1295
+ } else if (element?.type === import_utils18.AST_NODE_TYPES.RestElement && element.argument.type === import_utils18.AST_NODE_TYPES.Identifier) {
1230
1296
  checkIdentifier(element.argument);
1231
1297
  }
1232
1298
  });
1233
- } else if (pattern.type === import_utils17.AST_NODE_TYPES.AssignmentPattern && pattern.left.type === import_utils17.AST_NODE_TYPES.Identifier) {
1299
+ } else if (pattern.type === import_utils18.AST_NODE_TYPES.AssignmentPattern && pattern.left.type === import_utils18.AST_NODE_TYPES.Identifier) {
1234
1300
  checkIdentifier(pattern.left);
1235
- } else if (pattern.type === import_utils17.AST_NODE_TYPES.RestElement && pattern.argument.type === import_utils17.AST_NODE_TYPES.Identifier) {
1301
+ } else if (pattern.type === import_utils18.AST_NODE_TYPES.RestElement && pattern.argument.type === import_utils18.AST_NODE_TYPES.Identifier) {
1236
1302
  checkIdentifier(pattern.argument);
1237
1303
  }
1238
1304
  };
@@ -1277,8 +1343,8 @@ var noLazyIdentifiers = createRule15({
1277
1343
  var no_lazy_identifiers_default = noLazyIdentifiers;
1278
1344
 
1279
1345
  // src/rules/no-single-char-variables.ts
1280
- var import_utils18 = require("@typescript-eslint/utils");
1281
- var createRule16 = import_utils18.ESLintUtils.RuleCreator(
1346
+ var import_utils19 = require("@typescript-eslint/utils");
1347
+ var createRule17 = import_utils19.ESLintUtils.RuleCreator(
1282
1348
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1283
1349
  );
1284
1350
  var ALLOWED_IN_FOR_LOOPS = /* @__PURE__ */ new Set(["i", "j", "k", "n"]);
@@ -1290,7 +1356,7 @@ var isForLoopInit = (node) => {
1290
1356
  if (!parentNode) {
1291
1357
  return false;
1292
1358
  }
1293
- if (parentNode.type === import_utils18.AST_NODE_TYPES.ForStatement) {
1359
+ if (parentNode.type === import_utils19.AST_NODE_TYPES.ForStatement) {
1294
1360
  const { init } = parentNode;
1295
1361
  if (init && init === current) {
1296
1362
  return true;
@@ -1309,7 +1375,7 @@ var isAllowedInContext = (name, node) => {
1309
1375
  }
1310
1376
  return false;
1311
1377
  };
1312
- var noSingleCharVariables = createRule16({
1378
+ var noSingleCharVariables = createRule17({
1313
1379
  name: "no-single-char-variables",
1314
1380
  meta: {
1315
1381
  type: "suggestion",
@@ -1338,27 +1404,27 @@ var noSingleCharVariables = createRule16({
1338
1404
  });
1339
1405
  };
1340
1406
  const checkPattern = (pattern, declarationNode) => {
1341
- if (pattern.type === import_utils18.AST_NODE_TYPES.Identifier) {
1407
+ if (pattern.type === import_utils19.AST_NODE_TYPES.Identifier) {
1342
1408
  checkIdentifier(pattern, declarationNode);
1343
- } else if (pattern.type === import_utils18.AST_NODE_TYPES.ObjectPattern) {
1409
+ } else if (pattern.type === import_utils19.AST_NODE_TYPES.ObjectPattern) {
1344
1410
  pattern.properties.forEach((prop) => {
1345
- if (prop.type === import_utils18.AST_NODE_TYPES.Property && prop.value.type === import_utils18.AST_NODE_TYPES.Identifier) {
1411
+ if (prop.type === import_utils19.AST_NODE_TYPES.Property && prop.value.type === import_utils19.AST_NODE_TYPES.Identifier) {
1346
1412
  checkIdentifier(prop.value, declarationNode);
1347
- } else if (prop.type === import_utils18.AST_NODE_TYPES.RestElement && prop.argument.type === import_utils18.AST_NODE_TYPES.Identifier) {
1413
+ } else if (prop.type === import_utils19.AST_NODE_TYPES.RestElement && prop.argument.type === import_utils19.AST_NODE_TYPES.Identifier) {
1348
1414
  checkIdentifier(prop.argument, declarationNode);
1349
1415
  }
1350
1416
  });
1351
- } else if (pattern.type === import_utils18.AST_NODE_TYPES.ArrayPattern) {
1417
+ } else if (pattern.type === import_utils19.AST_NODE_TYPES.ArrayPattern) {
1352
1418
  pattern.elements.forEach((element) => {
1353
- if (element?.type === import_utils18.AST_NODE_TYPES.Identifier) {
1419
+ if (element?.type === import_utils19.AST_NODE_TYPES.Identifier) {
1354
1420
  checkIdentifier(element, declarationNode);
1355
- } else if (element?.type === import_utils18.AST_NODE_TYPES.RestElement && element.argument.type === import_utils18.AST_NODE_TYPES.Identifier) {
1421
+ } else if (element?.type === import_utils19.AST_NODE_TYPES.RestElement && element.argument.type === import_utils19.AST_NODE_TYPES.Identifier) {
1356
1422
  checkIdentifier(element.argument, declarationNode);
1357
1423
  }
1358
1424
  });
1359
- } else if (pattern.type === import_utils18.AST_NODE_TYPES.AssignmentPattern && pattern.left.type === import_utils18.AST_NODE_TYPES.Identifier) {
1425
+ } else if (pattern.type === import_utils19.AST_NODE_TYPES.AssignmentPattern && pattern.left.type === import_utils19.AST_NODE_TYPES.Identifier) {
1360
1426
  checkIdentifier(pattern.left, declarationNode);
1361
- } else if (pattern.type === import_utils18.AST_NODE_TYPES.RestElement && pattern.argument.type === import_utils18.AST_NODE_TYPES.Identifier) {
1427
+ } else if (pattern.type === import_utils19.AST_NODE_TYPES.RestElement && pattern.argument.type === import_utils19.AST_NODE_TYPES.Identifier) {
1362
1428
  checkIdentifier(pattern.argument, declarationNode);
1363
1429
  }
1364
1430
  };
@@ -1392,11 +1458,11 @@ var noSingleCharVariables = createRule16({
1392
1458
  var no_single_char_variables_default = noSingleCharVariables;
1393
1459
 
1394
1460
  // src/rules/prefer-destructuring-params.ts
1395
- var import_utils19 = require("@typescript-eslint/utils");
1396
- var createRule17 = import_utils19.ESLintUtils.RuleCreator(
1461
+ var import_utils20 = require("@typescript-eslint/utils");
1462
+ var createRule18 = import_utils20.ESLintUtils.RuleCreator(
1397
1463
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1398
1464
  );
1399
- var preferDestructuringParams = createRule17({
1465
+ var preferDestructuringParams = createRule18({
1400
1466
  name: "prefer-destructuring-params",
1401
1467
  meta: {
1402
1468
  type: "suggestion",
@@ -1412,18 +1478,18 @@ var preferDestructuringParams = createRule17({
1412
1478
  create(context) {
1413
1479
  const isCallbackFunction2 = (node) => {
1414
1480
  const { parent } = node;
1415
- return parent?.type === import_utils19.AST_NODE_TYPES.CallExpression;
1481
+ return parent?.type === import_utils20.AST_NODE_TYPES.CallExpression;
1416
1482
  };
1417
1483
  const isDeveloperFunction = (node) => {
1418
- if (node.type === import_utils19.AST_NODE_TYPES.FunctionDeclaration) {
1484
+ if (node.type === import_utils20.AST_NODE_TYPES.FunctionDeclaration) {
1419
1485
  return true;
1420
1486
  }
1421
- if (node.type === import_utils19.AST_NODE_TYPES.FunctionExpression || node.type === import_utils19.AST_NODE_TYPES.ArrowFunctionExpression) {
1487
+ if (node.type === import_utils20.AST_NODE_TYPES.FunctionExpression || node.type === import_utils20.AST_NODE_TYPES.ArrowFunctionExpression) {
1422
1488
  if (isCallbackFunction2(node)) {
1423
1489
  return false;
1424
1490
  }
1425
1491
  const { parent } = node;
1426
- return parent?.type === import_utils19.AST_NODE_TYPES.VariableDeclarator || parent?.type === import_utils19.AST_NODE_TYPES.AssignmentExpression || parent?.type === import_utils19.AST_NODE_TYPES.Property || parent?.type === import_utils19.AST_NODE_TYPES.MethodDefinition;
1492
+ return parent?.type === import_utils20.AST_NODE_TYPES.VariableDeclarator || parent?.type === import_utils20.AST_NODE_TYPES.AssignmentExpression || parent?.type === import_utils20.AST_NODE_TYPES.Property || parent?.type === import_utils20.AST_NODE_TYPES.MethodDefinition;
1427
1493
  }
1428
1494
  return false;
1429
1495
  };
@@ -1435,7 +1501,7 @@ var preferDestructuringParams = createRule17({
1435
1501
  if (!isDeveloperFunction(node)) {
1436
1502
  return;
1437
1503
  }
1438
- if (node.type === import_utils19.AST_NODE_TYPES.FunctionDeclaration && node.id) {
1504
+ if (node.type === import_utils20.AST_NODE_TYPES.FunctionDeclaration && node.id) {
1439
1505
  const functionName = node.id.name;
1440
1506
  if (functionName.startsWith("_") || functionName.includes("$") || /^[A-Z][a-zA-Z]*$/.test(functionName)) {
1441
1507
  return;
@@ -1445,7 +1511,7 @@ var preferDestructuringParams = createRule17({
1445
1511
  return;
1446
1512
  }
1447
1513
  const hasNonDestructuredParams = node.params.some(
1448
- (param) => param.type !== import_utils19.AST_NODE_TYPES.ObjectPattern && param.type !== import_utils19.AST_NODE_TYPES.RestElement
1514
+ (param) => param.type !== import_utils20.AST_NODE_TYPES.ObjectPattern && param.type !== import_utils20.AST_NODE_TYPES.RestElement
1449
1515
  );
1450
1516
  if (hasNonDestructuredParams) {
1451
1517
  context.report({
@@ -1464,8 +1530,8 @@ var preferDestructuringParams = createRule17({
1464
1530
  var prefer_destructuring_params_default = preferDestructuringParams;
1465
1531
 
1466
1532
  // src/rules/prefer-function-declaration.ts
1467
- var import_utils20 = require("@typescript-eslint/utils");
1468
- var createRule18 = import_utils20.ESLintUtils.RuleCreator(
1533
+ var import_utils21 = require("@typescript-eslint/utils");
1534
+ var createRule19 = import_utils21.ESLintUtils.RuleCreator(
1469
1535
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1470
1536
  );
1471
1537
  var isTsFile = (filename) => filename.endsWith(".ts") && !filename.endsWith(".d.ts");
@@ -1474,33 +1540,33 @@ var isCallbackContext = (node) => {
1474
1540
  if (!parent) {
1475
1541
  return false;
1476
1542
  }
1477
- if (parent.type === import_utils20.AST_NODE_TYPES.CallExpression && parent.arguments.includes(node)) {
1543
+ if (parent.type === import_utils21.AST_NODE_TYPES.CallExpression && parent.arguments.includes(node)) {
1478
1544
  return true;
1479
1545
  }
1480
- if (parent.type === import_utils20.AST_NODE_TYPES.NewExpression && parent.arguments.includes(node)) {
1546
+ if (parent.type === import_utils21.AST_NODE_TYPES.NewExpression && parent.arguments.includes(node)) {
1481
1547
  return true;
1482
1548
  }
1483
- if (parent.type === import_utils20.AST_NODE_TYPES.ReturnStatement) {
1549
+ if (parent.type === import_utils21.AST_NODE_TYPES.ReturnStatement) {
1484
1550
  return true;
1485
1551
  }
1486
- if (parent.type === import_utils20.AST_NODE_TYPES.Property) {
1552
+ if (parent.type === import_utils21.AST_NODE_TYPES.Property) {
1487
1553
  return true;
1488
1554
  }
1489
- if (parent.type === import_utils20.AST_NODE_TYPES.ArrayExpression) {
1555
+ if (parent.type === import_utils21.AST_NODE_TYPES.ArrayExpression) {
1490
1556
  return true;
1491
1557
  }
1492
- if (parent.type === import_utils20.AST_NODE_TYPES.ConditionalExpression) {
1558
+ if (parent.type === import_utils21.AST_NODE_TYPES.ConditionalExpression) {
1493
1559
  return true;
1494
1560
  }
1495
- if (parent.type === import_utils20.AST_NODE_TYPES.LogicalExpression) {
1561
+ if (parent.type === import_utils21.AST_NODE_TYPES.LogicalExpression) {
1496
1562
  return true;
1497
1563
  }
1498
- if (parent.type === import_utils20.AST_NODE_TYPES.AssignmentExpression && parent.left !== node) {
1564
+ if (parent.type === import_utils21.AST_NODE_TYPES.AssignmentExpression && parent.left !== node) {
1499
1565
  return true;
1500
1566
  }
1501
1567
  return false;
1502
1568
  };
1503
- var preferFunctionDeclaration = createRule18({
1569
+ var preferFunctionDeclaration = createRule19({
1504
1570
  name: "prefer-function-declaration",
1505
1571
  meta: {
1506
1572
  type: "suggestion",
@@ -1521,14 +1587,14 @@ var preferFunctionDeclaration = createRule18({
1521
1587
  }
1522
1588
  return {
1523
1589
  VariableDeclarator(node) {
1524
- if (node.id.type !== import_utils20.AST_NODE_TYPES.Identifier) {
1590
+ if (node.id.type !== import_utils21.AST_NODE_TYPES.Identifier) {
1525
1591
  return;
1526
1592
  }
1527
1593
  const { init } = node;
1528
1594
  if (!init) {
1529
1595
  return;
1530
1596
  }
1531
- if (init.type === import_utils20.AST_NODE_TYPES.ArrowFunctionExpression) {
1597
+ if (init.type === import_utils21.AST_NODE_TYPES.ArrowFunctionExpression) {
1532
1598
  if (isCallbackContext(init)) {
1533
1599
  return;
1534
1600
  }
@@ -1538,7 +1604,7 @@ var preferFunctionDeclaration = createRule18({
1538
1604
  data: { name: node.id.name }
1539
1605
  });
1540
1606
  }
1541
- if (init.type === import_utils20.AST_NODE_TYPES.FunctionExpression) {
1607
+ if (init.type === import_utils21.AST_NODE_TYPES.FunctionExpression) {
1542
1608
  if (isCallbackContext(init)) {
1543
1609
  return;
1544
1610
  }
@@ -1555,11 +1621,11 @@ var preferFunctionDeclaration = createRule18({
1555
1621
  var prefer_function_declaration_default = preferFunctionDeclaration;
1556
1622
 
1557
1623
  // src/rules/prefer-import-type.ts
1558
- var import_utils21 = require("@typescript-eslint/utils");
1559
- var createRule19 = import_utils21.ESLintUtils.RuleCreator(
1624
+ var import_utils22 = require("@typescript-eslint/utils");
1625
+ var createRule20 = import_utils22.ESLintUtils.RuleCreator(
1560
1626
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1561
1627
  );
1562
- var preferImportType = createRule19({
1628
+ var preferImportType = createRule20({
1563
1629
  name: "prefer-import-type",
1564
1630
  meta: {
1565
1631
  type: "suggestion",
@@ -1578,22 +1644,22 @@ var preferImportType = createRule19({
1578
1644
  let current = node;
1579
1645
  while (current) {
1580
1646
  switch (current.type) {
1581
- case import_utils21.AST_NODE_TYPES.TSTypeReference:
1582
- case import_utils21.AST_NODE_TYPES.TSTypeAnnotation:
1583
- case import_utils21.AST_NODE_TYPES.TSTypeParameterInstantiation:
1584
- case import_utils21.AST_NODE_TYPES.TSInterfaceHeritage:
1585
- case import_utils21.AST_NODE_TYPES.TSClassImplements:
1586
- case import_utils21.AST_NODE_TYPES.TSTypeQuery:
1587
- case import_utils21.AST_NODE_TYPES.TSTypeAssertion:
1588
- case import_utils21.AST_NODE_TYPES.TSAsExpression:
1589
- case import_utils21.AST_NODE_TYPES.TSSatisfiesExpression:
1590
- case import_utils21.AST_NODE_TYPES.TSTypeAliasDeclaration:
1591
- case import_utils21.AST_NODE_TYPES.TSInterfaceDeclaration:
1592
- case import_utils21.AST_NODE_TYPES.TSTypeParameter:
1593
- case import_utils21.AST_NODE_TYPES.TSQualifiedName:
1647
+ case import_utils22.AST_NODE_TYPES.TSTypeReference:
1648
+ case import_utils22.AST_NODE_TYPES.TSTypeAnnotation:
1649
+ case import_utils22.AST_NODE_TYPES.TSTypeParameterInstantiation:
1650
+ case import_utils22.AST_NODE_TYPES.TSInterfaceHeritage:
1651
+ case import_utils22.AST_NODE_TYPES.TSClassImplements:
1652
+ case import_utils22.AST_NODE_TYPES.TSTypeQuery:
1653
+ case import_utils22.AST_NODE_TYPES.TSTypeAssertion:
1654
+ case import_utils22.AST_NODE_TYPES.TSAsExpression:
1655
+ case import_utils22.AST_NODE_TYPES.TSSatisfiesExpression:
1656
+ case import_utils22.AST_NODE_TYPES.TSTypeAliasDeclaration:
1657
+ case import_utils22.AST_NODE_TYPES.TSInterfaceDeclaration:
1658
+ case import_utils22.AST_NODE_TYPES.TSTypeParameter:
1659
+ case import_utils22.AST_NODE_TYPES.TSQualifiedName:
1594
1660
  return true;
1595
- case import_utils21.AST_NODE_TYPES.MemberExpression:
1596
- case import_utils21.AST_NODE_TYPES.Identifier:
1661
+ case import_utils22.AST_NODE_TYPES.MemberExpression:
1662
+ case import_utils22.AST_NODE_TYPES.Identifier:
1597
1663
  current = current.parent;
1598
1664
  break;
1599
1665
  default:
@@ -1623,26 +1689,26 @@ var preferImportType = createRule19({
1623
1689
  return false;
1624
1690
  }
1625
1691
  switch (parent.type) {
1626
- case import_utils21.AST_NODE_TYPES.CallExpression:
1627
- case import_utils21.AST_NODE_TYPES.NewExpression:
1628
- case import_utils21.AST_NODE_TYPES.JSXOpeningElement:
1629
- case import_utils21.AST_NODE_TYPES.JSXClosingElement:
1630
- case import_utils21.AST_NODE_TYPES.MemberExpression:
1631
- case import_utils21.AST_NODE_TYPES.VariableDeclarator:
1632
- case import_utils21.AST_NODE_TYPES.TaggedTemplateExpression:
1633
- case import_utils21.AST_NODE_TYPES.SpreadElement:
1634
- case import_utils21.AST_NODE_TYPES.ExportSpecifier:
1635
- case import_utils21.AST_NODE_TYPES.ArrayExpression:
1636
- case import_utils21.AST_NODE_TYPES.ObjectExpression:
1637
- case import_utils21.AST_NODE_TYPES.BinaryExpression:
1638
- case import_utils21.AST_NODE_TYPES.LogicalExpression:
1639
- case import_utils21.AST_NODE_TYPES.UnaryExpression:
1640
- case import_utils21.AST_NODE_TYPES.ReturnStatement:
1641
- case import_utils21.AST_NODE_TYPES.ArrowFunctionExpression:
1642
- case import_utils21.AST_NODE_TYPES.ConditionalExpression:
1643
- case import_utils21.AST_NODE_TYPES.AwaitExpression:
1644
- case import_utils21.AST_NODE_TYPES.YieldExpression:
1645
- case import_utils21.AST_NODE_TYPES.Property:
1692
+ case import_utils22.AST_NODE_TYPES.CallExpression:
1693
+ case import_utils22.AST_NODE_TYPES.NewExpression:
1694
+ case import_utils22.AST_NODE_TYPES.JSXOpeningElement:
1695
+ case import_utils22.AST_NODE_TYPES.JSXClosingElement:
1696
+ case import_utils22.AST_NODE_TYPES.MemberExpression:
1697
+ case import_utils22.AST_NODE_TYPES.VariableDeclarator:
1698
+ case import_utils22.AST_NODE_TYPES.TaggedTemplateExpression:
1699
+ case import_utils22.AST_NODE_TYPES.SpreadElement:
1700
+ case import_utils22.AST_NODE_TYPES.ExportSpecifier:
1701
+ case import_utils22.AST_NODE_TYPES.ArrayExpression:
1702
+ case import_utils22.AST_NODE_TYPES.ObjectExpression:
1703
+ case import_utils22.AST_NODE_TYPES.BinaryExpression:
1704
+ case import_utils22.AST_NODE_TYPES.LogicalExpression:
1705
+ case import_utils22.AST_NODE_TYPES.UnaryExpression:
1706
+ case import_utils22.AST_NODE_TYPES.ReturnStatement:
1707
+ case import_utils22.AST_NODE_TYPES.ArrowFunctionExpression:
1708
+ case import_utils22.AST_NODE_TYPES.ConditionalExpression:
1709
+ case import_utils22.AST_NODE_TYPES.AwaitExpression:
1710
+ case import_utils22.AST_NODE_TYPES.YieldExpression:
1711
+ case import_utils22.AST_NODE_TYPES.Property:
1646
1712
  return true;
1647
1713
  default:
1648
1714
  return false;
@@ -1666,13 +1732,13 @@ var preferImportType = createRule19({
1666
1732
  }
1667
1733
  const scope = context.sourceCode.getScope(node);
1668
1734
  const isTypeOnlyImport = node.specifiers.every((specifier) => {
1669
- if (specifier.type === import_utils21.AST_NODE_TYPES.ImportDefaultSpecifier) {
1735
+ if (specifier.type === import_utils22.AST_NODE_TYPES.ImportDefaultSpecifier) {
1670
1736
  return false;
1671
1737
  }
1672
- if (specifier.type === import_utils21.AST_NODE_TYPES.ImportNamespaceSpecifier) {
1738
+ if (specifier.type === import_utils22.AST_NODE_TYPES.ImportNamespaceSpecifier) {
1673
1739
  return false;
1674
1740
  }
1675
- if (specifier.type === import_utils21.AST_NODE_TYPES.ImportSpecifier) {
1741
+ if (specifier.type === import_utils22.AST_NODE_TYPES.ImportSpecifier) {
1676
1742
  const localName = specifier.local.name;
1677
1743
  return !isUsedAsValue(localName, scope);
1678
1744
  }
@@ -1698,11 +1764,11 @@ var preferImportType = createRule19({
1698
1764
  var prefer_import_type_default = preferImportType;
1699
1765
 
1700
1766
  // src/rules/prefer-interface-over-inline-types.ts
1701
- var import_utils22 = require("@typescript-eslint/utils");
1702
- var createRule20 = import_utils22.ESLintUtils.RuleCreator(
1767
+ var import_utils23 = require("@typescript-eslint/utils");
1768
+ var createRule21 = import_utils23.ESLintUtils.RuleCreator(
1703
1769
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1704
1770
  );
1705
- var preferInterfaceOverInlineTypes = createRule20({
1771
+ var preferInterfaceOverInlineTypes = createRule21({
1706
1772
  name: "prefer-interface-over-inline-types",
1707
1773
  meta: {
1708
1774
  type: "suggestion",
@@ -1718,54 +1784,54 @@ var preferInterfaceOverInlineTypes = createRule20({
1718
1784
  defaultOptions: [],
1719
1785
  create(context) {
1720
1786
  function hasJSXInConditional(node) {
1721
- return node.consequent.type === import_utils22.AST_NODE_TYPES.JSXElement || node.consequent.type === import_utils22.AST_NODE_TYPES.JSXFragment || node.alternate.type === import_utils22.AST_NODE_TYPES.JSXElement || node.alternate.type === import_utils22.AST_NODE_TYPES.JSXFragment;
1787
+ return node.consequent.type === import_utils23.AST_NODE_TYPES.JSXElement || node.consequent.type === import_utils23.AST_NODE_TYPES.JSXFragment || node.alternate.type === import_utils23.AST_NODE_TYPES.JSXElement || node.alternate.type === import_utils23.AST_NODE_TYPES.JSXFragment;
1722
1788
  }
1723
1789
  function hasJSXInLogical(node) {
1724
- return node.right.type === import_utils22.AST_NODE_TYPES.JSXElement || node.right.type === import_utils22.AST_NODE_TYPES.JSXFragment;
1790
+ return node.right.type === import_utils23.AST_NODE_TYPES.JSXElement || node.right.type === import_utils23.AST_NODE_TYPES.JSXFragment;
1725
1791
  }
1726
1792
  function hasJSXReturn(block) {
1727
1793
  return block.body.some((stmt) => {
1728
- if (stmt.type === import_utils22.AST_NODE_TYPES.ReturnStatement && stmt.argument) {
1729
- return stmt.argument.type === import_utils22.AST_NODE_TYPES.JSXElement || stmt.argument.type === import_utils22.AST_NODE_TYPES.JSXFragment || stmt.argument.type === import_utils22.AST_NODE_TYPES.ConditionalExpression && hasJSXInConditional(stmt.argument) || stmt.argument.type === import_utils22.AST_NODE_TYPES.LogicalExpression && hasJSXInLogical(stmt.argument);
1794
+ if (stmt.type === import_utils23.AST_NODE_TYPES.ReturnStatement && stmt.argument) {
1795
+ return stmt.argument.type === import_utils23.AST_NODE_TYPES.JSXElement || stmt.argument.type === import_utils23.AST_NODE_TYPES.JSXFragment || stmt.argument.type === import_utils23.AST_NODE_TYPES.ConditionalExpression && hasJSXInConditional(stmt.argument) || stmt.argument.type === import_utils23.AST_NODE_TYPES.LogicalExpression && hasJSXInLogical(stmt.argument);
1730
1796
  }
1731
1797
  return false;
1732
1798
  });
1733
1799
  }
1734
1800
  function isReactComponent2(node) {
1735
- if (node.type === import_utils22.AST_NODE_TYPES.ArrowFunctionExpression) {
1736
- if (node.body.type === import_utils22.AST_NODE_TYPES.JSXElement || node.body.type === import_utils22.AST_NODE_TYPES.JSXFragment) {
1801
+ if (node.type === import_utils23.AST_NODE_TYPES.ArrowFunctionExpression) {
1802
+ if (node.body.type === import_utils23.AST_NODE_TYPES.JSXElement || node.body.type === import_utils23.AST_NODE_TYPES.JSXFragment) {
1737
1803
  return true;
1738
1804
  }
1739
- if (node.body.type === import_utils22.AST_NODE_TYPES.BlockStatement) {
1805
+ if (node.body.type === import_utils23.AST_NODE_TYPES.BlockStatement) {
1740
1806
  return hasJSXReturn(node.body);
1741
1807
  }
1742
- } else if (node.type === import_utils22.AST_NODE_TYPES.FunctionExpression || node.type === import_utils22.AST_NODE_TYPES.FunctionDeclaration) {
1743
- if (node.body && node.body.type === import_utils22.AST_NODE_TYPES.BlockStatement) {
1808
+ } else if (node.type === import_utils23.AST_NODE_TYPES.FunctionExpression || node.type === import_utils23.AST_NODE_TYPES.FunctionDeclaration) {
1809
+ if (node.body && node.body.type === import_utils23.AST_NODE_TYPES.BlockStatement) {
1744
1810
  return hasJSXReturn(node.body);
1745
1811
  }
1746
1812
  }
1747
1813
  return false;
1748
1814
  }
1749
1815
  function isInlineTypeAnnotation(node) {
1750
- if (node.type === import_utils22.AST_NODE_TYPES.TSTypeLiteral) {
1816
+ if (node.type === import_utils23.AST_NODE_TYPES.TSTypeLiteral) {
1751
1817
  return true;
1752
1818
  }
1753
- if (node.type === import_utils22.AST_NODE_TYPES.TSTypeReference && node.typeArguments) {
1754
- return node.typeArguments.params.some((param) => param.type === import_utils22.AST_NODE_TYPES.TSTypeLiteral);
1819
+ if (node.type === import_utils23.AST_NODE_TYPES.TSTypeReference && node.typeArguments) {
1820
+ return node.typeArguments.params.some((param) => param.type === import_utils23.AST_NODE_TYPES.TSTypeLiteral);
1755
1821
  }
1756
- if (node.type === import_utils22.AST_NODE_TYPES.TSUnionType) {
1822
+ if (node.type === import_utils23.AST_NODE_TYPES.TSUnionType) {
1757
1823
  return node.types.some((type) => isInlineTypeAnnotation(type));
1758
1824
  }
1759
1825
  return false;
1760
1826
  }
1761
1827
  function hasInlineObjectType(node) {
1762
- if (node.type === import_utils22.AST_NODE_TYPES.TSTypeLiteral) {
1828
+ if (node.type === import_utils23.AST_NODE_TYPES.TSTypeLiteral) {
1763
1829
  return true;
1764
1830
  }
1765
- if (node.type === import_utils22.AST_NODE_TYPES.TSTypeReference && node.typeArguments) {
1766
- return node.typeArguments.params.some((param) => param.type === import_utils22.AST_NODE_TYPES.TSTypeLiteral);
1831
+ if (node.type === import_utils23.AST_NODE_TYPES.TSTypeReference && node.typeArguments) {
1832
+ return node.typeArguments.params.some((param) => param.type === import_utils23.AST_NODE_TYPES.TSTypeLiteral);
1767
1833
  }
1768
- if (node.type === import_utils22.AST_NODE_TYPES.TSUnionType) {
1834
+ if (node.type === import_utils23.AST_NODE_TYPES.TSUnionType) {
1769
1835
  return node.types.some((type) => hasInlineObjectType(type));
1770
1836
  }
1771
1837
  return false;
@@ -1778,7 +1844,7 @@ var preferInterfaceOverInlineTypes = createRule20({
1778
1844
  return;
1779
1845
  }
1780
1846
  const param = node.params[0];
1781
- if (param.type === import_utils22.AST_NODE_TYPES.Identifier && param.typeAnnotation) {
1847
+ if (param.type === import_utils23.AST_NODE_TYPES.Identifier && param.typeAnnotation) {
1782
1848
  const { typeAnnotation } = param.typeAnnotation;
1783
1849
  if (isInlineTypeAnnotation(typeAnnotation) && hasInlineObjectType(typeAnnotation)) {
1784
1850
  context.report({
@@ -1798,11 +1864,11 @@ var preferInterfaceOverInlineTypes = createRule20({
1798
1864
  var prefer_interface_over_inline_types_default = preferInterfaceOverInlineTypes;
1799
1865
 
1800
1866
  // src/rules/prefer-jsx-template-literals.ts
1801
- var import_utils23 = require("@typescript-eslint/utils");
1802
- var createRule21 = import_utils23.ESLintUtils.RuleCreator(
1867
+ var import_utils24 = require("@typescript-eslint/utils");
1868
+ var createRule22 = import_utils24.ESLintUtils.RuleCreator(
1803
1869
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1804
1870
  );
1805
- var preferJSXTemplateLiterals = createRule21({
1871
+ var preferJSXTemplateLiterals = createRule22({
1806
1872
  name: "prefer-jsx-template-literals",
1807
1873
  meta: {
1808
1874
  type: "suggestion",
@@ -1871,9 +1937,9 @@ var preferJSXTemplateLiterals = createRule21({
1871
1937
  if (!child || !nextChild) {
1872
1938
  return;
1873
1939
  }
1874
- if (child.type === import_utils23.AST_NODE_TYPES.JSXText && nextChild.type === import_utils23.AST_NODE_TYPES.JSXExpressionContainer) {
1940
+ if (child.type === import_utils24.AST_NODE_TYPES.JSXText && nextChild.type === import_utils24.AST_NODE_TYPES.JSXExpressionContainer) {
1875
1941
  handleTextBeforeExpression(child, nextChild);
1876
- } else if (child.type === import_utils23.AST_NODE_TYPES.JSXExpressionContainer && nextChild.type === import_utils23.AST_NODE_TYPES.JSXText) {
1942
+ } else if (child.type === import_utils24.AST_NODE_TYPES.JSXExpressionContainer && nextChild.type === import_utils24.AST_NODE_TYPES.JSXText) {
1877
1943
  handleExpressionBeforeText(child, nextChild);
1878
1944
  }
1879
1945
  }
@@ -1886,11 +1952,11 @@ var preferJSXTemplateLiterals = createRule21({
1886
1952
  var prefer_jsx_template_literals_default = preferJSXTemplateLiterals;
1887
1953
 
1888
1954
  // src/rules/prefer-named-param-types.ts
1889
- var import_utils24 = require("@typescript-eslint/utils");
1890
- var createRule22 = import_utils24.ESLintUtils.RuleCreator(
1955
+ var import_utils25 = require("@typescript-eslint/utils");
1956
+ var createRule23 = import_utils25.ESLintUtils.RuleCreator(
1891
1957
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1892
1958
  );
1893
- var preferNamedParamTypes = createRule22({
1959
+ var preferNamedParamTypes = createRule23({
1894
1960
  name: "prefer-named-param-types",
1895
1961
  meta: {
1896
1962
  type: "suggestion",
@@ -1905,16 +1971,16 @@ var preferNamedParamTypes = createRule22({
1905
1971
  defaultOptions: [],
1906
1972
  create(context) {
1907
1973
  function hasInlineObjectType(param) {
1908
- if (param.type === import_utils24.AST_NODE_TYPES.AssignmentPattern) {
1974
+ if (param.type === import_utils25.AST_NODE_TYPES.AssignmentPattern) {
1909
1975
  return hasInlineObjectType(param.left);
1910
1976
  }
1911
- if (param.type === import_utils24.AST_NODE_TYPES.ObjectPattern) {
1912
- if (param.typeAnnotation?.typeAnnotation.type === import_utils24.AST_NODE_TYPES.TSTypeLiteral) {
1977
+ if (param.type === import_utils25.AST_NODE_TYPES.ObjectPattern) {
1978
+ if (param.typeAnnotation?.typeAnnotation.type === import_utils25.AST_NODE_TYPES.TSTypeLiteral) {
1913
1979
  return true;
1914
1980
  }
1915
1981
  }
1916
- if (param.type === import_utils24.AST_NODE_TYPES.Identifier) {
1917
- if (param.typeAnnotation?.typeAnnotation.type === import_utils24.AST_NODE_TYPES.TSTypeLiteral) {
1982
+ if (param.type === import_utils25.AST_NODE_TYPES.Identifier) {
1983
+ if (param.typeAnnotation?.typeAnnotation.type === import_utils25.AST_NODE_TYPES.TSTypeLiteral) {
1918
1984
  return true;
1919
1985
  }
1920
1986
  }
@@ -1948,11 +2014,11 @@ var preferNamedParamTypes = createRule22({
1948
2014
  var prefer_named_param_types_default = preferNamedParamTypes;
1949
2015
 
1950
2016
  // src/rules/prefer-react-import-types.ts
1951
- var import_utils25 = require("@typescript-eslint/utils");
1952
- var createRule23 = import_utils25.ESLintUtils.RuleCreator(
2017
+ var import_utils26 = require("@typescript-eslint/utils");
2018
+ var createRule24 = import_utils26.ESLintUtils.RuleCreator(
1953
2019
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
1954
2020
  );
1955
- var preferReactImportTypes = createRule23({
2021
+ var preferReactImportTypes = createRule24({
1956
2022
  name: "prefer-react-import-types",
1957
2023
  meta: {
1958
2024
  type: "suggestion",
@@ -2028,7 +2094,7 @@ var preferReactImportTypes = createRule23({
2028
2094
  ]);
2029
2095
  const allReactExports = /* @__PURE__ */ new Set([...reactTypes, ...reactRuntimeExports]);
2030
2096
  function checkMemberExpression(node) {
2031
- if (node.object.type === import_utils25.AST_NODE_TYPES.Identifier && node.object.name === "React" && node.property.type === import_utils25.AST_NODE_TYPES.Identifier && allReactExports.has(node.property.name)) {
2097
+ if (node.object.type === import_utils26.AST_NODE_TYPES.Identifier && node.object.name === "React" && node.property.type === import_utils26.AST_NODE_TYPES.Identifier && allReactExports.has(node.property.name)) {
2032
2098
  const typeName = node.property.name;
2033
2099
  const isType = reactTypes.has(typeName);
2034
2100
  const importStatement = isType ? `import type { ${typeName} } from "react"` : `import { ${typeName} } from "react"`;
@@ -2045,7 +2111,7 @@ var preferReactImportTypes = createRule23({
2045
2111
  return {
2046
2112
  MemberExpression: checkMemberExpression,
2047
2113
  "TSTypeReference > TSQualifiedName": (node) => {
2048
- if (node.left.type === import_utils25.AST_NODE_TYPES.Identifier && node.left.name === "React" && node.right.type === import_utils25.AST_NODE_TYPES.Identifier && allReactExports.has(node.right.name)) {
2114
+ if (node.left.type === import_utils26.AST_NODE_TYPES.Identifier && node.left.name === "React" && node.right.type === import_utils26.AST_NODE_TYPES.Identifier && allReactExports.has(node.right.name)) {
2049
2115
  const typeName = node.right.name;
2050
2116
  const isType = reactTypes.has(typeName);
2051
2117
  const importStatement = isType ? `import type { ${typeName} } from "react"` : `import { ${typeName} } from "react"`;
@@ -2065,11 +2131,11 @@ var preferReactImportTypes = createRule23({
2065
2131
  var prefer_react_import_types_default = preferReactImportTypes;
2066
2132
 
2067
2133
  // src/rules/react-props-destructure.ts
2068
- var import_utils26 = require("@typescript-eslint/utils");
2069
- var createRule24 = import_utils26.ESLintUtils.RuleCreator(
2134
+ var import_utils27 = require("@typescript-eslint/utils");
2135
+ var createRule25 = import_utils27.ESLintUtils.RuleCreator(
2070
2136
  (name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`
2071
2137
  );
2072
- var reactPropsDestructure = createRule24({
2138
+ var reactPropsDestructure = createRule25({
2073
2139
  name: "react-props-destructure",
2074
2140
  meta: {
2075
2141
  type: "suggestion",
@@ -2085,29 +2151,29 @@ var reactPropsDestructure = createRule24({
2085
2151
  defaultOptions: [],
2086
2152
  create(context) {
2087
2153
  function hasJSXInConditional(node) {
2088
- return node.consequent.type === import_utils26.AST_NODE_TYPES.JSXElement || node.consequent.type === import_utils26.AST_NODE_TYPES.JSXFragment || node.alternate.type === import_utils26.AST_NODE_TYPES.JSXElement || node.alternate.type === import_utils26.AST_NODE_TYPES.JSXFragment;
2154
+ return node.consequent.type === import_utils27.AST_NODE_TYPES.JSXElement || node.consequent.type === import_utils27.AST_NODE_TYPES.JSXFragment || node.alternate.type === import_utils27.AST_NODE_TYPES.JSXElement || node.alternate.type === import_utils27.AST_NODE_TYPES.JSXFragment;
2089
2155
  }
2090
2156
  function hasJSXInLogical(node) {
2091
- return node.right.type === import_utils26.AST_NODE_TYPES.JSXElement || node.right.type === import_utils26.AST_NODE_TYPES.JSXFragment;
2157
+ return node.right.type === import_utils27.AST_NODE_TYPES.JSXElement || node.right.type === import_utils27.AST_NODE_TYPES.JSXFragment;
2092
2158
  }
2093
2159
  function hasJSXReturn(block) {
2094
2160
  return block.body.some((stmt) => {
2095
- if (stmt.type === import_utils26.AST_NODE_TYPES.ReturnStatement && stmt.argument) {
2096
- return stmt.argument.type === import_utils26.AST_NODE_TYPES.JSXElement || stmt.argument.type === import_utils26.AST_NODE_TYPES.JSXFragment || stmt.argument.type === import_utils26.AST_NODE_TYPES.ConditionalExpression && hasJSXInConditional(stmt.argument) || stmt.argument.type === import_utils26.AST_NODE_TYPES.LogicalExpression && hasJSXInLogical(stmt.argument);
2161
+ if (stmt.type === import_utils27.AST_NODE_TYPES.ReturnStatement && stmt.argument) {
2162
+ return stmt.argument.type === import_utils27.AST_NODE_TYPES.JSXElement || stmt.argument.type === import_utils27.AST_NODE_TYPES.JSXFragment || stmt.argument.type === import_utils27.AST_NODE_TYPES.ConditionalExpression && hasJSXInConditional(stmt.argument) || stmt.argument.type === import_utils27.AST_NODE_TYPES.LogicalExpression && hasJSXInLogical(stmt.argument);
2097
2163
  }
2098
2164
  return false;
2099
2165
  });
2100
2166
  }
2101
2167
  function isReactComponent2(node) {
2102
- if (node.type === import_utils26.AST_NODE_TYPES.ArrowFunctionExpression) {
2103
- if (node.body.type === import_utils26.AST_NODE_TYPES.JSXElement || node.body.type === import_utils26.AST_NODE_TYPES.JSXFragment) {
2168
+ if (node.type === import_utils27.AST_NODE_TYPES.ArrowFunctionExpression) {
2169
+ if (node.body.type === import_utils27.AST_NODE_TYPES.JSXElement || node.body.type === import_utils27.AST_NODE_TYPES.JSXFragment) {
2104
2170
  return true;
2105
2171
  }
2106
- if (node.body.type === import_utils26.AST_NODE_TYPES.BlockStatement) {
2172
+ if (node.body.type === import_utils27.AST_NODE_TYPES.BlockStatement) {
2107
2173
  return hasJSXReturn(node.body);
2108
2174
  }
2109
- } else if (node.type === import_utils26.AST_NODE_TYPES.FunctionExpression || node.type === import_utils26.AST_NODE_TYPES.FunctionDeclaration) {
2110
- if (node.body && node.body.type === import_utils26.AST_NODE_TYPES.BlockStatement) {
2175
+ } else if (node.type === import_utils27.AST_NODE_TYPES.FunctionExpression || node.type === import_utils27.AST_NODE_TYPES.FunctionDeclaration) {
2176
+ if (node.body && node.body.type === import_utils27.AST_NODE_TYPES.BlockStatement) {
2111
2177
  return hasJSXReturn(node.body);
2112
2178
  }
2113
2179
  }
@@ -2121,9 +2187,9 @@ var reactPropsDestructure = createRule24({
2121
2187
  return;
2122
2188
  }
2123
2189
  const param = node.params[0];
2124
- if (param.type === import_utils26.AST_NODE_TYPES.ObjectPattern) {
2125
- const properties = param.properties.filter((prop) => prop.type === import_utils26.AST_NODE_TYPES.Property).map((prop) => {
2126
- if (prop.key.type === import_utils26.AST_NODE_TYPES.Identifier) {
2190
+ if (param.type === import_utils27.AST_NODE_TYPES.ObjectPattern) {
2191
+ const properties = param.properties.filter((prop) => prop.type === import_utils27.AST_NODE_TYPES.Property).map((prop) => {
2192
+ if (prop.key.type === import_utils27.AST_NODE_TYPES.Identifier) {
2127
2193
  return prop.key.name;
2128
2194
  }
2129
2195
  return null;
@@ -2167,6 +2233,7 @@ var rules = {
2167
2233
  "no-direct-date": no_direct_date_default,
2168
2234
  "no-emoji": no_emoji_default,
2169
2235
  "no-env-fallback": no_env_fallback_default,
2236
+ "no-inline-default-export": no_inline_default_export_default,
2170
2237
  "require-explicit-return-type": require_explicit_return_type_default,
2171
2238
  "no-lazy-identifiers": no_lazy_identifiers_default,
2172
2239
  "no-logic-in-params": no_logic_in_params_default,
@@ -2200,6 +2267,7 @@ var baseRules = {
2200
2267
  "nextfriday/no-direct-date": "warn",
2201
2268
  "nextfriday/no-logic-in-params": "warn",
2202
2269
  "nextfriday/no-env-fallback": "warn",
2270
+ "nextfriday/no-inline-default-export": "warn",
2203
2271
  "nextfriday/no-lazy-identifiers": "warn",
2204
2272
  "nextfriday/no-single-char-variables": "warn"
2205
2273
  };
@@ -2219,6 +2287,7 @@ var baseRecommendedRules = {
2219
2287
  "nextfriday/no-direct-date": "error",
2220
2288
  "nextfriday/no-logic-in-params": "error",
2221
2289
  "nextfriday/no-env-fallback": "error",
2290
+ "nextfriday/no-inline-default-export": "error",
2222
2291
  "nextfriday/no-lazy-identifiers": "error",
2223
2292
  "nextfriday/no-single-char-variables": "error"
2224
2293
  };