eslint-plugin-nextfriday 4.3.2 → 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.js CHANGED
@@ -4,10 +4,10 @@ import path from "path";
4
4
  import emojiRegex from "emoji-regex";
5
5
  //#region package.json
6
6
  var name = "eslint-plugin-nextfriday";
7
- var version = "4.3.2";
7
+ var version = "4.4.0";
8
8
  //#endregion
9
9
  //#region src/rules/boolean-naming-prefix.ts
10
- const createRule$32 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
10
+ const createRule$31 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
11
11
  const BOOLEAN_PREFIXES = [
12
12
  "is",
13
13
  "has",
@@ -56,7 +56,7 @@ const hasBooleanTypeAnnotation = (node) => {
56
56
  }
57
57
  return false;
58
58
  };
59
- const booleanNamingPrefix = createRule$32({
59
+ const booleanNamingPrefix = createRule$31({
60
60
  name: "boolean-naming-prefix",
61
61
  meta: {
62
62
  type: "suggestion",
@@ -117,7 +117,7 @@ const booleanNamingPrefix = createRule$32({
117
117
  });
118
118
  //#endregion
119
119
  //#region src/rules/enforce-camel-case.ts
120
- const createRule$31 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
120
+ const createRule$30 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
121
121
  const SNAKE_CASE_REGEX$2 = /^[a-z]+_[a-z0-9_]*$/;
122
122
  const PASCAL_CASE_REGEX = /^[A-Z][a-zA-Z0-9]*$/;
123
123
  const REACT_WRAPPERS = [
@@ -161,7 +161,7 @@ const isStaticValue$1 = (init) => {
161
161
  if (init.type === AST_NODE_TYPES.TSAsExpression && init.typeAnnotation.type === AST_NODE_TYPES.TSTypeReference && init.typeAnnotation.typeName.type === AST_NODE_TYPES.Identifier && init.typeAnnotation.typeName.name === "const") return true;
162
162
  return false;
163
163
  };
164
- const enforceCamelCase = createRule$31({
164
+ const enforceCamelCase = createRule$30({
165
165
  name: "enforce-camel-case",
166
166
  meta: {
167
167
  type: "suggestion",
@@ -222,7 +222,7 @@ const isConfigFile = (filename) => {
222
222
  };
223
223
  //#endregion
224
224
  //#region src/rules/enforce-constant-case.ts
225
- const createRule$30 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
225
+ const createRule$29 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
226
226
  const SCREAMING_SNAKE_CASE_REGEX$2 = /^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$/;
227
227
  const SNAKE_CASE_REGEX$1 = /^[a-z]+_[a-z0-9_]*$/;
228
228
  const toScreamingSnakeCase = (str) => str.replace(/([a-z])([A-Z])/g, "$1_$2").replace(/([A-Z])([A-Z][a-z])/g, "$1_$2").toUpperCase();
@@ -240,7 +240,7 @@ const isGlobalScope$1 = (node) => {
240
240
  if (parent.type === AST_NODE_TYPES.ExportNamedDeclaration && parent.parent?.type === AST_NODE_TYPES.Program) return true;
241
241
  return false;
242
242
  };
243
- const enforceConstantCase = createRule$30({
243
+ const enforceConstantCase = createRule$29({
244
244
  name: "enforce-constant-case",
245
245
  meta: {
246
246
  type: "suggestion",
@@ -364,7 +364,7 @@ const enforceHookNaming = ESLintUtils.RuleCreator((name) => `https://github.com/
364
364
  });
365
365
  //#endregion
366
366
  //#region src/rules/enforce-property-case.ts
367
- const createRule$29 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
367
+ const createRule$28 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
368
368
  const SNAKE_CASE_REGEX = /^[a-z]+_[a-z0-9_]*$/;
369
369
  const SCREAMING_SNAKE_CASE_REGEX$1 = /^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$/;
370
370
  const isInsideAsConst = (node) => {
@@ -376,7 +376,7 @@ const isInsideAsConst = (node) => {
376
376
  }
377
377
  return false;
378
378
  };
379
- const enforcePropertyCase = createRule$29({
379
+ const enforcePropertyCase = createRule$28({
380
380
  name: "enforce-property-case",
381
381
  meta: {
382
382
  type: "suggestion",
@@ -509,7 +509,7 @@ const enforceReadonlyComponentProps = ESLintUtils.RuleCreator((name) => `https:/
509
509
  });
510
510
  //#endregion
511
511
  //#region src/rules/enforce-render-naming.ts
512
- const createRule$28 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
512
+ const createRule$27 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
513
513
  const ARRAY_RETURNING_METHODS = new Set([
514
514
  "map",
515
515
  "flatMap",
@@ -558,7 +558,7 @@ function isComponentFunction(node) {
558
558
  if (parent?.type === AST_NODE_TYPES.VariableDeclarator && parent.id.type === AST_NODE_TYPES.Identifier && isPascalCase$1(parent.id.name)) return true;
559
559
  return false;
560
560
  }
561
- const enforceRenderNaming = createRule$28({
561
+ const enforceRenderNaming = createRule$27({
562
562
  name: "enforce-render-naming",
563
563
  meta: {
564
564
  type: "problem",
@@ -610,7 +610,7 @@ const enforceRenderNaming = createRule$28({
610
610
  });
611
611
  //#endregion
612
612
  //#region src/rules/enforce-service-naming.ts
613
- const createRule$27 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
613
+ const createRule$26 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
614
614
  const BANNED_PREFIXES = {
615
615
  delete: ["remove", "archive"],
616
616
  do: ["submit", "process"],
@@ -621,7 +621,7 @@ const BANNED_PREFIXES = {
621
621
  "patch"
622
622
  ]
623
623
  };
624
- const enforceServiceNaming = createRule$27({
624
+ const enforceServiceNaming = createRule$26({
625
625
  name: "enforce-service-naming",
626
626
  meta: {
627
627
  type: "suggestion",
@@ -659,7 +659,7 @@ const enforceServiceNaming = createRule$27({
659
659
  });
660
660
  //#endregion
661
661
  //#region src/rules/enforce-test-filename.ts
662
- const createRule$26 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
662
+ const createRule$25 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
663
663
  const TEST_GLOBALS = new Set([
664
664
  "describe",
665
665
  "it",
@@ -669,7 +669,7 @@ const TEST_GLOBALS = new Set([
669
669
  "afterEach",
670
670
  "afterAll"
671
671
  ]);
672
- const enforceTestFilename = createRule$26({
672
+ const enforceTestFilename = createRule$25({
673
673
  name: "enforce-test-filename",
674
674
  meta: {
675
675
  type: "suggestion",
@@ -749,7 +749,7 @@ const enforceSortedDestructuring = ESLintUtils.RuleCreator((name) => `https://gi
749
749
  });
750
750
  //#endregion
751
751
  //#region src/rules/enforce-type-declaration-order.ts
752
- const createRule$25 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
752
+ const createRule$24 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
753
753
  function getTypeDeclarationName(node) {
754
754
  if (node.type === AST_NODE_TYPES.TSInterfaceDeclaration && node.id.type === AST_NODE_TYPES.Identifier) return {
755
755
  name: node.id.name,
@@ -761,7 +761,7 @@ function getTypeDeclarationName(node) {
761
761
  };
762
762
  return null;
763
763
  }
764
- const enforceTypeDeclarationOrder = createRule$25({
764
+ const enforceTypeDeclarationOrder = createRule$24({
765
765
  name: "enforce-type-declaration-order",
766
766
  meta: {
767
767
  type: "suggestion",
@@ -816,7 +816,7 @@ const enforceTypeDeclarationOrder = createRule$25({
816
816
  });
817
817
  //#endregion
818
818
  //#region src/rules/index-export-only.ts
819
- const createRule$24 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
819
+ const createRule$23 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
820
820
  const isIndexFile = (filename) => getBaseName(filename) === "index";
821
821
  const isAllowedExportNamed = (node) => {
822
822
  if (!node.declaration) return true;
@@ -835,7 +835,7 @@ const isAllowedTopLevel = (node) => {
835
835
  default: return false;
836
836
  }
837
837
  };
838
- const indexExportOnly = createRule$24({
838
+ const indexExportOnly = createRule$23({
839
839
  name: "index-export-only",
840
840
  meta: {
841
841
  type: "suggestion",
@@ -909,7 +909,7 @@ const jsxNewlineBetweenElements = ESLintUtils.RuleCreator((name) => `https://git
909
909
  });
910
910
  //#endregion
911
911
  //#region src/rules/jsx-no-data-array.ts
912
- const createRule$23 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
912
+ const createRule$22 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
913
913
  function isObjectLikeElement(node) {
914
914
  if (!node) return false;
915
915
  if (node.type === AST_NODE_TYPES.ObjectExpression) return true;
@@ -922,7 +922,7 @@ function getArrayInitializer(init) {
922
922
  if (init.type === AST_NODE_TYPES.TSAsExpression || init.type === AST_NODE_TYPES.TSSatisfiesExpression) return getArrayInitializer(init.expression);
923
923
  return null;
924
924
  }
925
- const jsxNoDataArray = createRule$23({
925
+ const jsxNoDataArray = createRule$22({
926
926
  name: "jsx-no-data-array",
927
927
  meta: {
928
928
  type: "problem",
@@ -963,7 +963,7 @@ const jsxNoDataArray = createRule$23({
963
963
  });
964
964
  //#endregion
965
965
  //#region src/rules/jsx-no-data-object.ts
966
- const createRule$22 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
966
+ const createRule$21 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
967
967
  function unwrapAssertion(node) {
968
968
  if (!node) return null;
969
969
  if (node.type === AST_NODE_TYPES.TSAsExpression || node.type === AST_NODE_TYPES.TSSatisfiesExpression) return unwrapAssertion(node.expression);
@@ -993,7 +993,7 @@ function getObjectInitializer(init) {
993
993
  if (unwrapped.type === AST_NODE_TYPES.ObjectExpression) return unwrapped;
994
994
  return null;
995
995
  }
996
- const jsxNoDataObject = createRule$22({
996
+ const jsxNoDataObject = createRule$21({
997
997
  name: "jsx-no-data-object",
998
998
  meta: {
999
999
  type: "problem",
@@ -1046,14 +1046,14 @@ const jsxNoInlineObjectProp = ESLintUtils.RuleCreator((name) => `https://github.
1046
1046
  });
1047
1047
  //#endregion
1048
1048
  //#region src/rules/jsx-no-newline-single-line-elements.ts
1049
- const createRule$21 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
1049
+ const createRule$20 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
1050
1050
  function isJSXElementOrFragment(node) {
1051
1051
  return node.type === AST_NODE_TYPES.JSXElement || node.type === AST_NODE_TYPES.JSXFragment;
1052
1052
  }
1053
1053
  function isSingleLine(node) {
1054
1054
  return node.loc.start.line === node.loc.end.line;
1055
1055
  }
1056
- const jsxNoNewlineSingleLineElements = createRule$21({
1056
+ const jsxNoNewlineSingleLineElements = createRule$20({
1057
1057
  name: "jsx-no-newline-single-line-elements",
1058
1058
  meta: {
1059
1059
  type: "layout",
@@ -1152,7 +1152,7 @@ const jsxNoNonComponentFunction = ESLintUtils.RuleCreator((name) => `https://git
1152
1152
  });
1153
1153
  //#endregion
1154
1154
  //#region src/rules/jsx-no-sub-interface.ts
1155
- const createRule$20 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
1155
+ const createRule$19 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
1156
1156
  const PROPS_WRAPPER_NAMES = new Set([
1157
1157
  "Readonly",
1158
1158
  "Required",
@@ -1184,7 +1184,7 @@ function getDeclarationFromExportWrapper(node) {
1184
1184
  if (node.type === AST_NODE_TYPES.ExportDefaultDeclaration) return node.declaration;
1185
1185
  return node;
1186
1186
  }
1187
- const jsxNoSubInterface = createRule$20({
1187
+ const jsxNoSubInterface = createRule$19({
1188
1188
  name: "jsx-no-sub-interface",
1189
1189
  meta: {
1190
1190
  type: "problem",
@@ -1251,13 +1251,13 @@ const jsxNoSubInterface = createRule$20({
1251
1251
  });
1252
1252
  //#endregion
1253
1253
  //#region src/rules/jsx-no-ternary-null.ts
1254
- const createRule$19 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
1254
+ const createRule$18 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
1255
1255
  function isNullOrUndefined(node) {
1256
1256
  if (node.type === AST_NODE_TYPES.Literal && node.value === null) return true;
1257
1257
  if (node.type === AST_NODE_TYPES.Identifier && node.name === "undefined") return true;
1258
1258
  return false;
1259
1259
  }
1260
- const jsxNoTernaryNull = createRule$19({
1260
+ const jsxNoTernaryNull = createRule$18({
1261
1261
  name: "jsx-no-ternary-null",
1262
1262
  meta: {
1263
1263
  type: "suggestion",
@@ -1424,7 +1424,7 @@ const jsxSimpleProps = ESLintUtils.RuleCreator((name) => `https://github.com/nex
1424
1424
  });
1425
1425
  //#endregion
1426
1426
  //#region src/rules/jsx-sort-props.ts
1427
- const createRule$18 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
1427
+ const createRule$17 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
1428
1428
  const TYPE_GROUP = {
1429
1429
  STRING: 1,
1430
1430
  HYPHENATED_STRING: 2,
@@ -1507,7 +1507,7 @@ function getSegments(attributes) {
1507
1507
  if (current.length > 0) result.push(current);
1508
1508
  return result;
1509
1509
  }
1510
- const jsxSortProps = createRule$18({
1510
+ const jsxSortProps = createRule$17({
1511
1511
  name: "jsx-sort-props",
1512
1512
  meta: {
1513
1513
  type: "suggestion",
@@ -1562,7 +1562,7 @@ const jsxSpreadPropsLast = ESLintUtils.RuleCreator((name) => `https://github.com
1562
1562
  });
1563
1563
  //#endregion
1564
1564
  //#region src/rules/newline-after-multiline-block.ts
1565
- const createRule$17 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
1565
+ const createRule$16 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
1566
1566
  function isImportDeclaration(node) {
1567
1567
  return node.type === AST_NODE_TYPES.ImportDeclaration;
1568
1568
  }
@@ -1587,7 +1587,7 @@ function checkStatements(statements, context) {
1587
1587
  });
1588
1588
  });
1589
1589
  }
1590
- const newlineAfterMultilineBlock = createRule$17({
1590
+ const newlineAfterMultilineBlock = createRule$16({
1591
1591
  name: "newline-after-multiline-block",
1592
1592
  meta: {
1593
1593
  type: "layout",
@@ -1773,12 +1773,12 @@ const noEnvFallback = ESLintUtils.RuleCreator((name) => `https://github.com/next
1773
1773
  });
1774
1774
  //#endregion
1775
1775
  //#region src/rules/no-ghost-wrapper.ts
1776
- const createRule$16 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
1776
+ const createRule$15 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
1777
1777
  const GHOST_TAGS = new Set(["div", "span"]);
1778
1778
  function isKeyAttribute(attribute) {
1779
1779
  return attribute.type === AST_NODE_TYPES.JSXAttribute && attribute.name.type === AST_NODE_TYPES.JSXIdentifier && attribute.name.name === "key";
1780
1780
  }
1781
- const noGhostWrapper = createRule$16({
1781
+ const noGhostWrapper = createRule$15({
1782
1782
  name: "no-ghost-wrapper",
1783
1783
  meta: {
1784
1784
  type: "problem",
@@ -1950,7 +1950,7 @@ const noInlineDefaultExport = ESLintUtils.RuleCreator((name) => `https://github.
1950
1950
  });
1951
1951
  //#endregion
1952
1952
  //#region src/rules/no-inline-nested-object.ts
1953
- const createRule$15 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
1953
+ const createRule$14 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
1954
1954
  function isObjectOrArray(node) {
1955
1955
  return node.type === AST_NODE_TYPES.ObjectExpression || node.type === AST_NODE_TYPES.ArrayExpression || node.type === AST_NODE_TYPES.TSAsExpression;
1956
1956
  }
@@ -1972,7 +1972,7 @@ function containsNestedStructure(node) {
1972
1972
  return isNestedStructure(el);
1973
1973
  });
1974
1974
  }
1975
- const noInlineNestedObject = createRule$15({
1975
+ const noInlineNestedObject = createRule$14({
1976
1976
  name: "no-inline-nested-object",
1977
1977
  meta: {
1978
1978
  type: "layout",
@@ -2014,13 +2014,13 @@ const noInlineNestedObject = createRule$15({
2014
2014
  });
2015
2015
  //#endregion
2016
2016
  //#region src/rules/no-inline-return-properties.ts
2017
- const createRule$14 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2017
+ const createRule$13 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2018
2018
  const isShorthandProperty = (property) => {
2019
2019
  if (property.type === AST_NODE_TYPES.SpreadElement) return true;
2020
2020
  if (property.type !== AST_NODE_TYPES.Property) return false;
2021
2021
  return property.shorthand;
2022
2022
  };
2023
- const noInlineReturnProperties = createRule$14({
2023
+ const noInlineReturnProperties = createRule$13({
2024
2024
  name: "no-inline-return-properties",
2025
2025
  meta: {
2026
2026
  type: "suggestion",
@@ -2049,9 +2049,9 @@ const noInlineReturnProperties = createRule$14({
2049
2049
  });
2050
2050
  //#endregion
2051
2051
  //#region src/rules/no-inline-type-import.ts
2052
- const createRule$13 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2052
+ const createRule$12 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2053
2053
  const isInlineTypeSpecifier = (specifier) => specifier.type === AST_NODE_TYPES.ImportSpecifier && specifier.importKind === "type";
2054
- const noInlineTypeImport = createRule$13({
2054
+ const noInlineTypeImport = createRule$12({
2055
2055
  name: "no-inline-type-import",
2056
2056
  meta: {
2057
2057
  type: "suggestion",
@@ -2093,7 +2093,7 @@ const noInlineTypeImport = createRule$13({
2093
2093
  });
2094
2094
  //#endregion
2095
2095
  //#region src/rules/no-lazy-identifiers.ts
2096
- const createRule$12 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2096
+ const createRule$11 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2097
2097
  const KEYBOARD_ROWS = [
2098
2098
  "qwertyuiop",
2099
2099
  "asdfghjkl",
@@ -2124,7 +2124,7 @@ const isLazyIdentifier = (name) => {
2124
2124
  if (hasKeyboardSequence(name)) return true;
2125
2125
  return false;
2126
2126
  };
2127
- const noLazyIdentifiers = createRule$12({
2127
+ const noLazyIdentifiers = createRule$11({
2128
2128
  name: "no-lazy-identifiers",
2129
2129
  meta: {
2130
2130
  type: "problem",
@@ -2243,7 +2243,7 @@ const noLogicInParams = ESLintUtils.RuleCreator((name) => `https://github.com/ne
2243
2243
  });
2244
2244
  //#endregion
2245
2245
  //#region src/rules/no-misleading-constant-case.ts
2246
- const createRule$11 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2246
+ const createRule$10 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2247
2247
  const SCREAMING_SNAKE_CASE_REGEX = /^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$/;
2248
2248
  const isAsConstAssertion = (node) => node.type === AST_NODE_TYPES.TSAsExpression && node.typeAnnotation.type === AST_NODE_TYPES.TSTypeReference && node.typeAnnotation.typeName.type === AST_NODE_TYPES.Identifier && node.typeAnnotation.typeName.name === "const";
2249
2249
  const isStaticValue = (init) => {
@@ -2261,7 +2261,7 @@ const isGlobalScope = (node) => {
2261
2261
  if (parent.type === AST_NODE_TYPES.ExportNamedDeclaration && parent.parent?.type === AST_NODE_TYPES.Program) return true;
2262
2262
  return false;
2263
2263
  };
2264
- const noMisleadingConstantCase = createRule$11({
2264
+ const noMisleadingConstantCase = createRule$10({
2265
2265
  name: "no-misleading-constant-case",
2266
2266
  meta: {
2267
2267
  type: "suggestion",
@@ -2375,7 +2375,7 @@ const noNestedTernary = ESLintUtils.RuleCreator((name) => `https://github.com/ne
2375
2375
  });
2376
2376
  //#endregion
2377
2377
  //#region src/rules/no-redundant-fragment.ts
2378
- const createRule$10 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2378
+ const createRule$9 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2379
2379
  function isFragmentName(name) {
2380
2380
  if (name.type === AST_NODE_TYPES.JSXIdentifier && name.name === "Fragment") return true;
2381
2381
  if (name.type === AST_NODE_TYPES.JSXMemberExpression && name.object.type === AST_NODE_TYPES.JSXIdentifier && name.object.name === "React" && name.property.type === AST_NODE_TYPES.JSXIdentifier && name.property.name === "Fragment") return true;
@@ -2390,7 +2390,7 @@ function countMeaningfulChildren(children) {
2390
2390
  return true;
2391
2391
  }).length;
2392
2392
  }
2393
- const noRedundantFragment = createRule$10({
2393
+ const noRedundantFragment = createRule$9({
2394
2394
  name: "no-redundant-fragment",
2395
2395
  meta: {
2396
2396
  type: "problem",
@@ -2460,7 +2460,7 @@ const noRelativeImports = ESLintUtils.RuleCreator((name) => `https://github.com/
2460
2460
  });
2461
2461
  //#endregion
2462
2462
  //#region src/rules/no-single-char-variables.ts
2463
- const createRule$9 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2463
+ const createRule$8 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2464
2464
  const ALLOWED_IN_FOR_LOOPS = new Set([
2465
2465
  "i",
2466
2466
  "j",
@@ -2486,7 +2486,7 @@ const isAllowedInContext = (name, node) => {
2486
2486
  if (ALLOWED_IN_FOR_LOOPS.has(name) && isForLoopInit(node)) return true;
2487
2487
  return false;
2488
2488
  };
2489
- const noSingleCharVariables = createRule$9({
2489
+ const noSingleCharVariables = createRule$8({
2490
2490
  name: "no-single-char-variables",
2491
2491
  meta: {
2492
2492
  type: "suggestion",
@@ -2608,7 +2608,7 @@ const preferDestructuringParams = ESLintUtils.RuleCreator((name) => `https://git
2608
2608
  });
2609
2609
  //#endregion
2610
2610
  //#region src/rules/prefer-function-declaration.ts
2611
- const createRule$8 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2611
+ const createRule$7 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2612
2612
  const isTsFile = (filename) => filename.endsWith(".ts") && !filename.endsWith(".d.ts");
2613
2613
  const isCallbackContext = (node) => {
2614
2614
  const { parent } = node;
@@ -2623,7 +2623,7 @@ const isCallbackContext = (node) => {
2623
2623
  if (parent.type === AST_NODE_TYPES.AssignmentExpression && parent.left !== node) return true;
2624
2624
  return false;
2625
2625
  };
2626
- const preferFunctionDeclaration = createRule$8({
2626
+ const preferFunctionDeclaration = createRule$7({
2627
2627
  name: "prefer-function-declaration",
2628
2628
  meta: {
2629
2629
  type: "suggestion",
@@ -2738,6 +2738,7 @@ const preferImportType = ESLintUtils.RuleCreator((name) => `https://github.com/n
2738
2738
  switch (parent.type) {
2739
2739
  case AST_NODE_TYPES.CallExpression:
2740
2740
  case AST_NODE_TYPES.NewExpression:
2741
+ case AST_NODE_TYPES.JSXMemberExpression:
2741
2742
  case AST_NODE_TYPES.JSXOpeningElement:
2742
2743
  case AST_NODE_TYPES.JSXClosingElement:
2743
2744
  case AST_NODE_TYPES.MemberExpression:
@@ -2791,12 +2792,12 @@ const preferImportType = ESLintUtils.RuleCreator((name) => `https://github.com/n
2791
2792
  });
2792
2793
  //#endregion
2793
2794
  //#region src/rules/prefer-inline-literal-union.ts
2794
- const createRule$7 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2795
+ const createRule$6 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2795
2796
  function isLiteralUnionType(node) {
2796
2797
  if (node.type !== AST_NODE_TYPES.TSUnionType) return false;
2797
2798
  return node.types.every((member) => member.type === AST_NODE_TYPES.TSLiteralType || member.type === AST_NODE_TYPES.TSNullKeyword || member.type === AST_NODE_TYPES.TSUndefinedKeyword);
2798
2799
  }
2799
- const preferInlineLiteralUnion = createRule$7({
2800
+ const preferInlineLiteralUnion = createRule$6({
2800
2801
  name: "prefer-inline-literal-union",
2801
2802
  meta: {
2802
2803
  type: "suggestion",
@@ -2834,65 +2835,6 @@ const preferInlineLiteralUnion = createRule$7({
2834
2835
  }
2835
2836
  });
2836
2837
  //#endregion
2837
- //#region src/rules/prefer-inline-type-export.ts
2838
- const createRule$6 = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`);
2839
- const isTypeDeclaration = (node) => node.type === AST_NODE_TYPES.TSInterfaceDeclaration || node.type === AST_NODE_TYPES.TSTypeAliasDeclaration;
2840
- const preferInlineTypeExport = createRule$6({
2841
- name: "prefer-inline-type-export",
2842
- meta: {
2843
- type: "suggestion",
2844
- docs: { description: "Require type and interface declarations to be exported inline rather than via a separate export statement" },
2845
- fixable: "code",
2846
- messages: { preferInlineExport: "Export '{{name}}' inline at its declaration instead of using a separate export statement." },
2847
- schema: []
2848
- },
2849
- defaultOptions: [],
2850
- create(context) {
2851
- const typeDeclarations = /* @__PURE__ */ new Map();
2852
- function collectDeclaration(node) {
2853
- if (node.parent.type !== AST_NODE_TYPES.ExportNamedDeclaration) typeDeclarations.set(node.id.name, node);
2854
- }
2855
- function reportSpecifier(specifier, statement, declarationNode) {
2856
- if (specifier.local.type !== AST_NODE_TYPES.Identifier) return;
2857
- const { name } = specifier.local;
2858
- context.report({
2859
- node: specifier,
2860
- messageId: "preferInlineExport",
2861
- data: { name },
2862
- fix(fixer) {
2863
- const { sourceCode } = context;
2864
- const declarationToken = sourceCode.getFirstToken(declarationNode);
2865
- if (!declarationToken) return null;
2866
- if (statement.specifiers.length === 1) {
2867
- const nextToken = sourceCode.getTokenAfter(statement);
2868
- const end = nextToken ? nextToken.range[0] : statement.range[1];
2869
- return [fixer.insertTextBefore(declarationToken, "export "), fixer.removeRange([statement.range[0], end])];
2870
- }
2871
- const tokenBefore = sourceCode.getTokenBefore(specifier);
2872
- const tokenAfter = sourceCode.getTokenAfter(specifier);
2873
- if (!tokenBefore || !tokenAfter) return null;
2874
- const removalRange = statement.specifiers.at(-1) === specifier && tokenBefore.value === "," ? [tokenBefore.range[0], specifier.range[1]] : [specifier.range[0], tokenAfter.range[1]];
2875
- return [fixer.insertTextBefore(declarationToken, "export "), fixer.removeRange(removalRange)];
2876
- }
2877
- });
2878
- }
2879
- return { Program(node) {
2880
- node.body.forEach((statement) => {
2881
- if (statement.type === AST_NODE_TYPES.TSInterfaceDeclaration || statement.type === AST_NODE_TYPES.TSTypeAliasDeclaration) collectDeclaration(statement);
2882
- });
2883
- node.body.forEach((statement) => {
2884
- if (statement.type !== AST_NODE_TYPES.ExportNamedDeclaration || statement.declaration !== null) return;
2885
- statement.specifiers.forEach((specifier) => {
2886
- if (specifier.local.type !== AST_NODE_TYPES.Identifier) return;
2887
- const declarationNode = typeDeclarations.get(specifier.local.name);
2888
- if (!declarationNode || !isTypeDeclaration(declarationNode)) return;
2889
- reportSpecifier(specifier, statement, declarationNode);
2890
- });
2891
- });
2892
- } };
2893
- }
2894
- });
2895
- //#endregion
2896
2838
  //#region src/rules/prefer-interface-for-component-props.ts
2897
2839
  const preferInterfaceForComponentProps = ESLintUtils.RuleCreator((name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name.replaceAll("-", "_").toUpperCase()}.md`)({
2898
2840
  name: "prefer-interface-for-component-props",
@@ -3113,7 +3055,7 @@ const preferPropsWithChildren = ESLintUtils.RuleCreator((name) => `https://githu
3113
3055
  type: "suggestion",
3114
3056
  docs: { description: "Prefer PropsWithChildren<T> over manually declaring children: ReactNode in component props" },
3115
3057
  schema: [],
3116
- messages: { usePropsWithChildren: "Use 'PropsWithChildren<T>' instead of manually declaring 'children: ReactNode'." }
3058
+ messages: { usePropsWithChildren: "Use 'PropsWithChildren<T>' instead of manually declaring 'children?: ReactNode'." }
3117
3059
  },
3118
3060
  defaultOptions: [],
3119
3061
  create(context) {
@@ -3132,7 +3074,7 @@ const preferPropsWithChildren = ESLintUtils.RuleCreator((name) => `https://githu
3132
3074
  if (member.key.type !== AST_NODE_TYPES.Identifier) continue;
3133
3075
  if (member.key.name !== "children") continue;
3134
3076
  if (!member.typeAnnotation) continue;
3135
- if (isReactNodeType(member.typeAnnotation.typeAnnotation)) return member;
3077
+ if (member.optional && isReactNodeType(member.typeAnnotation.typeAnnotation)) return member;
3136
3078
  }
3137
3079
  }
3138
3080
  return {
@@ -3749,7 +3691,6 @@ const rules = {
3749
3691
  "prefer-guard-clause": preferGuardClause,
3750
3692
  "prefer-import-type": preferImportType,
3751
3693
  "prefer-inline-literal-union": preferInlineLiteralUnion,
3752
- "prefer-inline-type-export": preferInlineTypeExport,
3753
3694
  "prefer-interface-for-component-props": preferInterfaceForComponentProps,
3754
3695
  "prefer-interface-over-inline-types": preferInterfaceOverInlineTypes,
3755
3696
  "prefer-jsx-template-literals": preferJSXTemplateLiterals,
@@ -3804,7 +3745,6 @@ const baseRules = {
3804
3745
  "nextfriday/prefer-guard-clause": "warn",
3805
3746
  "nextfriday/prefer-import-type": "warn",
3806
3747
  "nextfriday/prefer-inline-literal-union": "warn",
3807
- "nextfriday/prefer-inline-type-export": "warn",
3808
3748
  "nextfriday/prefer-named-param-types": "warn",
3809
3749
  "nextfriday/prefer-react-import-types": "warn",
3810
3750
  "nextfriday/require-explicit-return-type": "warn",
@@ -3850,7 +3790,6 @@ const baseRecommendedRules = {
3850
3790
  "nextfriday/prefer-guard-clause": "error",
3851
3791
  "nextfriday/prefer-import-type": "error",
3852
3792
  "nextfriday/prefer-inline-literal-union": "error",
3853
- "nextfriday/prefer-inline-type-export": "error",
3854
3793
  "nextfriday/prefer-named-param-types": "error",
3855
3794
  "nextfriday/prefer-react-import-types": "error",
3856
3795
  "nextfriday/require-explicit-return-type": "error",