eslint-plugin-nextfriday 4.3.1 → 4.4.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
@@ -32,10 +32,10 @@ let emoji_regex = require("emoji-regex");
32
32
  emoji_regex = __toESM(emoji_regex, 1);
33
33
  //#region package.json
34
34
  var name = "eslint-plugin-nextfriday";
35
- var version = "4.3.1";
35
+ var version = "4.4.0";
36
36
  //#endregion
37
37
  //#region src/rules/boolean-naming-prefix.ts
38
- const createRule$32 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
38
+ const createRule$31 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
39
39
  const BOOLEAN_PREFIXES = [
40
40
  "is",
41
41
  "has",
@@ -84,7 +84,7 @@ const hasBooleanTypeAnnotation = (node) => {
84
84
  }
85
85
  return false;
86
86
  };
87
- const booleanNamingPrefix = createRule$32({
87
+ const booleanNamingPrefix = createRule$31({
88
88
  name: "boolean-naming-prefix",
89
89
  meta: {
90
90
  type: "suggestion",
@@ -145,7 +145,7 @@ const booleanNamingPrefix = createRule$32({
145
145
  });
146
146
  //#endregion
147
147
  //#region src/rules/enforce-camel-case.ts
148
- const createRule$31 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
148
+ const createRule$30 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
149
149
  const SNAKE_CASE_REGEX$2 = /^[a-z]+_[a-z0-9_]*$/;
150
150
  const PASCAL_CASE_REGEX = /^[A-Z][a-zA-Z0-9]*$/;
151
151
  const REACT_WRAPPERS = [
@@ -189,7 +189,7 @@ const isStaticValue$1 = (init) => {
189
189
  if (init.type === _typescript_eslint_utils.AST_NODE_TYPES.TSAsExpression && init.typeAnnotation.type === _typescript_eslint_utils.AST_NODE_TYPES.TSTypeReference && init.typeAnnotation.typeName.type === _typescript_eslint_utils.AST_NODE_TYPES.Identifier && init.typeAnnotation.typeName.name === "const") return true;
190
190
  return false;
191
191
  };
192
- const enforceCamelCase = createRule$31({
192
+ const enforceCamelCase = createRule$30({
193
193
  name: "enforce-camel-case",
194
194
  meta: {
195
195
  type: "suggestion",
@@ -250,7 +250,7 @@ const isConfigFile = (filename) => {
250
250
  };
251
251
  //#endregion
252
252
  //#region src/rules/enforce-constant-case.ts
253
- const createRule$30 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
253
+ const createRule$29 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
254
254
  const SCREAMING_SNAKE_CASE_REGEX$2 = /^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$/;
255
255
  const SNAKE_CASE_REGEX$1 = /^[a-z]+_[a-z0-9_]*$/;
256
256
  const toScreamingSnakeCase = (str) => str.replace(/([a-z])([A-Z])/g, "$1_$2").replace(/([A-Z])([A-Z][a-z])/g, "$1_$2").toUpperCase();
@@ -268,7 +268,7 @@ const isGlobalScope$1 = (node) => {
268
268
  if (parent.type === _typescript_eslint_utils.AST_NODE_TYPES.ExportNamedDeclaration && parent.parent?.type === _typescript_eslint_utils.AST_NODE_TYPES.Program) return true;
269
269
  return false;
270
270
  };
271
- const enforceConstantCase = createRule$30({
271
+ const enforceConstantCase = createRule$29({
272
272
  name: "enforce-constant-case",
273
273
  meta: {
274
274
  type: "suggestion",
@@ -392,7 +392,7 @@ const enforceHookNaming = _typescript_eslint_utils.ESLintUtils.RuleCreator((name
392
392
  });
393
393
  //#endregion
394
394
  //#region src/rules/enforce-property-case.ts
395
- const createRule$29 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
395
+ const createRule$28 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
396
396
  const SNAKE_CASE_REGEX = /^[a-z]+_[a-z0-9_]*$/;
397
397
  const SCREAMING_SNAKE_CASE_REGEX$1 = /^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$/;
398
398
  const isInsideAsConst = (node) => {
@@ -404,7 +404,7 @@ const isInsideAsConst = (node) => {
404
404
  }
405
405
  return false;
406
406
  };
407
- const enforcePropertyCase = createRule$29({
407
+ const enforcePropertyCase = createRule$28({
408
408
  name: "enforce-property-case",
409
409
  meta: {
410
410
  type: "suggestion",
@@ -478,6 +478,7 @@ const enforceReadonlyComponentProps = _typescript_eslint_utils.ESLintUtils.RuleC
478
478
  },
479
479
  defaultOptions: [],
480
480
  create(context) {
481
+ if (!isJsxFile(context.filename)) return {};
481
482
  function hasJSXInConditional(node) {
482
483
  return node.consequent.type === _typescript_eslint_utils.AST_NODE_TYPES.JSXElement || node.consequent.type === _typescript_eslint_utils.AST_NODE_TYPES.JSXFragment || node.alternate.type === _typescript_eslint_utils.AST_NODE_TYPES.JSXElement || node.alternate.type === _typescript_eslint_utils.AST_NODE_TYPES.JSXFragment;
483
484
  }
@@ -536,7 +537,7 @@ const enforceReadonlyComponentProps = _typescript_eslint_utils.ESLintUtils.RuleC
536
537
  });
537
538
  //#endregion
538
539
  //#region src/rules/enforce-render-naming.ts
539
- const createRule$28 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
540
+ const createRule$27 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
540
541
  const ARRAY_RETURNING_METHODS = new Set([
541
542
  "map",
542
543
  "flatMap",
@@ -585,7 +586,7 @@ function isComponentFunction(node) {
585
586
  if (parent?.type === _typescript_eslint_utils.AST_NODE_TYPES.VariableDeclarator && parent.id.type === _typescript_eslint_utils.AST_NODE_TYPES.Identifier && isPascalCase$1(parent.id.name)) return true;
586
587
  return false;
587
588
  }
588
- const enforceRenderNaming = createRule$28({
589
+ const enforceRenderNaming = createRule$27({
589
590
  name: "enforce-render-naming",
590
591
  meta: {
591
592
  type: "problem",
@@ -637,7 +638,7 @@ const enforceRenderNaming = createRule$28({
637
638
  });
638
639
  //#endregion
639
640
  //#region src/rules/enforce-service-naming.ts
640
- const createRule$27 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
641
+ const createRule$26 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
641
642
  const BANNED_PREFIXES = {
642
643
  delete: ["remove", "archive"],
643
644
  do: ["submit", "process"],
@@ -648,7 +649,7 @@ const BANNED_PREFIXES = {
648
649
  "patch"
649
650
  ]
650
651
  };
651
- const enforceServiceNaming = createRule$27({
652
+ const enforceServiceNaming = createRule$26({
652
653
  name: "enforce-service-naming",
653
654
  meta: {
654
655
  type: "suggestion",
@@ -686,7 +687,7 @@ const enforceServiceNaming = createRule$27({
686
687
  });
687
688
  //#endregion
688
689
  //#region src/rules/enforce-test-filename.ts
689
- const createRule$26 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
690
+ const createRule$25 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
690
691
  const TEST_GLOBALS = new Set([
691
692
  "describe",
692
693
  "it",
@@ -696,7 +697,7 @@ const TEST_GLOBALS = new Set([
696
697
  "afterEach",
697
698
  "afterAll"
698
699
  ]);
699
- const enforceTestFilename = createRule$26({
700
+ const enforceTestFilename = createRule$25({
700
701
  name: "enforce-test-filename",
701
702
  meta: {
702
703
  type: "suggestion",
@@ -776,7 +777,7 @@ const enforceSortedDestructuring = _typescript_eslint_utils.ESLintUtils.RuleCrea
776
777
  });
777
778
  //#endregion
778
779
  //#region src/rules/enforce-type-declaration-order.ts
779
- const createRule$25 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
780
+ const createRule$24 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
780
781
  function getTypeDeclarationName(node) {
781
782
  if (node.type === _typescript_eslint_utils.AST_NODE_TYPES.TSInterfaceDeclaration && node.id.type === _typescript_eslint_utils.AST_NODE_TYPES.Identifier) return {
782
783
  name: node.id.name,
@@ -788,7 +789,7 @@ function getTypeDeclarationName(node) {
788
789
  };
789
790
  return null;
790
791
  }
791
- const enforceTypeDeclarationOrder = createRule$25({
792
+ const enforceTypeDeclarationOrder = createRule$24({
792
793
  name: "enforce-type-declaration-order",
793
794
  meta: {
794
795
  type: "suggestion",
@@ -843,7 +844,7 @@ const enforceTypeDeclarationOrder = createRule$25({
843
844
  });
844
845
  //#endregion
845
846
  //#region src/rules/index-export-only.ts
846
- const createRule$24 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
847
+ const createRule$23 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
847
848
  const isIndexFile = (filename) => getBaseName(filename) === "index";
848
849
  const isAllowedExportNamed = (node) => {
849
850
  if (!node.declaration) return true;
@@ -862,7 +863,7 @@ const isAllowedTopLevel = (node) => {
862
863
  default: return false;
863
864
  }
864
865
  };
865
- const indexExportOnly = createRule$24({
866
+ const indexExportOnly = createRule$23({
866
867
  name: "index-export-only",
867
868
  meta: {
868
869
  type: "suggestion",
@@ -897,6 +898,7 @@ const jsxNewlineBetweenElements = _typescript_eslint_utils.ESLintUtils.RuleCreat
897
898
  },
898
899
  defaultOptions: [],
899
900
  create(context) {
901
+ if (!isJsxFile(context.filename)) return {};
900
902
  const { sourceCode } = context;
901
903
  function isSignificantJSXChild(node) {
902
904
  return node.type === _typescript_eslint_utils.AST_NODE_TYPES.JSXElement || node.type === _typescript_eslint_utils.AST_NODE_TYPES.JSXFragment || node.type === _typescript_eslint_utils.AST_NODE_TYPES.JSXExpressionContainer;
@@ -935,7 +937,7 @@ const jsxNewlineBetweenElements = _typescript_eslint_utils.ESLintUtils.RuleCreat
935
937
  });
936
938
  //#endregion
937
939
  //#region src/rules/jsx-no-data-array.ts
938
- const createRule$23 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
940
+ const createRule$22 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
939
941
  function isObjectLikeElement(node) {
940
942
  if (!node) return false;
941
943
  if (node.type === _typescript_eslint_utils.AST_NODE_TYPES.ObjectExpression) return true;
@@ -948,7 +950,7 @@ function getArrayInitializer(init) {
948
950
  if (init.type === _typescript_eslint_utils.AST_NODE_TYPES.TSAsExpression || init.type === _typescript_eslint_utils.AST_NODE_TYPES.TSSatisfiesExpression) return getArrayInitializer(init.expression);
949
951
  return null;
950
952
  }
951
- const jsxNoDataArray = createRule$23({
953
+ const jsxNoDataArray = createRule$22({
952
954
  name: "jsx-no-data-array",
953
955
  meta: {
954
956
  type: "problem",
@@ -989,7 +991,7 @@ const jsxNoDataArray = createRule$23({
989
991
  });
990
992
  //#endregion
991
993
  //#region src/rules/jsx-no-data-object.ts
992
- const createRule$22 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
994
+ const createRule$21 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
993
995
  function unwrapAssertion(node) {
994
996
  if (!node) return null;
995
997
  if (node.type === _typescript_eslint_utils.AST_NODE_TYPES.TSAsExpression || node.type === _typescript_eslint_utils.AST_NODE_TYPES.TSSatisfiesExpression) return unwrapAssertion(node.expression);
@@ -1019,7 +1021,7 @@ function getObjectInitializer(init) {
1019
1021
  if (unwrapped.type === _typescript_eslint_utils.AST_NODE_TYPES.ObjectExpression) return unwrapped;
1020
1022
  return null;
1021
1023
  }
1022
- const jsxNoDataObject = createRule$22({
1024
+ const jsxNoDataObject = createRule$21({
1023
1025
  name: "jsx-no-data-object",
1024
1026
  meta: {
1025
1027
  type: "problem",
@@ -1061,6 +1063,7 @@ const jsxNoInlineObjectProp = _typescript_eslint_utils.ESLintUtils.RuleCreator((
1061
1063
  },
1062
1064
  defaultOptions: [],
1063
1065
  create(context) {
1066
+ if (!isJsxFile(context.filename)) return {};
1064
1067
  return { JSXAttribute(node) {
1065
1068
  if (node.value?.type === _typescript_eslint_utils.AST_NODE_TYPES.JSXExpressionContainer && node.value.expression.type === _typescript_eslint_utils.AST_NODE_TYPES.ObjectExpression) context.report({
1066
1069
  node: node.value,
@@ -1071,14 +1074,14 @@ const jsxNoInlineObjectProp = _typescript_eslint_utils.ESLintUtils.RuleCreator((
1071
1074
  });
1072
1075
  //#endregion
1073
1076
  //#region src/rules/jsx-no-newline-single-line-elements.ts
1074
- const createRule$21 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
1077
+ const createRule$20 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
1075
1078
  function isJSXElementOrFragment(node) {
1076
1079
  return node.type === _typescript_eslint_utils.AST_NODE_TYPES.JSXElement || node.type === _typescript_eslint_utils.AST_NODE_TYPES.JSXFragment;
1077
1080
  }
1078
1081
  function isSingleLine(node) {
1079
1082
  return node.loc.start.line === node.loc.end.line;
1080
1083
  }
1081
- const jsxNoNewlineSingleLineElements = createRule$21({
1084
+ const jsxNoNewlineSingleLineElements = createRule$20({
1082
1085
  name: "jsx-no-newline-single-line-elements",
1083
1086
  meta: {
1084
1087
  type: "layout",
@@ -1089,6 +1092,7 @@ const jsxNoNewlineSingleLineElements = createRule$21({
1089
1092
  },
1090
1093
  defaultOptions: [],
1091
1094
  create(context) {
1095
+ if (!isJsxFile(context.filename)) return {};
1092
1096
  const { sourceCode } = context;
1093
1097
  function checkSiblings(children) {
1094
1098
  const nonWhitespace = children.filter((child) => !(child.type === _typescript_eslint_utils.AST_NODE_TYPES.JSXText && child.value.trim() === ""));
@@ -1176,7 +1180,7 @@ const jsxNoNonComponentFunction = _typescript_eslint_utils.ESLintUtils.RuleCreat
1176
1180
  });
1177
1181
  //#endregion
1178
1182
  //#region src/rules/jsx-no-sub-interface.ts
1179
- const createRule$20 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
1183
+ const createRule$19 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
1180
1184
  const PROPS_WRAPPER_NAMES = new Set([
1181
1185
  "Readonly",
1182
1186
  "Required",
@@ -1208,7 +1212,7 @@ function getDeclarationFromExportWrapper(node) {
1208
1212
  if (node.type === _typescript_eslint_utils.AST_NODE_TYPES.ExportDefaultDeclaration) return node.declaration;
1209
1213
  return node;
1210
1214
  }
1211
- const jsxNoSubInterface = createRule$20({
1215
+ const jsxNoSubInterface = createRule$19({
1212
1216
  name: "jsx-no-sub-interface",
1213
1217
  meta: {
1214
1218
  type: "problem",
@@ -1275,13 +1279,13 @@ const jsxNoSubInterface = createRule$20({
1275
1279
  });
1276
1280
  //#endregion
1277
1281
  //#region src/rules/jsx-no-ternary-null.ts
1278
- const createRule$19 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
1282
+ const createRule$18 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
1279
1283
  function isNullOrUndefined(node) {
1280
1284
  if (node.type === _typescript_eslint_utils.AST_NODE_TYPES.Literal && node.value === null) return true;
1281
1285
  if (node.type === _typescript_eslint_utils.AST_NODE_TYPES.Identifier && node.name === "undefined") return true;
1282
1286
  return false;
1283
1287
  }
1284
- const jsxNoTernaryNull = createRule$19({
1288
+ const jsxNoTernaryNull = createRule$18({
1285
1289
  name: "jsx-no-ternary-null",
1286
1290
  meta: {
1287
1291
  type: "suggestion",
@@ -1292,6 +1296,7 @@ const jsxNoTernaryNull = createRule$19({
1292
1296
  },
1293
1297
  defaultOptions: [],
1294
1298
  create(context) {
1299
+ if (!isJsxFile(context.filename)) return {};
1295
1300
  return { JSXExpressionContainer(node) {
1296
1301
  const { expression } = node;
1297
1302
  if (expression.type !== _typescript_eslint_utils.AST_NODE_TYPES.ConditionalExpression) return;
@@ -1332,6 +1337,7 @@ const jsxNoVariableInCallback = _typescript_eslint_utils.ESLintUtils.RuleCreator
1332
1337
  },
1333
1338
  defaultOptions: [],
1334
1339
  create(context) {
1340
+ if (!isJsxFile(context.filename)) return {};
1335
1341
  function isInsideJSX(node) {
1336
1342
  let current = node.parent;
1337
1343
  while (current) {
@@ -1378,6 +1384,7 @@ const jsxRequireSuspense = _typescript_eslint_utils.ESLintUtils.RuleCreator((nam
1378
1384
  },
1379
1385
  defaultOptions: [],
1380
1386
  create(context) {
1387
+ if (!isJsxFile(context.filename)) return {};
1381
1388
  const lazyComponents = /* @__PURE__ */ new Set();
1382
1389
  const isInsideSuspense = (node) => {
1383
1390
  let current = node.parent;
@@ -1419,6 +1426,7 @@ const jsxSimpleProps = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) =
1419
1426
  },
1420
1427
  defaultOptions: [],
1421
1428
  create(context) {
1429
+ if (!isJsxFile(context.filename)) return {};
1422
1430
  const allowedExpressionTypes = new Set([
1423
1431
  _typescript_eslint_utils.AST_NODE_TYPES.Identifier,
1424
1432
  _typescript_eslint_utils.AST_NODE_TYPES.Literal,
@@ -1444,7 +1452,7 @@ const jsxSimpleProps = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) =
1444
1452
  });
1445
1453
  //#endregion
1446
1454
  //#region src/rules/jsx-sort-props.ts
1447
- const createRule$18 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
1455
+ const createRule$17 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
1448
1456
  const TYPE_GROUP = {
1449
1457
  STRING: 1,
1450
1458
  HYPHENATED_STRING: 2,
@@ -1527,7 +1535,7 @@ function getSegments(attributes) {
1527
1535
  if (current.length > 0) result.push(current);
1528
1536
  return result;
1529
1537
  }
1530
- const jsxSortProps = createRule$18({
1538
+ const jsxSortProps = createRule$17({
1531
1539
  name: "jsx-sort-props",
1532
1540
  meta: {
1533
1541
  type: "suggestion",
@@ -1538,6 +1546,7 @@ const jsxSortProps = createRule$18({
1538
1546
  },
1539
1547
  defaultOptions: [],
1540
1548
  create(context) {
1549
+ if (!isJsxFile(context.filename)) return {};
1541
1550
  const { sourceCode } = context;
1542
1551
  return { JSXOpeningElement(node) {
1543
1552
  if (!hasUnsortedProps(node.attributes)) return;
@@ -1563,6 +1572,7 @@ const jsxSpreadPropsLast = _typescript_eslint_utils.ESLintUtils.RuleCreator((nam
1563
1572
  },
1564
1573
  defaultOptions: [],
1565
1574
  create(context) {
1575
+ if (!isJsxFile(context.filename)) return {};
1566
1576
  return { JSXOpeningElement(node) {
1567
1577
  const { attributes } = node;
1568
1578
  let lastNonSpreadIndex = -1;
@@ -1580,7 +1590,7 @@ const jsxSpreadPropsLast = _typescript_eslint_utils.ESLintUtils.RuleCreator((nam
1580
1590
  });
1581
1591
  //#endregion
1582
1592
  //#region src/rules/newline-after-multiline-block.ts
1583
- const createRule$17 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
1593
+ const createRule$16 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
1584
1594
  function isImportDeclaration(node) {
1585
1595
  return node.type === _typescript_eslint_utils.AST_NODE_TYPES.ImportDeclaration;
1586
1596
  }
@@ -1605,7 +1615,7 @@ function checkStatements(statements, context) {
1605
1615
  });
1606
1616
  });
1607
1617
  }
1608
- const newlineAfterMultilineBlock = createRule$17({
1618
+ const newlineAfterMultilineBlock = createRule$16({
1609
1619
  name: "newline-after-multiline-block",
1610
1620
  meta: {
1611
1621
  type: "layout",
@@ -1791,12 +1801,12 @@ const noEnvFallback = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) =>
1791
1801
  });
1792
1802
  //#endregion
1793
1803
  //#region src/rules/no-ghost-wrapper.ts
1794
- const createRule$16 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
1804
+ const createRule$15 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
1795
1805
  const GHOST_TAGS = new Set(["div", "span"]);
1796
1806
  function isKeyAttribute(attribute) {
1797
1807
  return attribute.type === _typescript_eslint_utils.AST_NODE_TYPES.JSXAttribute && attribute.name.type === _typescript_eslint_utils.AST_NODE_TYPES.JSXIdentifier && attribute.name.name === "key";
1798
1808
  }
1799
- const noGhostWrapper = createRule$16({
1809
+ const noGhostWrapper = createRule$15({
1800
1810
  name: "no-ghost-wrapper",
1801
1811
  meta: {
1802
1812
  type: "problem",
@@ -1806,6 +1816,7 @@ const noGhostWrapper = createRule$16({
1806
1816
  },
1807
1817
  defaultOptions: [],
1808
1818
  create(context) {
1819
+ if (!isJsxFile(context.filename)) return {};
1809
1820
  return { JSXOpeningElement(node) {
1810
1821
  if (node.name.type !== _typescript_eslint_utils.AST_NODE_TYPES.JSXIdentifier) return;
1811
1822
  const tagName = node.name.name;
@@ -1830,6 +1841,8 @@ const noHelperFunctionInHook = _typescript_eslint_utils.ESLintUtils.RuleCreator(
1830
1841
  },
1831
1842
  defaultOptions: [],
1832
1843
  create(context) {
1844
+ const basename = path.default.basename(context.filename);
1845
+ if (!(basename.endsWith(".hook.ts") || basename.endsWith(".hooks.ts"))) return {};
1833
1846
  function isAtProgramLevel(node) {
1834
1847
  const { parent } = node;
1835
1848
  if (parent === void 0) return false;
@@ -1871,6 +1884,8 @@ const noHelperFunctionInTest = _typescript_eslint_utils.ESLintUtils.RuleCreator(
1871
1884
  },
1872
1885
  defaultOptions: [],
1873
1886
  create(context) {
1887
+ const basename = path.default.basename(context.filename);
1888
+ if (!(basename.endsWith(".test.ts") || basename.endsWith(".test.tsx"))) return {};
1874
1889
  return {
1875
1890
  FunctionDeclaration(node) {
1876
1891
  if (node.parent.type === _typescript_eslint_utils.AST_NODE_TYPES.Program) context.report({
@@ -1963,7 +1978,7 @@ const noInlineDefaultExport = _typescript_eslint_utils.ESLintUtils.RuleCreator((
1963
1978
  });
1964
1979
  //#endregion
1965
1980
  //#region src/rules/no-inline-nested-object.ts
1966
- const createRule$15 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
1981
+ const createRule$14 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
1967
1982
  function isObjectOrArray(node) {
1968
1983
  return node.type === _typescript_eslint_utils.AST_NODE_TYPES.ObjectExpression || node.type === _typescript_eslint_utils.AST_NODE_TYPES.ArrayExpression || node.type === _typescript_eslint_utils.AST_NODE_TYPES.TSAsExpression;
1969
1984
  }
@@ -1985,7 +2000,7 @@ function containsNestedStructure(node) {
1985
2000
  return isNestedStructure(el);
1986
2001
  });
1987
2002
  }
1988
- const noInlineNestedObject = createRule$15({
2003
+ const noInlineNestedObject = createRule$14({
1989
2004
  name: "no-inline-nested-object",
1990
2005
  meta: {
1991
2006
  type: "layout",
@@ -2027,13 +2042,13 @@ const noInlineNestedObject = createRule$15({
2027
2042
  });
2028
2043
  //#endregion
2029
2044
  //#region src/rules/no-inline-return-properties.ts
2030
- const createRule$14 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2045
+ const createRule$13 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2031
2046
  const isShorthandProperty = (property) => {
2032
2047
  if (property.type === _typescript_eslint_utils.AST_NODE_TYPES.SpreadElement) return true;
2033
2048
  if (property.type !== _typescript_eslint_utils.AST_NODE_TYPES.Property) return false;
2034
2049
  return property.shorthand;
2035
2050
  };
2036
- const noInlineReturnProperties = createRule$14({
2051
+ const noInlineReturnProperties = createRule$13({
2037
2052
  name: "no-inline-return-properties",
2038
2053
  meta: {
2039
2054
  type: "suggestion",
@@ -2062,9 +2077,9 @@ const noInlineReturnProperties = createRule$14({
2062
2077
  });
2063
2078
  //#endregion
2064
2079
  //#region src/rules/no-inline-type-import.ts
2065
- const createRule$13 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2080
+ const createRule$12 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2066
2081
  const isInlineTypeSpecifier = (specifier) => specifier.type === _typescript_eslint_utils.AST_NODE_TYPES.ImportSpecifier && specifier.importKind === "type";
2067
- const noInlineTypeImport = createRule$13({
2082
+ const noInlineTypeImport = createRule$12({
2068
2083
  name: "no-inline-type-import",
2069
2084
  meta: {
2070
2085
  type: "suggestion",
@@ -2106,7 +2121,7 @@ const noInlineTypeImport = createRule$13({
2106
2121
  });
2107
2122
  //#endregion
2108
2123
  //#region src/rules/no-lazy-identifiers.ts
2109
- const createRule$12 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2124
+ const createRule$11 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2110
2125
  const KEYBOARD_ROWS = [
2111
2126
  "qwertyuiop",
2112
2127
  "asdfghjkl",
@@ -2137,7 +2152,7 @@ const isLazyIdentifier = (name) => {
2137
2152
  if (hasKeyboardSequence(name)) return true;
2138
2153
  return false;
2139
2154
  };
2140
- const noLazyIdentifiers = createRule$12({
2155
+ const noLazyIdentifiers = createRule$11({
2141
2156
  name: "no-lazy-identifiers",
2142
2157
  meta: {
2143
2158
  type: "problem",
@@ -2256,7 +2271,7 @@ const noLogicInParams = _typescript_eslint_utils.ESLintUtils.RuleCreator((name)
2256
2271
  });
2257
2272
  //#endregion
2258
2273
  //#region src/rules/no-misleading-constant-case.ts
2259
- const createRule$11 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2274
+ const createRule$10 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2260
2275
  const SCREAMING_SNAKE_CASE_REGEX = /^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$/;
2261
2276
  const isAsConstAssertion = (node) => node.type === _typescript_eslint_utils.AST_NODE_TYPES.TSAsExpression && node.typeAnnotation.type === _typescript_eslint_utils.AST_NODE_TYPES.TSTypeReference && node.typeAnnotation.typeName.type === _typescript_eslint_utils.AST_NODE_TYPES.Identifier && node.typeAnnotation.typeName.name === "const";
2262
2277
  const isStaticValue = (init) => {
@@ -2274,7 +2289,7 @@ const isGlobalScope = (node) => {
2274
2289
  if (parent.type === _typescript_eslint_utils.AST_NODE_TYPES.ExportNamedDeclaration && parent.parent?.type === _typescript_eslint_utils.AST_NODE_TYPES.Program) return true;
2275
2290
  return false;
2276
2291
  };
2277
- const noMisleadingConstantCase = createRule$11({
2292
+ const noMisleadingConstantCase = createRule$10({
2278
2293
  name: "no-misleading-constant-case",
2279
2294
  meta: {
2280
2295
  type: "suggestion",
@@ -2388,7 +2403,7 @@ const noNestedTernary = _typescript_eslint_utils.ESLintUtils.RuleCreator((name)
2388
2403
  });
2389
2404
  //#endregion
2390
2405
  //#region src/rules/no-redundant-fragment.ts
2391
- const createRule$10 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2406
+ const createRule$9 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2392
2407
  function isFragmentName(name) {
2393
2408
  if (name.type === _typescript_eslint_utils.AST_NODE_TYPES.JSXIdentifier && name.name === "Fragment") return true;
2394
2409
  if (name.type === _typescript_eslint_utils.AST_NODE_TYPES.JSXMemberExpression && name.object.type === _typescript_eslint_utils.AST_NODE_TYPES.JSXIdentifier && name.object.name === "React" && name.property.type === _typescript_eslint_utils.AST_NODE_TYPES.JSXIdentifier && name.property.name === "Fragment") return true;
@@ -2403,7 +2418,7 @@ function countMeaningfulChildren(children) {
2403
2418
  return true;
2404
2419
  }).length;
2405
2420
  }
2406
- const noRedundantFragment = createRule$10({
2421
+ const noRedundantFragment = createRule$9({
2407
2422
  name: "no-redundant-fragment",
2408
2423
  meta: {
2409
2424
  type: "problem",
@@ -2413,6 +2428,7 @@ const noRedundantFragment = createRule$10({
2413
2428
  },
2414
2429
  defaultOptions: [],
2415
2430
  create(context) {
2431
+ if (!isJsxFile(context.filename)) return {};
2416
2432
  return {
2417
2433
  JSXFragment(node) {
2418
2434
  const count = countMeaningfulChildren(node.children);
@@ -2472,7 +2488,7 @@ const noRelativeImports = _typescript_eslint_utils.ESLintUtils.RuleCreator((name
2472
2488
  });
2473
2489
  //#endregion
2474
2490
  //#region src/rules/no-single-char-variables.ts
2475
- const createRule$9 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2491
+ const createRule$8 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2476
2492
  const ALLOWED_IN_FOR_LOOPS = new Set([
2477
2493
  "i",
2478
2494
  "j",
@@ -2498,7 +2514,7 @@ const isAllowedInContext = (name, node) => {
2498
2514
  if (ALLOWED_IN_FOR_LOOPS.has(name) && isForLoopInit(node)) return true;
2499
2515
  return false;
2500
2516
  };
2501
- const noSingleCharVariables = createRule$9({
2517
+ const noSingleCharVariables = createRule$8({
2502
2518
  name: "no-single-char-variables",
2503
2519
  meta: {
2504
2520
  type: "suggestion",
@@ -2620,7 +2636,7 @@ const preferDestructuringParams = _typescript_eslint_utils.ESLintUtils.RuleCreat
2620
2636
  });
2621
2637
  //#endregion
2622
2638
  //#region src/rules/prefer-function-declaration.ts
2623
- const createRule$8 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2639
+ const createRule$7 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2624
2640
  const isTsFile = (filename) => filename.endsWith(".ts") && !filename.endsWith(".d.ts");
2625
2641
  const isCallbackContext = (node) => {
2626
2642
  const { parent } = node;
@@ -2635,7 +2651,7 @@ const isCallbackContext = (node) => {
2635
2651
  if (parent.type === _typescript_eslint_utils.AST_NODE_TYPES.AssignmentExpression && parent.left !== node) return true;
2636
2652
  return false;
2637
2653
  };
2638
- const preferFunctionDeclaration = createRule$8({
2654
+ const preferFunctionDeclaration = createRule$7({
2639
2655
  name: "prefer-function-declaration",
2640
2656
  meta: {
2641
2657
  type: "suggestion",
@@ -2750,6 +2766,7 @@ const preferImportType = _typescript_eslint_utils.ESLintUtils.RuleCreator((name)
2750
2766
  switch (parent.type) {
2751
2767
  case _typescript_eslint_utils.AST_NODE_TYPES.CallExpression:
2752
2768
  case _typescript_eslint_utils.AST_NODE_TYPES.NewExpression:
2769
+ case _typescript_eslint_utils.AST_NODE_TYPES.JSXMemberExpression:
2753
2770
  case _typescript_eslint_utils.AST_NODE_TYPES.JSXOpeningElement:
2754
2771
  case _typescript_eslint_utils.AST_NODE_TYPES.JSXClosingElement:
2755
2772
  case _typescript_eslint_utils.AST_NODE_TYPES.MemberExpression:
@@ -2803,12 +2820,12 @@ const preferImportType = _typescript_eslint_utils.ESLintUtils.RuleCreator((name)
2803
2820
  });
2804
2821
  //#endregion
2805
2822
  //#region src/rules/prefer-inline-literal-union.ts
2806
- const createRule$7 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2823
+ const createRule$6 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2807
2824
  function isLiteralUnionType(node) {
2808
2825
  if (node.type !== _typescript_eslint_utils.AST_NODE_TYPES.TSUnionType) return false;
2809
2826
  return node.types.every((member) => member.type === _typescript_eslint_utils.AST_NODE_TYPES.TSLiteralType || member.type === _typescript_eslint_utils.AST_NODE_TYPES.TSNullKeyword || member.type === _typescript_eslint_utils.AST_NODE_TYPES.TSUndefinedKeyword);
2810
2827
  }
2811
- const preferInlineLiteralUnion = createRule$7({
2828
+ const preferInlineLiteralUnion = createRule$6({
2812
2829
  name: "prefer-inline-literal-union",
2813
2830
  meta: {
2814
2831
  type: "suggestion",
@@ -2846,65 +2863,6 @@ const preferInlineLiteralUnion = createRule$7({
2846
2863
  }
2847
2864
  });
2848
2865
  //#endregion
2849
- //#region src/rules/prefer-inline-type-export.ts
2850
- const createRule$6 = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2851
- const isTypeDeclaration = (node) => node.type === _typescript_eslint_utils.AST_NODE_TYPES.TSInterfaceDeclaration || node.type === _typescript_eslint_utils.AST_NODE_TYPES.TSTypeAliasDeclaration;
2852
- const preferInlineTypeExport = createRule$6({
2853
- name: "prefer-inline-type-export",
2854
- meta: {
2855
- type: "suggestion",
2856
- docs: { description: "Require type and interface declarations to be exported inline rather than via a separate export statement" },
2857
- fixable: "code",
2858
- messages: { preferInlineExport: "Export '{{name}}' inline at its declaration instead of using a separate export statement." },
2859
- schema: []
2860
- },
2861
- defaultOptions: [],
2862
- create(context) {
2863
- const typeDeclarations = /* @__PURE__ */ new Map();
2864
- function collectDeclaration(node) {
2865
- if (node.parent.type !== _typescript_eslint_utils.AST_NODE_TYPES.ExportNamedDeclaration) typeDeclarations.set(node.id.name, node);
2866
- }
2867
- function reportSpecifier(specifier, statement, declarationNode) {
2868
- if (specifier.local.type !== _typescript_eslint_utils.AST_NODE_TYPES.Identifier) return;
2869
- const { name } = specifier.local;
2870
- context.report({
2871
- node: specifier,
2872
- messageId: "preferInlineExport",
2873
- data: { name },
2874
- fix(fixer) {
2875
- const { sourceCode } = context;
2876
- const declarationToken = sourceCode.getFirstToken(declarationNode);
2877
- if (!declarationToken) return null;
2878
- if (statement.specifiers.length === 1) {
2879
- const nextToken = sourceCode.getTokenAfter(statement);
2880
- const end = nextToken ? nextToken.range[0] : statement.range[1];
2881
- return [fixer.insertTextBefore(declarationToken, "export "), fixer.removeRange([statement.range[0], end])];
2882
- }
2883
- const tokenBefore = sourceCode.getTokenBefore(specifier);
2884
- const tokenAfter = sourceCode.getTokenAfter(specifier);
2885
- if (!tokenBefore || !tokenAfter) return null;
2886
- const removalRange = statement.specifiers.at(-1) === specifier && tokenBefore.value === "," ? [tokenBefore.range[0], specifier.range[1]] : [specifier.range[0], tokenAfter.range[1]];
2887
- return [fixer.insertTextBefore(declarationToken, "export "), fixer.removeRange(removalRange)];
2888
- }
2889
- });
2890
- }
2891
- return { Program(node) {
2892
- node.body.forEach((statement) => {
2893
- if (statement.type === _typescript_eslint_utils.AST_NODE_TYPES.TSInterfaceDeclaration || statement.type === _typescript_eslint_utils.AST_NODE_TYPES.TSTypeAliasDeclaration) collectDeclaration(statement);
2894
- });
2895
- node.body.forEach((statement) => {
2896
- if (statement.type !== _typescript_eslint_utils.AST_NODE_TYPES.ExportNamedDeclaration || statement.declaration !== null) return;
2897
- statement.specifiers.forEach((specifier) => {
2898
- if (specifier.local.type !== _typescript_eslint_utils.AST_NODE_TYPES.Identifier) return;
2899
- const declarationNode = typeDeclarations.get(specifier.local.name);
2900
- if (!declarationNode || !isTypeDeclaration(declarationNode)) return;
2901
- reportSpecifier(specifier, statement, declarationNode);
2902
- });
2903
- });
2904
- } };
2905
- }
2906
- });
2907
- //#endregion
2908
2866
  //#region src/rules/prefer-interface-for-component-props.ts
2909
2867
  const preferInterfaceForComponentProps = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`)({
2910
2868
  name: "prefer-interface-for-component-props",
@@ -3017,6 +2975,7 @@ const preferJSXTemplateLiterals = _typescript_eslint_utils.ESLintUtils.RuleCreat
3017
2975
  },
3018
2976
  defaultOptions: [],
3019
2977
  create(context) {
2978
+ if (!isJsxFile(context.filename)) return {};
3020
2979
  function handleTextBeforeExpression(textNode, exprNode) {
3021
2980
  const textValue = textNode.value;
3022
2981
  const trimmedText = textValue.trim();
@@ -3124,10 +3083,11 @@ const preferPropsWithChildren = _typescript_eslint_utils.ESLintUtils.RuleCreator
3124
3083
  type: "suggestion",
3125
3084
  docs: { description: "Prefer PropsWithChildren<T> over manually declaring children: ReactNode in component props" },
3126
3085
  schema: [],
3127
- messages: { usePropsWithChildren: "Use 'PropsWithChildren<T>' instead of manually declaring 'children: ReactNode'." }
3086
+ messages: { usePropsWithChildren: "Use 'PropsWithChildren<T>' instead of manually declaring 'children?: ReactNode'." }
3128
3087
  },
3129
3088
  defaultOptions: [],
3130
3089
  create(context) {
3090
+ if (!isJsxFile(context.filename)) return {};
3131
3091
  function isReactNodeType(typeNode) {
3132
3092
  if (!typeNode) return false;
3133
3093
  if (typeNode.type !== _typescript_eslint_utils.AST_NODE_TYPES.TSTypeReference) return false;
@@ -3142,7 +3102,7 @@ const preferPropsWithChildren = _typescript_eslint_utils.ESLintUtils.RuleCreator
3142
3102
  if (member.key.type !== _typescript_eslint_utils.AST_NODE_TYPES.Identifier) continue;
3143
3103
  if (member.key.name !== "children") continue;
3144
3104
  if (!member.typeAnnotation) continue;
3145
- if (isReactNodeType(member.typeAnnotation.typeAnnotation)) return member;
3105
+ if (member.optional && isReactNodeType(member.typeAnnotation.typeAnnotation)) return member;
3146
3106
  }
3147
3107
  }
3148
3108
  return {
@@ -3176,6 +3136,7 @@ const preferReactImportTypes = _typescript_eslint_utils.ESLintUtils.RuleCreator(
3176
3136
  },
3177
3137
  defaultOptions: [],
3178
3138
  create(context) {
3139
+ if (!isJsxFile(context.filename)) return {};
3179
3140
  const reactTypes = new Set([
3180
3141
  "ReactNode",
3181
3142
  "ReactElement",
@@ -3288,6 +3249,7 @@ const reactPropsDestructure = _typescript_eslint_utils.ESLintUtils.RuleCreator((
3288
3249
  },
3289
3250
  defaultOptions: [],
3290
3251
  create(context) {
3252
+ if (!isJsxFile(context.filename)) return {};
3291
3253
  function hasJSXInConditional(node) {
3292
3254
  return node.consequent.type === _typescript_eslint_utils.AST_NODE_TYPES.JSXElement || node.consequent.type === _typescript_eslint_utils.AST_NODE_TYPES.JSXFragment || node.alternate.type === _typescript_eslint_utils.AST_NODE_TYPES.JSXElement || node.alternate.type === _typescript_eslint_utils.AST_NODE_TYPES.JSXFragment;
3293
3255
  }
@@ -3757,7 +3719,6 @@ const rules = {
3757
3719
  "prefer-guard-clause": preferGuardClause,
3758
3720
  "prefer-import-type": preferImportType,
3759
3721
  "prefer-inline-literal-union": preferInlineLiteralUnion,
3760
- "prefer-inline-type-export": preferInlineTypeExport,
3761
3722
  "prefer-interface-for-component-props": preferInterfaceForComponentProps,
3762
3723
  "prefer-interface-over-inline-types": preferInterfaceOverInlineTypes,
3763
3724
  "prefer-jsx-template-literals": preferJSXTemplateLiterals,
@@ -3793,6 +3754,8 @@ const baseRules = {
3793
3754
  "nextfriday/no-direct-date": "warn",
3794
3755
  "nextfriday/no-emoji": "warn",
3795
3756
  "nextfriday/no-env-fallback": "warn",
3757
+ "nextfriday/no-helper-function-in-hook": "warn",
3758
+ "nextfriday/no-helper-function-in-test": "warn",
3796
3759
  "nextfriday/no-inline-default-export": "warn",
3797
3760
  "nextfriday/no-inline-nested-object": "warn",
3798
3761
  "nextfriday/no-inline-return-properties": "warn",
@@ -3810,7 +3773,6 @@ const baseRules = {
3810
3773
  "nextfriday/prefer-guard-clause": "warn",
3811
3774
  "nextfriday/prefer-import-type": "warn",
3812
3775
  "nextfriday/prefer-inline-literal-union": "warn",
3813
- "nextfriday/prefer-inline-type-export": "warn",
3814
3776
  "nextfriday/prefer-named-param-types": "warn",
3815
3777
  "nextfriday/prefer-react-import-types": "warn",
3816
3778
  "nextfriday/require-explicit-return-type": "warn",
@@ -3837,6 +3799,8 @@ const baseRecommendedRules = {
3837
3799
  "nextfriday/no-direct-date": "error",
3838
3800
  "nextfriday/no-emoji": "error",
3839
3801
  "nextfriday/no-env-fallback": "error",
3802
+ "nextfriday/no-helper-function-in-hook": "error",
3803
+ "nextfriday/no-helper-function-in-test": "error",
3840
3804
  "nextfriday/no-inline-default-export": "error",
3841
3805
  "nextfriday/no-inline-nested-object": "error",
3842
3806
  "nextfriday/no-inline-return-properties": "error",
@@ -3854,7 +3818,6 @@ const baseRecommendedRules = {
3854
3818
  "nextfriday/prefer-guard-clause": "error",
3855
3819
  "nextfriday/prefer-import-type": "error",
3856
3820
  "nextfriday/prefer-inline-literal-union": "error",
3857
- "nextfriday/prefer-inline-type-export": "error",
3858
3821
  "nextfriday/prefer-named-param-types": "error",
3859
3822
  "nextfriday/prefer-react-import-types": "error",
3860
3823
  "nextfriday/require-explicit-return-type": "error",