oxlint-plugin-arch 0.6.2 → 0.7.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/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // src/index.ts
2
2
  import { eslintCompatPlugin } from "@oxlint/plugins";
3
3
 
4
- // src/rules/call-array-multiline.ts
4
+ // src/rules/call-arguments-multiline.ts
5
5
  import { defineRule } from "@oxlint/plugins";
6
6
 
7
7
  // src/utils/helpers/ast.ts
@@ -894,6 +894,49 @@ function routesInspectFunction(context, item, bannedHooks, banIntrinsicJsx) {
894
894
  }
895
895
  });
896
896
  }
897
+ // src/utils/helpers/runtime.ts
898
+ import { builtinModules } from "node:module";
899
+ var runtimeServerGlobals = ["process", "Bun", "Deno", "Buffer", "__dirname", "__filename", "require"];
900
+ var runtimeBrowserGlobals = [
901
+ "window",
902
+ "document",
903
+ "navigator",
904
+ "localStorage",
905
+ "sessionStorage",
906
+ "location",
907
+ "history",
908
+ "screen",
909
+ "HTMLElement",
910
+ "Element",
911
+ "HTMLInputElement",
912
+ "ResizeObserver",
913
+ "MutationObserver",
914
+ "IntersectionObserver",
915
+ "FileReader",
916
+ "matchMedia",
917
+ "getComputedStyle",
918
+ "requestAnimationFrame",
919
+ "cancelAnimationFrame",
920
+ "alert",
921
+ "confirm",
922
+ "prompt"
923
+ ];
924
+ function runtimeMatchesImport(values, source) {
925
+ return Boolean(values?.some((value) => source === value || source.startsWith(value + "/")));
926
+ }
927
+ function runtimeIsBackendImport(options, target, source) {
928
+ return options.backend.some((path) => target.startsWith(path + "/")) || options.backendPackages.some((name) => source === name || source.startsWith(name + "/") && /\/(?:server|rpc)(?:\/|$)/.test(source.slice(name.length)));
929
+ }
930
+ function runtimeIsServerPlatformImport(source) {
931
+ return builtinModules.includes(source) || source === "@orpc/server" || /^(?:node:|bun(?::|$)|cloudflare:)/.test(source) || /^react-dom\/server(?:\.|\/|$)/.test(source);
932
+ }
933
+ function runtimeMemberName(node) {
934
+ if (node?.type !== "MemberExpression")
935
+ return null;
936
+ if (!node.computed && node.property.type === "Identifier")
937
+ return node.property.name;
938
+ return node.computed && node.property.type === "Literal" && typeof node.property.value === "string" ? node.property.value : null;
939
+ }
897
940
  // src/utils/helpers/sanitizers.ts
898
941
  function sanitizersCallsConfigured(node, names) {
899
942
  let found = false;
@@ -981,7 +1024,91 @@ function boundaryResolveTarget(options, file, source) {
981
1024
  const alias = Object.entries(options.aliases).sort(([a], [b]) => b.length - a.length).find(([prefix]) => source === prefix || source.startsWith(`${prefix}/`));
982
1025
  return alias ? resolve(alias[1], source.slice(alias[0].length).replace(/^\//, "")).replaceAll("\\", "/") : source.startsWith(".") ? resolve(dirname(file), source).replaceAll("\\", "/") : source.startsWith("@/") && web ? `${web}/${source.slice(2)}` : source.startsWith("#/") && owner ? `${owner}/${source.slice(2)}` : source.startsWith("#services/") && owner ? `${owner}/services/${source.slice(10)}` : source;
983
1026
  }
1027
+ // src/rules/call-arguments-multiline.ts
1028
+ function callArgumentsIsCallback(node) {
1029
+ return (node.type === "ArrowFunctionExpression" || node.type === "FunctionExpression") && node.loc.start.line !== node.loc.end.line;
1030
+ }
1031
+ var callArgumentsMultiline = defineRule({
1032
+ meta: {
1033
+ type: "layout",
1034
+ fixable: "code",
1035
+ schema: [
1036
+ {
1037
+ type: "object",
1038
+ additionalProperties: false,
1039
+ properties: {
1040
+ minArguments: {
1041
+ type: "integer",
1042
+ minimum: 2,
1043
+ default: 3
1044
+ },
1045
+ indent: {
1046
+ type: "integer",
1047
+ minimum: 1,
1048
+ default: 2
1049
+ }
1050
+ }
1051
+ }
1052
+ ],
1053
+ messages: {
1054
+ multiline: "A call with {{min}}+ arguments puts each argument on its own line."
1055
+ }
1056
+ },
1057
+ createOnce(context) {
1058
+ let minArguments = 3;
1059
+ let indent = 2;
1060
+ const check = (node) => {
1061
+ const args = node.arguments;
1062
+ if (args.length < minArguments || args.some(callArgumentsIsCallback) || context.sourceCode.getCommentsInside(node).length > 0) {
1063
+ return;
1064
+ }
1065
+ const text = context.sourceCode.text;
1066
+ const open = text.indexOf("(", (node.typeArguments ?? node.callee).range[1]);
1067
+ const close = node.range[1] - 1;
1068
+ const first = args[0];
1069
+ const last = args[args.length - 1];
1070
+ const gaps = [[open + 1, first.range[0]]];
1071
+ for (let index = 1;index < args.length; index++) {
1072
+ gaps.push([args[index - 1].range[1], args[index].range[0]]);
1073
+ }
1074
+ gaps.push([last.range[1], close]);
1075
+ const between = gaps.map(([start, end]) => text.slice(start, end));
1076
+ if (text[open] !== "(" || text[close] !== ")" || !/^\s*$/.test(between[0]) || between.slice(1, -1).some((gap) => !/^\s*,\s*$/.test(gap)) || !/^\s*,?\s*$/.test(between[between.length - 1])) {
1077
+ return;
1078
+ }
1079
+ if (between.every((gap) => gap.includes(`
1080
+ `))) {
1081
+ return;
1082
+ }
1083
+ const baseIndent = layoutLineIndent(text, open);
1084
+ const newline = layoutNewline(text);
1085
+ const argumentIndent = `${baseIndent}${" ".repeat(indent)}`;
1086
+ context.report({
1087
+ node,
1088
+ messageId: "multiline",
1089
+ data: { min: String(minArguments) },
1090
+ fix: (fixer) => gaps.map((gap, index) => {
1091
+ if (index === 0) {
1092
+ return fixer.replaceTextRange(gap, `${newline}${argumentIndent}`);
1093
+ }
1094
+ return fixer.replaceTextRange(gap, index === gaps.length - 1 ? `,${newline}${baseIndent}` : `,${newline}${argumentIndent}`);
1095
+ })
1096
+ });
1097
+ };
1098
+ return {
1099
+ before() {
1100
+ const options2 = optionsFirst(context, {});
1101
+ minArguments = options2.minArguments ?? 3;
1102
+ indent = options2.indent ?? 2;
1103
+ },
1104
+ CallExpression: check,
1105
+ NewExpression: check
1106
+ };
1107
+ }
1108
+ });
1109
+
984
1110
  // src/rules/call-array-multiline.ts
1111
+ import { defineRule as defineRule2 } from "@oxlint/plugins";
985
1112
  function callArrayMultilineCallee(node) {
986
1113
  if (node.type === "Identifier")
987
1114
  return { name: node.name, root: node };
@@ -1048,7 +1175,7 @@ function callArrayMultilineEdits(array, source, text, elementIndent, baseIndent,
1048
1175
  });
1049
1176
  return edits;
1050
1177
  }
1051
- var callArrayMultiline = defineRule({
1178
+ var callArrayMultiline = defineRule2({
1052
1179
  meta: {
1053
1180
  type: "layout",
1054
1181
  fixable: "whitespace",
@@ -1110,7 +1237,7 @@ var callArrayMultiline = defineRule({
1110
1237
  });
1111
1238
 
1112
1239
  // src/rules/chain-newline.ts
1113
- import { defineRule as defineRule2 } from "@oxlint/plugins";
1240
+ import { defineRule as defineRule3 } from "@oxlint/plugins";
1114
1241
  function chainNewlineCollect(node) {
1115
1242
  const links = [];
1116
1243
  let current = node;
@@ -1147,7 +1274,7 @@ function chainNewlineMatches(root, links, group) {
1147
1274
  const rootName = chainNewlineRootIdentifier(root);
1148
1275
  return rootName !== null && optionsPatternsTest(group.rootPatterns, rootName);
1149
1276
  }
1150
- var chainNewline = defineRule2({
1277
+ var chainNewline = defineRule3({
1151
1278
  meta: {
1152
1279
  type: "layout",
1153
1280
  fixable: "whitespace",
@@ -1253,7 +1380,7 @@ var chainNewline = defineRule2({
1253
1380
  });
1254
1381
 
1255
1382
  // src/rules/component-props.ts
1256
- import { defineRule as defineRule3 } from "@oxlint/plugins";
1383
+ import { defineRule as defineRule4 } from "@oxlint/plugins";
1257
1384
  function unwrapExport(statement) {
1258
1385
  return statement.type === "ExportNamedDeclaration" || statement.type === "ExportDefaultDeclaration" ? statement.declaration : statement;
1259
1386
  }
@@ -1303,7 +1430,7 @@ function isPassThrough(type) {
1303
1430
  const argument = type.typeArguments?.params.length === 1 ? type.typeArguments.params[0] : undefined;
1304
1431
  return name === "ComponentProps" && (argument?.type === "TSTypeQuery" || argument?.type === "TSLiteralType" && argument.literal.type === "Literal" && typeof argument.literal.value === "string");
1305
1432
  }
1306
- var componentProps = defineRule3({
1433
+ var componentProps = defineRule4({
1307
1434
  meta: {
1308
1435
  type: "problem",
1309
1436
  schema: [
@@ -1374,8 +1501,8 @@ var componentProps = defineRule3({
1374
1501
  });
1375
1502
 
1376
1503
  // src/rules/declaration-name.ts
1377
- import { defineRule as defineRule4 } from "@oxlint/plugins";
1378
- var declarationName = defineRule4({
1504
+ import { defineRule as defineRule5 } from "@oxlint/plugins";
1505
+ var declarationName = defineRule5({
1379
1506
  meta: {
1380
1507
  type: "problem",
1381
1508
  schema: [
@@ -1452,8 +1579,8 @@ var declarationName = defineRule4({
1452
1579
  });
1453
1580
 
1454
1581
  // src/rules/export-file-prefix.ts
1455
- import { defineRule as defineRule5 } from "@oxlint/plugins";
1456
- var exportFilePrefix = defineRule5({
1582
+ import { defineRule as defineRule6 } from "@oxlint/plugins";
1583
+ var exportFilePrefix = defineRule6({
1457
1584
  meta: {
1458
1585
  type: "problem",
1459
1586
  schema: [
@@ -1518,8 +1645,8 @@ var exportFilePrefix = defineRule5({
1518
1645
  });
1519
1646
 
1520
1647
  // src/rules/export-name-pattern.ts
1521
- import { defineRule as defineRule6 } from "@oxlint/plugins";
1522
- var exportNamePattern = defineRule6({
1648
+ import { defineRule as defineRule7 } from "@oxlint/plugins";
1649
+ var exportNamePattern = defineRule7({
1523
1650
  meta: {
1524
1651
  type: "problem",
1525
1652
  schema: [
@@ -1572,8 +1699,8 @@ var exportNamePattern = defineRule6({
1572
1699
  });
1573
1700
 
1574
1701
  // src/rules/filename-export-name.ts
1575
- import { defineRule as defineRule7 } from "@oxlint/plugins";
1576
- var filenameExportName = defineRule7({
1702
+ import { defineRule as defineRule8 } from "@oxlint/plugins";
1703
+ var filenameExportName = defineRule8({
1577
1704
  meta: {
1578
1705
  type: "problem",
1579
1706
  schema: [
@@ -1638,8 +1765,8 @@ var filenameExportName = defineRule7({
1638
1765
  });
1639
1766
 
1640
1767
  // src/rules/filename-match.ts
1641
- import { defineRule as defineRule8 } from "@oxlint/plugins";
1642
- var filenameMatch = defineRule8({
1768
+ import { defineRule as defineRule9 } from "@oxlint/plugins";
1769
+ var filenameMatch = defineRule9({
1643
1770
  meta: {
1644
1771
  type: "problem",
1645
1772
  schema: [
@@ -1676,8 +1803,8 @@ var filenameMatch = defineRule8({
1676
1803
  });
1677
1804
 
1678
1805
  // src/rules/folder-prefix.ts
1679
- import { defineRule as defineRule9 } from "@oxlint/plugins";
1680
- var folderPrefix = defineRule9({
1806
+ import { defineRule as defineRule10 } from "@oxlint/plugins";
1807
+ var folderPrefix = defineRule10({
1681
1808
  meta: {
1682
1809
  type: "problem",
1683
1810
  schema: [
@@ -1735,7 +1862,7 @@ var folderPrefix = defineRule9({
1735
1862
  });
1736
1863
 
1737
1864
  // src/rules/jsx-attributes-multiline.ts
1738
- import { defineRule as defineRule10 } from "@oxlint/plugins";
1865
+ import { defineRule as defineRule11 } from "@oxlint/plugins";
1739
1866
  function jsxAttributesMultilineEdits(node, text, attributeIndent, baseIndent, newline) {
1740
1867
  const first = node.attributes[0];
1741
1868
  const last = node.attributes.at(-1);
@@ -1766,7 +1893,7 @@ function jsxAttributesMultilineEdits(node, text, attributeIndent, baseIndent, ne
1766
1893
  edits.push({ range: closingRange, text: `${newline}${baseIndent}` });
1767
1894
  return edits;
1768
1895
  }
1769
- var jsxAttributesMultiline = defineRule10({
1896
+ var jsxAttributesMultiline = defineRule11({
1770
1897
  meta: {
1771
1898
  type: "layout",
1772
1899
  fixable: "whitespace",
@@ -1815,8 +1942,8 @@ var jsxAttributesMultiline = defineRule10({
1815
1942
  });
1816
1943
 
1817
1944
  // src/rules/key-value-same-line.ts
1818
- import { defineRule as defineRule11 } from "@oxlint/plugins";
1819
- var keyValueSameLine = defineRule11({
1945
+ import { defineRule as defineRule12 } from "@oxlint/plugins";
1946
+ var keyValueSameLine = defineRule12({
1820
1947
  meta: {
1821
1948
  type: "layout",
1822
1949
  fixable: "whitespace",
@@ -1865,7 +1992,7 @@ var keyValueSameLine = defineRule11({
1865
1992
  });
1866
1993
 
1867
1994
  // src/rules/no-comments.ts
1868
- import { defineRule as defineRule12 } from "@oxlint/plugins";
1995
+ import { defineRule as defineRule13 } from "@oxlint/plugins";
1869
1996
  var NO_COMMENTS_LINE_GAP = /^[\t \r\n\u2028\u2029]*$/;
1870
1997
  var NO_COMMENTS_LINE_TERMINATOR = /\r\n|[\n\r\u2028\u2029]/;
1871
1998
  var NO_COMMENTS_TRAILING_LINES = /^[\t ]*(?:\r\n|[\n\r\u2028\u2029])(?:[\t ]*(?:\r\n|[\n\r\u2028\u2029]))*/;
@@ -1957,7 +2084,7 @@ function noCommentsJsxEmptyContainer(containers, start, end) {
1957
2084
  const container = containers[low - 1];
1958
2085
  return container?.range[1] >= end ? container : undefined;
1959
2086
  }
1960
- var noComments = defineRule12({
2087
+ var noComments = defineRule13({
1961
2088
  meta: {
1962
2089
  type: "suggestion",
1963
2090
  fixable: "code",
@@ -2089,8 +2216,8 @@ var noComments = defineRule12({
2089
2216
  });
2090
2217
 
2091
2218
  // src/rules/no-extra-exports.ts
2092
- import { defineRule as defineRule13 } from "@oxlint/plugins";
2093
- var noExtraExports = defineRule13({
2219
+ import { defineRule as defineRule14 } from "@oxlint/plugins";
2220
+ var noExtraExports = defineRule14({
2094
2221
  meta: {
2095
2222
  type: "problem",
2096
2223
  schema: [
@@ -2149,7 +2276,7 @@ var noExtraExports = defineRule13({
2149
2276
  });
2150
2277
 
2151
2278
  // src/rules/no-extra-factory-keys.ts
2152
- import { defineRule as defineRule14 } from "@oxlint/plugins";
2279
+ import { defineRule as defineRule15 } from "@oxlint/plugins";
2153
2280
  function compileFactoryKeys(pattern, keys, requireKeys) {
2154
2281
  const allowedList = keys.concat(requireKeys.filter((key) => !keys.includes(key)));
2155
2282
  return {
@@ -2159,7 +2286,7 @@ function compileFactoryKeys(pattern, keys, requireKeys) {
2159
2286
  requireKeys
2160
2287
  };
2161
2288
  }
2162
- var noExtraFactoryKeys = defineRule14({
2289
+ var noExtraFactoryKeys = defineRule15({
2163
2290
  meta: {
2164
2291
  type: "problem",
2165
2292
  schema: [
@@ -2263,8 +2390,8 @@ var noExtraFactoryKeys = defineRule14({
2263
2390
  });
2264
2391
 
2265
2392
  // src/rules/no-file-level-helpers.ts
2266
- import { defineRule as defineRule15 } from "@oxlint/plugins";
2267
- var noFileLevelHelpers = defineRule15({
2393
+ import { defineRule as defineRule16 } from "@oxlint/plugins";
2394
+ var noFileLevelHelpers = defineRule16({
2268
2395
  meta: {
2269
2396
  type: "problem",
2270
2397
  schema: [
@@ -2294,8 +2421,10 @@ var noFileLevelHelpers = defineRule15({
2294
2421
  } = optionsFirst(context, {});
2295
2422
  const allowed = optionsOptionalPatterns(allowPattern);
2296
2423
  const hooks = optionsPatterns(hookPattern);
2424
+ const exported = exportsCollect(program);
2425
+ const allowedExport = (name) => exported.some((binding) => binding.localName === name && optionsPatternsTest(allowed, binding.exportedName));
2297
2426
  for (const candidate of declarationsFileLevelFunctionCandidates(program)) {
2298
- if (detectComponents && reactComponentsIsLike(program, candidate) || optionsPatternsTest(hooks, candidate.name) || optionsPatternsTest(allowed, candidate.name)) {
2427
+ if (detectComponents && reactComponentsIsLike(program, candidate) || optionsPatternsTest(hooks, candidate.name) || optionsPatternsTest(allowed, candidate.name) || allowedExport(candidate.name)) {
2299
2428
  continue;
2300
2429
  }
2301
2430
  context.report({
@@ -2310,7 +2439,7 @@ var noFileLevelHelpers = defineRule15({
2310
2439
  });
2311
2440
 
2312
2441
  // src/rules/no-imported-type-alias.ts
2313
- import { defineRule as defineRule16 } from "@oxlint/plugins";
2442
+ import { defineRule as defineRule17 } from "@oxlint/plugins";
2314
2443
  function importedAliasTarget(declaration, imports) {
2315
2444
  if (declaration?.type !== "TSTypeAliasDeclaration" || declaration.typeAnnotation.type !== "TSTypeReference" || declaration.typeAnnotation.typeName.type !== "Identifier" || Boolean(declaration.typeAnnotation.typeArguments?.params.length) || !imports.has(declaration.typeAnnotation.typeName.name)) {
2316
2445
  return;
@@ -2320,7 +2449,7 @@ function importedAliasTarget(declaration, imports) {
2320
2449
  function specifierLocalName(specifier) {
2321
2450
  return specifier.local.type === "Identifier" ? specifier.local.name : specifier.local.value;
2322
2451
  }
2323
- var noImportedTypeAlias = defineRule16({
2452
+ var noImportedTypeAlias = defineRule17({
2324
2453
  meta: {
2325
2454
  type: "problem",
2326
2455
  schema: [],
@@ -2394,8 +2523,8 @@ var noImportedTypeAlias = defineRule16({
2394
2523
  });
2395
2524
 
2396
2525
  // src/rules/no-inline-schema-elements.ts
2397
- import { defineRule as defineRule17 } from "@oxlint/plugins";
2398
- var noInlineSchemaElements = defineRule17({
2526
+ import { defineRule as defineRule18 } from "@oxlint/plugins";
2527
+ var noInlineSchemaElements = defineRule18({
2399
2528
  meta: {
2400
2529
  type: "problem",
2401
2530
  schema: [
@@ -2456,7 +2585,7 @@ var noInlineSchemaElements = defineRule17({
2456
2585
  });
2457
2586
 
2458
2587
  // src/rules/no-inline-types.ts
2459
- import { defineRule as defineRule18 } from "@oxlint/plugins";
2588
+ import { defineRule as defineRule19 } from "@oxlint/plugins";
2460
2589
  function parameterAnnotation(parameter) {
2461
2590
  if (parameter.type === "TSParameterProperty") {
2462
2591
  return parameterAnnotation(parameter.parameter);
@@ -2466,7 +2595,7 @@ function parameterAnnotation(parameter) {
2466
2595
  }
2467
2596
  return parameter.typeAnnotation;
2468
2597
  }
2469
- var noInlineTypes = defineRule18({
2598
+ var noInlineTypes = defineRule19({
2470
2599
  meta: {
2471
2600
  type: "problem",
2472
2601
  schema: [
@@ -2536,7 +2665,7 @@ var noInlineTypes = defineRule18({
2536
2665
  });
2537
2666
 
2538
2667
  // src/rules/no-literal-in.ts
2539
- import { defineRule as defineRule19 } from "@oxlint/plugins";
2668
+ import { defineRule as defineRule20 } from "@oxlint/plugins";
2540
2669
  function literalKey(node) {
2541
2670
  if (node.type === "Literal" && typeof node.value === "string") {
2542
2671
  return node.value;
@@ -2545,7 +2674,7 @@ function literalKey(node) {
2545
2674
  return node.quasis[0]?.value.cooked ?? node.quasis[0]?.value.raw;
2546
2675
  }
2547
2676
  }
2548
- var noLiteralIn = defineRule19({
2677
+ var noLiteralIn = defineRule20({
2549
2678
  meta: {
2550
2679
  type: "suggestion",
2551
2680
  schema: [
@@ -2586,13 +2715,13 @@ var noLiteralIn = defineRule19({
2586
2715
  });
2587
2716
 
2588
2717
  // src/rules/no-local-schema-construction.ts
2589
- import { defineRule as defineRule20 } from "@oxlint/plugins";
2718
+ import { defineRule as defineRule21 } from "@oxlint/plugins";
2590
2719
  var defaultRuntimeImportMessage = "Do not import runtime schema constructors from {{source}}; import a named schema instead.";
2591
2720
  var defaultConstructionMessage = "Do not construct schemas locally; import a named schema instead.";
2592
2721
  function formatMessage(template, data) {
2593
2722
  return Object.entries(data).reduce((result, [key, value]) => result.replaceAll(`{{${key}}}`, value), template);
2594
2723
  }
2595
- var noLocalSchemaConstruction = defineRule20({
2724
+ var noLocalSchemaConstruction = defineRule21({
2596
2725
  meta: {
2597
2726
  type: "problem",
2598
2727
  schema: [
@@ -2714,8 +2843,8 @@ var noLocalSchemaConstruction = defineRule20({
2714
2843
  });
2715
2844
 
2716
2845
  // src/rules/no-member-comments.ts
2717
- import { defineRule as defineRule21 } from "@oxlint/plugins";
2718
- var noMemberComments = defineRule21({
2846
+ import { defineRule as defineRule22 } from "@oxlint/plugins";
2847
+ var noMemberComments = defineRule22({
2719
2848
  meta: {
2720
2849
  type: "suggestion",
2721
2850
  fixable: "code",
@@ -2811,7 +2940,7 @@ var noMemberComments = defineRule21({
2811
2940
  });
2812
2941
 
2813
2942
  // src/rules/no-module-mutable-state.ts
2814
- import { defineRule as defineRule22 } from "@oxlint/plugins";
2943
+ import { defineRule as defineRule23 } from "@oxlint/plugins";
2815
2944
  function moduleMutableStateBindings(pattern) {
2816
2945
  if (pattern.type === "Identifier") {
2817
2946
  return [{ name: pattern.name, node: pattern }];
@@ -2850,7 +2979,7 @@ function moduleMutableStateInsideAmbient(node) {
2850
2979
  }
2851
2980
  return false;
2852
2981
  }
2853
- var noModuleMutableState = defineRule22({
2982
+ var noModuleMutableState = defineRule23({
2854
2983
  meta: {
2855
2984
  type: "problem",
2856
2985
  schema: [
@@ -2902,7 +3031,7 @@ var noModuleMutableState = defineRule22({
2902
3031
  });
2903
3032
 
2904
3033
  // src/rules/no-promise-all-mutation.ts
2905
- import { defineRule as defineRule23 } from "@oxlint/plugins";
3034
+ import { defineRule as defineRule24 } from "@oxlint/plugins";
2906
3035
  function mutationBinding(node) {
2907
3036
  if (node.type === "Identifier") {
2908
3037
  return node;
@@ -2930,7 +3059,7 @@ function mutationBindings(node) {
2930
3059
  }
2931
3060
  }
2932
3061
  }
2933
- var noPromiseAllMutation = defineRule23({
3062
+ var noPromiseAllMutation = defineRule24({
2934
3063
  meta: {
2935
3064
  type: "problem",
2936
3065
  schema: [
@@ -3030,8 +3159,8 @@ var noPromiseAllMutation = defineRule23({
3030
3159
  });
3031
3160
 
3032
3161
  // src/rules/no-rederive-schema.ts
3033
- import { defineRule as defineRule24 } from "@oxlint/plugins";
3034
- var noRederiveSchema = defineRule24({
3162
+ import { defineRule as defineRule25 } from "@oxlint/plugins";
3163
+ var noRederiveSchema = defineRule25({
3035
3164
  meta: {
3036
3165
  type: "problem",
3037
3166
  schema: [
@@ -3075,7 +3204,7 @@ var noRederiveSchema = defineRule24({
3075
3204
  });
3076
3205
 
3077
3206
  // src/rules/no-restricted-constructor.ts
3078
- import { defineRule as defineRule25 } from "@oxlint/plugins";
3207
+ import { defineRule as defineRule26 } from "@oxlint/plugins";
3079
3208
  function restrictedConstructorEntries(constructors) {
3080
3209
  const entries = new Map;
3081
3210
  for (const item of constructors) {
@@ -3091,7 +3220,7 @@ function restrictedConstructorEntries(constructors) {
3091
3220
  }
3092
3221
  return entries;
3093
3222
  }
3094
- var noRestrictedConstructor = defineRule25({
3223
+ var noRestrictedConstructor = defineRule26({
3095
3224
  meta: {
3096
3225
  type: "problem",
3097
3226
  schema: [
@@ -3166,8 +3295,8 @@ var noRestrictedConstructor = defineRule25({
3166
3295
  });
3167
3296
 
3168
3297
  // src/rules/no-restricted-files.ts
3169
- import { defineRule as defineRule26 } from "@oxlint/plugins";
3170
- var noRestrictedFiles = defineRule26({
3298
+ import { defineRule as defineRule27 } from "@oxlint/plugins";
3299
+ var noRestrictedFiles = defineRule27({
3171
3300
  meta: {
3172
3301
  type: "problem",
3173
3302
  schema: [
@@ -3199,7 +3328,7 @@ var noRestrictedFiles = defineRule26({
3199
3328
  });
3200
3329
 
3201
3330
  // src/rules/no-restricted-token.ts
3202
- import { defineRule as defineRule27 } from "@oxlint/plugins";
3331
+ import { defineRule as defineRule28 } from "@oxlint/plugins";
3203
3332
  function tokenIsTypeOnlyImport(node) {
3204
3333
  const parent = node.parent;
3205
3334
  if (parent?.type === "ImportSpecifier") {
@@ -3210,7 +3339,7 @@ function tokenIsTypeOnlyImport(node) {
3210
3339
  function memberMatches(node, restriction) {
3211
3340
  return restriction.startsWith("*.") ? astStaticMemberName(node) === restriction.slice(2) : astDottedName(node) === restriction;
3212
3341
  }
3213
- var noRestrictedToken = defineRule27({
3342
+ var noRestrictedToken = defineRule28({
3214
3343
  meta: {
3215
3344
  type: "problem",
3216
3345
  schema: [
@@ -3307,7 +3436,7 @@ var noRestrictedToken = defineRule27({
3307
3436
  });
3308
3437
 
3309
3438
  // src/rules/no-runtime-in-types.ts
3310
- import { defineRule as defineRule28 } from "@oxlint/plugins";
3439
+ import { defineRule as defineRule29 } from "@oxlint/plugins";
3311
3440
  function isTypeOnlyImport(statement) {
3312
3441
  return statement.importKind === "type" || statement.specifiers.length > 0 && statement.specifiers.every((specifier) => specifier.type === "ImportSpecifier" && specifier.importKind === "type");
3313
3442
  }
@@ -3524,7 +3653,7 @@ function isRuntimeReExport(statement, runtimeImportLocals, valueNames, isAmbient
3524
3653
  }
3525
3654
  return statement.specifiers.some((specifier) => specifier.exportKind !== "type" && runtimeImportLocals.has(exportLocalName(specifier)));
3526
3655
  }
3527
- var noRuntimeInTypes = defineRule28({
3656
+ var noRuntimeInTypes = defineRule29({
3528
3657
  meta: {
3529
3658
  type: "problem",
3530
3659
  schema: [
@@ -3668,7 +3797,7 @@ var noRuntimeInTypes = defineRule28({
3668
3797
  });
3669
3798
 
3670
3799
  // src/rules/no-single-use-scalar-schema.ts
3671
- import { defineRule as defineRule29 } from "@oxlint/plugins";
3800
+ import { defineRule as defineRule30 } from "@oxlint/plugins";
3672
3801
  function isScalarSchema(node, namespaces, structuralMethods) {
3673
3802
  if (node.type !== "CallExpression" || node.callee.type !== "MemberExpression") {
3674
3803
  return false;
@@ -3702,7 +3831,7 @@ function isAllowedStructuralElement(identifier, initializer, ancestors, options2
3702
3831
  const method = call.callee.type === "MemberExpression" ? astStaticMemberName(call.callee) : undefined;
3703
3832
  return Boolean(method && options2.methods.includes(method) && schemasElements(call).includes(identifier));
3704
3833
  }
3705
- var noSingleUseScalarSchema = defineRule29({
3834
+ var noSingleUseScalarSchema = defineRule30({
3706
3835
  meta: {
3707
3836
  type: "suggestion",
3708
3837
  schema: [
@@ -3787,8 +3916,8 @@ var noSingleUseScalarSchema = defineRule29({
3787
3916
  });
3788
3917
 
3789
3918
  // src/rules/no-top-level-functions.ts
3790
- import { defineRule as defineRule30 } from "@oxlint/plugins";
3791
- var noTopLevelFunctions = defineRule30({
3919
+ import { defineRule as defineRule31 } from "@oxlint/plugins";
3920
+ var noTopLevelFunctions = defineRule31({
3792
3921
  meta: {
3793
3922
  type: "problem",
3794
3923
  schema: [
@@ -3847,7 +3976,7 @@ var noTopLevelFunctions = defineRule30({
3847
3976
  });
3848
3977
 
3849
3978
  // src/rules/no-trivial-functions.ts
3850
- import { defineRule as defineRule31 } from "@oxlint/plugins";
3979
+ import { defineRule as defineRule32 } from "@oxlint/plugins";
3851
3980
 
3852
3981
  // src/constants/trivial.constants.ts
3853
3982
  var trivialBannedNames = [
@@ -3863,7 +3992,7 @@ var trivialBannedNames = [
3863
3992
  ];
3864
3993
 
3865
3994
  // src/rules/no-trivial-functions.ts
3866
- var noTrivialFunctions = defineRule31({
3995
+ var noTrivialFunctions = defineRule32({
3867
3996
  meta: {
3868
3997
  type: "problem",
3869
3998
  schema: [
@@ -3980,8 +4109,8 @@ var noTrivialFunctions = defineRule31({
3980
4109
  });
3981
4110
 
3982
4111
  // src/rules/no-type-declarations.ts
3983
- import { defineRule as defineRule32 } from "@oxlint/plugins";
3984
- var noTypeDeclarations = defineRule32({
4112
+ import { defineRule as defineRule33 } from "@oxlint/plugins";
4113
+ var noTypeDeclarations = defineRule33({
3985
4114
  meta: {
3986
4115
  type: "problem",
3987
4116
  schema: [
@@ -4026,8 +4155,8 @@ var noTypeDeclarations = defineRule32({
4026
4155
  });
4027
4156
 
4028
4157
  // src/rules/no-unescaped-like.ts
4029
- import { defineRule as defineRule33 } from "@oxlint/plugins";
4030
- var noUnescapedLike = defineRule33({
4158
+ import { defineRule as defineRule34 } from "@oxlint/plugins";
4159
+ var noUnescapedLike = defineRule34({
4031
4160
  meta: {
4032
4161
  type: "problem",
4033
4162
  schema: [
@@ -4078,7 +4207,7 @@ var noUnescapedLike = defineRule33({
4078
4207
  });
4079
4208
 
4080
4209
  // src/rules/object-multiline.ts
4081
- import { defineRule as defineRule34 } from "@oxlint/plugins";
4210
+ import { defineRule as defineRule35 } from "@oxlint/plugins";
4082
4211
  function objectMultilineIsCallArg(node) {
4083
4212
  const parent = node.parent;
4084
4213
  return (parent.type === "CallExpression" || parent.type === "NewExpression") && parent.arguments.includes(node);
@@ -4111,14 +4240,14 @@ function objectMultilineGaps(text, node) {
4111
4240
  if (!objectMultilineIsWhitespace(between.slice(0, comma)) || !objectMultilineIsWhitespace(between.slice(comma + 1))) {
4112
4241
  return null;
4113
4242
  }
4114
- gaps.push([after + comma + 1, limit]);
4243
+ gaps.push([next ? after + comma + 1 : after, limit]);
4115
4244
  }
4116
4245
  return gaps;
4117
4246
  }
4118
- var objectMultiline = defineRule34({
4247
+ var objectMultiline = defineRule35({
4119
4248
  meta: {
4120
4249
  type: "layout",
4121
- fixable: "whitespace",
4250
+ fixable: "code",
4122
4251
  schema: [
4123
4252
  {
4124
4253
  type: "object",
@@ -4168,7 +4297,7 @@ var objectMultiline = defineRule34({
4168
4297
  if (!gaps) {
4169
4298
  return null;
4170
4299
  }
4171
- return gaps.map((gap, index) => fixer.replaceTextRange(gap, `${newline}${index === gaps.length - 1 ? baseIndent : propIndent}`));
4300
+ return gaps.map((gap, index) => fixer.replaceTextRange(gap, index === gaps.length - 1 ? `,${newline}${baseIndent}` : `${newline}${propIndent}`));
4172
4301
  }
4173
4302
  });
4174
4303
  }
@@ -4177,8 +4306,8 @@ var objectMultiline = defineRule34({
4177
4306
  });
4178
4307
 
4179
4308
  // src/rules/only-export-components.ts
4180
- import { defineRule as defineRule35 } from "@oxlint/plugins";
4181
- var onlyExportComponents = defineRule35({
4309
+ import { defineRule as defineRule36 } from "@oxlint/plugins";
4310
+ var onlyExportComponents = defineRule36({
4182
4311
  meta: {
4183
4312
  type: "problem",
4184
4313
  schema: [
@@ -4187,6 +4316,7 @@ var onlyExportComponents = defineRule35({
4187
4316
  additionalProperties: false,
4188
4317
  properties: {
4189
4318
  matchFileName: { type: "boolean" },
4319
+ trailingRoles: { type: "array", items: { type: "string" } },
4190
4320
  allowTypeExports: { type: "boolean" },
4191
4321
  denyTypePattern: optionsPatternSchema
4192
4322
  }
@@ -4204,10 +4334,15 @@ var onlyExportComponents = defineRule35({
4204
4334
  Program(program) {
4205
4335
  const {
4206
4336
  matchFileName = true,
4337
+ trailingRoles = [],
4207
4338
  allowTypeExports = true,
4208
4339
  denyTypePattern
4209
4340
  } = optionsFirst(context, {});
4210
- const expected = reactComponentsPascalFromBasename(namingFileBasename(context.filename));
4341
+ const basename = namingFileBasename(context.filename);
4342
+ const extension = basename.slice(basename.lastIndexOf("."));
4343
+ const role = trailingRoles.find((candidate) => basename.endsWith(`.${candidate}${extension}`));
4344
+ const expected = reactComponentsPascalFromBasename(role ? basename.replace(`.${role}${extension}`, extension) : basename);
4345
+ const expectedKeys = [expected, ...role ? [reactComponentsPascalFromBasename(basename)] : []].map((name) => name.toLowerCase());
4211
4346
  const denied = optionsOptionalPatterns(denyTypePattern);
4212
4347
  const components = [];
4213
4348
  for (const candidate of reactComponentsExportCandidates(program)) {
@@ -4240,10 +4375,9 @@ var onlyExportComponents = defineRule35({
4240
4375
  if (components.length === 0 || !matchFileName) {
4241
4376
  return;
4242
4377
  }
4243
- const expectedKey = expected.toLowerCase();
4244
- const exact = components.some((candidate) => candidate.name.toLowerCase() === expectedKey);
4245
- const allPrefixed = components.every((candidate) => candidate.name.toLowerCase().startsWith(expectedKey));
4246
- if (!exact && !allPrefixed) {
4378
+ const names = components.map((candidate) => candidate.name.toLowerCase());
4379
+ const matches = expectedKeys.some((expectedKey) => names.includes(expectedKey) || names.every((name) => name.startsWith(expectedKey)));
4380
+ if (!matches) {
4247
4381
  for (const candidate of components) {
4248
4382
  context.report({
4249
4383
  node: candidate.node,
@@ -4258,7 +4392,7 @@ var onlyExportComponents = defineRule35({
4258
4392
  });
4259
4393
 
4260
4394
  // src/rules/only-export-constants.ts
4261
- import { defineRule as defineRule36 } from "@oxlint/plugins";
4395
+ import { defineRule as defineRule37 } from "@oxlint/plugins";
4262
4396
  function bindingNames(pattern) {
4263
4397
  switch (pattern.type) {
4264
4398
  case "Identifier":
@@ -4313,7 +4447,7 @@ function collectBindings(program) {
4313
4447
  }
4314
4448
  return bindings;
4315
4449
  }
4316
- var onlyExportConstants = defineRule36({
4450
+ var onlyExportConstants = defineRule37({
4317
4451
  meta: {
4318
4452
  type: "problem",
4319
4453
  schema: [
@@ -4401,7 +4535,7 @@ var onlyExportConstants = defineRule36({
4401
4535
  });
4402
4536
 
4403
4537
  // src/rules/padding-between-statements.ts
4404
- import { defineRule as defineRule37 } from "@oxlint/plugins";
4538
+ import { defineRule as defineRule38 } from "@oxlint/plugins";
4405
4539
  function paddingKind(node) {
4406
4540
  if (node.type === "ExportNamedDeclaration" || node.type === "ExportDefaultDeclaration") {
4407
4541
  return node.declaration ? paddingKind(node.declaration) : "other";
@@ -4453,7 +4587,7 @@ function paddingBlankLineFix(sourceText, comments2, prev, curr, newline) {
4453
4587
  }
4454
4588
  return { newlineEnd, newline };
4455
4589
  }
4456
- var paddingBetweenStatements = defineRule37({
4590
+ var paddingBetweenStatements = defineRule38({
4457
4591
  meta: {
4458
4592
  type: "layout",
4459
4593
  fixable: "whitespace",
@@ -4527,7 +4661,7 @@ var paddingBetweenStatements = defineRule37({
4527
4661
  });
4528
4662
 
4529
4663
  // src/rules/prefer-namespace-type-import.ts
4530
- import { defineRule as defineRule38 } from "@oxlint/plugins";
4664
+ import { defineRule as defineRule39 } from "@oxlint/plugins";
4531
4665
  var bindingName = /^[A-Za-z_$][\w$]*$/;
4532
4666
  var reservedNames = new Set("await break case catch class const continue debugger default delete do else enum export extends false finally for function if import in instanceof new null return super switch this throw true try typeof var void while with yield implements interface let package private protected public static arguments eval".split(" "));
4533
4667
  function namespaceName(source, names) {
@@ -4551,7 +4685,7 @@ function safeReference(node) {
4551
4685
  }
4552
4686
  return parent?.type === "TSTypeReference" && parent.typeName === current || parent?.type === "TSTypeQuery" && parent.exprName === current || (parent?.type === "TSInterfaceHeritage" || parent?.type === "TSClassImplements") && parent.expression === current;
4553
4687
  }
4554
- var preferNamespaceTypeImport = defineRule38({
4688
+ var preferNamespaceTypeImport = defineRule39({
4555
4689
  meta: {
4556
4690
  type: "suggestion",
4557
4691
  fixable: "code",
@@ -4668,8 +4802,8 @@ var preferNamespaceTypeImport = defineRule38({
4668
4802
  });
4669
4803
 
4670
4804
  // src/rules/require-file-factory.ts
4671
- import { defineRule as defineRule39 } from "@oxlint/plugins";
4672
- var requireFileFactory = defineRule39({
4805
+ import { defineRule as defineRule40 } from "@oxlint/plugins";
4806
+ var requireFileFactory = defineRule40({
4673
4807
  meta: {
4674
4808
  type: "problem",
4675
4809
  schema: [
@@ -4717,8 +4851,8 @@ var requireFileFactory = defineRule39({
4717
4851
  });
4718
4852
 
4719
4853
  // src/rules/require-object-params.ts
4720
- import { defineRule as defineRule40 } from "@oxlint/plugins";
4721
- var requireObjectParams = defineRule40({
4854
+ import { defineRule as defineRule41 } from "@oxlint/plugins";
4855
+ var requireObjectParams = defineRule41({
4722
4856
  meta: {
4723
4857
  type: "problem",
4724
4858
  schema: [
@@ -4776,8 +4910,8 @@ var requireObjectParams = defineRule40({
4776
4910
  });
4777
4911
 
4778
4912
  // src/rules/require-orpc-output.ts
4779
- import { defineRule as defineRule41 } from "@oxlint/plugins";
4780
- var requireOrpcOutput = defineRule41({
4913
+ import { defineRule as defineRule42 } from "@oxlint/plugins";
4914
+ var requireOrpcOutput = defineRule42({
4781
4915
  meta: {
4782
4916
  type: "problem",
4783
4917
  schema: [
@@ -4825,8 +4959,8 @@ var requireOrpcOutput = defineRule41({
4825
4959
  });
4826
4960
 
4827
4961
  // src/rules/require-paired-call.ts
4828
- import { defineRule as defineRule42 } from "@oxlint/plugins";
4829
- var requirePairedCall = defineRule42({
4962
+ import { defineRule as defineRule43 } from "@oxlint/plugins";
4963
+ var requirePairedCall = defineRule43({
4830
4964
  meta: {
4831
4965
  type: "problem",
4832
4966
  schema: [
@@ -4900,8 +5034,8 @@ var requirePairedCall = defineRule42({
4900
5034
  });
4901
5035
 
4902
5036
  // src/rules/route-surface.ts
4903
- import { defineRule as defineRule43 } from "@oxlint/plugins";
4904
- var routeSurface = defineRule43({
5037
+ import { defineRule as defineRule44 } from "@oxlint/plugins";
5038
+ var routeSurface = defineRule44({
4905
5039
  meta: {
4906
5040
  type: "problem",
4907
5041
  schema: [
@@ -4910,13 +5044,21 @@ var routeSurface = defineRule43({
4910
5044
  additionalProperties: false,
4911
5045
  properties: {
4912
5046
  exportName: { type: "string" },
5047
+ allowedExports: { type: "array", items: { type: "string" } },
5048
+ inspectExports: { type: "boolean" },
4913
5049
  bannedHooks: { type: "array", items: { type: "string" } },
4914
5050
  banIntrinsicJsx: { type: "boolean" }
4915
5051
  }
4916
5052
  }
4917
5053
  ],
4918
5054
  defaultOptions: [
4919
- { exportName: "Route", bannedHooks: ["useState", "useEffect", "useMutation"], banIntrinsicJsx: true }
5055
+ {
5056
+ exportName: "Route",
5057
+ allowedExports: [],
5058
+ inspectExports: false,
5059
+ bannedHooks: ["useState", "useEffect", "useMutation"],
5060
+ banIntrinsicJsx: true
5061
+ }
4920
5062
  ],
4921
5063
  messages: {
4922
5064
  extraExport: "Route files may only export '{{expected}}'; found '{{actual}}'.",
@@ -4927,27 +5069,135 @@ var routeSurface = defineRule43({
4927
5069
  createOnce(context) {
4928
5070
  return {
4929
5071
  Program(program) {
4930
- const { exportName, bannedHooks, banIntrinsicJsx } = optionsFirst(context);
4931
- for (const binding of exportsCollect(program)) {
4932
- if (binding.exportedName !== exportName) {
5072
+ const { exportName, allowedExports = [], inspectExports = false, bannedHooks, banIntrinsicJsx } = optionsFirst(context);
5073
+ const allowed = new Set([exportName, ...allowedExports]);
5074
+ const bindings = exportsCollect(program);
5075
+ for (const binding of bindings) {
5076
+ if (!allowed.has(binding.exportedName)) {
4933
5077
  context.report({
4934
5078
  node: binding.node,
4935
5079
  messageId: "extraExport",
4936
- data: { expected: exportName, actual: binding.exportedName }
5080
+ data: { expected: [...allowed].join("', '"), actual: binding.exportedName }
4937
5081
  });
4938
5082
  }
4939
5083
  }
4940
5084
  const banned = new Set(bannedHooks);
5085
+ const inspected = new Set;
4941
5086
  for (const item of declarationsTopLevelUnexportedFunctions(program)) {
5087
+ inspected.add(item.node.start);
4942
5088
  routesInspectFunction(context, item, banned, banIntrinsicJsx);
4943
5089
  }
5090
+ if (!inspectExports)
5091
+ return;
5092
+ const names = new Set(bindings.filter((binding) => binding.exportedName === exportName).map((binding) => binding.localName ?? binding.exportedName));
5093
+ const defaultExport = program.body.find((statement) => statement.type === "ExportDefaultDeclaration");
5094
+ const declaration = defaultExport?.declaration;
5095
+ const defaultFunctions = declaration?.type === "ArrowFunctionExpression" || declaration?.type === "FunctionExpression" ? [{ name: "default", node: declaration }] : [];
5096
+ for (const item of [...exportsCollectFunctions(program), ...defaultFunctions]) {
5097
+ if (names.has(item.name) && !inspected.has(item.node.start))
5098
+ routesInspectFunction(context, item, banned, banIntrinsicJsx);
5099
+ }
5100
+ }
5101
+ };
5102
+ }
5103
+ });
5104
+
5105
+ // src/rules/ternary-layout.ts
5106
+ import { defineRule as defineRule45 } from "@oxlint/plugins";
5107
+ function ternaryLayoutLineStart(text, offset) {
5108
+ return text.lastIndexOf(`
5109
+ `, offset - 1) + 1;
5110
+ }
5111
+ function ternaryLayoutLineEnd(text, offset) {
5112
+ const end = text.indexOf(`
5113
+ `, offset);
5114
+ if (end === -1) {
5115
+ return text.length;
5116
+ }
5117
+ return text[end - 1] === "\r" ? end - 1 : end;
5118
+ }
5119
+ function ternaryLayoutBreak(between, operator, newline) {
5120
+ const at = between.indexOf(operator);
5121
+ return `${between.slice(0, at).trimEnd()}${newline}${operator} ${between.slice(at + 1).trimStart()}`;
5122
+ }
5123
+ var ternaryLayout = defineRule45({
5124
+ meta: {
5125
+ type: "layout",
5126
+ fixable: "whitespace",
5127
+ schema: [
5128
+ {
5129
+ type: "object",
5130
+ additionalProperties: false,
5131
+ properties: {
5132
+ maxLength: {
5133
+ type: "integer",
5134
+ minimum: 1,
5135
+ default: 160
5136
+ },
5137
+ indent: {
5138
+ type: "integer",
5139
+ minimum: 1,
5140
+ default: 2
5141
+ }
5142
+ }
5143
+ }
5144
+ ],
5145
+ messages: {
5146
+ join: "Keep this conditional on one line ({{length}} columns; limit {{max}}, except in template literals).",
5147
+ split: "This conditional does not fit on one line ({{length}} of {{max}} columns); break before `?` and `:`."
5148
+ }
5149
+ },
5150
+ createOnce(context) {
5151
+ let maxLength = 160;
5152
+ let indent = 2;
5153
+ return {
5154
+ before() {
5155
+ const options2 = optionsFirst(context, {});
5156
+ maxLength = options2.maxLength ?? 160;
5157
+ indent = options2.indent ?? 2;
5158
+ },
5159
+ ConditionalExpression(node) {
5160
+ const source = context.sourceCode;
5161
+ const text = source.text;
5162
+ const operands = [node.test, node.consequent, node.alternate];
5163
+ if (node.parent.type === "ConditionalExpression" || operands.some((operand) => operand.type === "ConditionalExpression" || operand.loc.start.line !== operand.loc.end.line) || source.getCommentsInside(node).length > 0) {
5164
+ return;
5165
+ }
5166
+ const prefix = text.slice(ternaryLayoutLineStart(text, node.range[0]), node.range[0]);
5167
+ const suffix = text.slice(node.range[1], ternaryLayoutLineEnd(text, node.range[1]));
5168
+ const joined = text.slice(node.range[0], node.range[1]).replace(/\s*\n\s*/g, " ");
5169
+ const length = prefix.length + joined.length + suffix.length;
5170
+ const onOneLine = node.loc.start.line === node.loc.end.line;
5171
+ const interpolated = node.parent.type === "TemplateLiteral";
5172
+ if (!onOneLine && (interpolated || length <= maxLength)) {
5173
+ context.report({
5174
+ node,
5175
+ messageId: "join",
5176
+ data: { length: String(length), max: String(maxLength) },
5177
+ fix: (fixer) => fixer.replaceTextRange(node.range, joined)
5178
+ });
5179
+ }
5180
+ if (onOneLine && !interpolated && length > maxLength) {
5181
+ const newline = `${layoutNewline(text)}${layoutLineIndent(text, node.range[0])}${" ".repeat(indent)}`;
5182
+ const question = [node.test.range[1], node.consequent.range[0]];
5183
+ const colon = [node.consequent.range[1], node.alternate.range[0]];
5184
+ context.report({
5185
+ node,
5186
+ messageId: "split",
5187
+ data: { length: String(length), max: String(maxLength) },
5188
+ fix: (fixer) => [
5189
+ fixer.replaceTextRange(question, ternaryLayoutBreak(text.slice(...question), "?", newline)),
5190
+ fixer.replaceTextRange(colon, ternaryLayoutBreak(text.slice(...colon), ":", newline))
5191
+ ]
5192
+ });
5193
+ }
4944
5194
  }
4945
5195
  };
4946
5196
  }
4947
5197
  });
4948
5198
 
4949
5199
  // src/rules/test-title-pattern.ts
4950
- import { defineRule as defineRule44 } from "@oxlint/plugins";
5200
+ import { defineRule as defineRule46 } from "@oxlint/plugins";
4951
5201
  var TEST_MODIFIERS = new Set(["only", "skip", "concurrent", "sequential", "todo", "each", "for"]);
4952
5202
  function isConfiguredName(name, callees) {
4953
5203
  if (!name) {
@@ -4987,7 +5237,7 @@ function regexMatches(regex, value) {
4987
5237
  function titlePatterns(pattern, flags) {
4988
5238
  return pattern === undefined ? [] : [pattern].flat().map((source) => ({ regex: new RegExp(source, flags), pattern: source }));
4989
5239
  }
4990
- var testTitlePattern = defineRule44({
5240
+ var testTitlePattern = defineRule46({
4991
5241
  meta: {
4992
5242
  type: "suggestion",
4993
5243
  schema: [
@@ -5066,6 +5316,7 @@ var testTitlePattern = defineRule44({
5066
5316
  var src_default = eslintCompatPlugin({
5067
5317
  meta: { name: "arch" },
5068
5318
  rules: {
5319
+ "call-arguments-multiline": callArgumentsMultiline,
5069
5320
  "call-array-multiline": callArrayMultiline,
5070
5321
  "chain-newline": chainNewline,
5071
5322
  "component-props": componentProps,
@@ -5109,6 +5360,7 @@ var src_default = eslintCompatPlugin({
5109
5360
  "require-orpc-output": requireOrpcOutput,
5110
5361
  "require-paired-call": requirePairedCall,
5111
5362
  "route-surface": routeSurface,
5363
+ "ternary-layout": ternaryLayout,
5112
5364
  "test-title-pattern": testTitlePattern
5113
5365
  }
5114
5366
  });