oxlint-plugin-arch 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.3
4
+
5
+ - Add `declaration-name` so selected declarations can follow a file prefix or pattern per glob.
6
+ - Add `export-file-prefix` `singularize` so plural filenames accept singular prefixes.
7
+ - Add `no-type-declarations` to keep type aliases and interfaces out of matched files.
8
+
3
9
  ## 0.2.2
4
10
 
5
11
  - Publish compiled `dist/index.js` so Oxlint can load the package from `node_modules`.
package/README.md CHANGED
@@ -41,13 +41,14 @@ Then point `jsPlugins[].specifier` at the copied entry file instead of the packa
41
41
  ## Configuration examples
42
42
 
43
43
  - [`examples/minimal.oxlint.config.ts`](examples/minimal.oxlint.config.ts) — three small rules showing plugin registration, glob ownership, and options.
44
- - [`examples/full.oxlint.config.ts`](examples/full.oxlint.config.ts) — all 25 rules across representative component, action, service, route, API, schema, and database scopes.
44
+ - [`examples/full.oxlint.config.ts`](examples/full.oxlint.config.ts) — all 27 rules across representative component, action, service, route, API, schema, and database scopes.
45
45
 
46
46
  Copy the shapes that match your repository; do not copy globs or naming policy blindly.
47
47
 
48
48
  ## Rules
49
49
 
50
- - `export-file-prefix` — require export names, or every function and type, to start with a filename-derived prefix.
50
+ - `declaration-name` — require selected declarations to match a filename-derived prefix or a consumer pattern.
51
+ - `export-file-prefix` — require export names, or every function and type, to start with a filename-derived prefix, optionally singularized.
51
52
  - `export-name-pattern` — require export names, or every function and type, to match a configured regular expression.
52
53
  - `filename-export-name` — derive expected function names from filename templates, optionally including locals.
53
54
  - `filename-match` — require filenames to match a configured pattern.
@@ -65,6 +66,7 @@ Copy the shapes that match your repository; do not copy globs or naming policy b
65
66
  - `no-single-use-scalar-schema` — reject local scalar Zod aliases used once where they can be safely inlined.
66
67
  - `no-top-level-functions` — reject top-level functions and optional re-exports.
67
68
  - `no-trivial-functions` — reject empty or passthrough top-level functions.
69
+ - `no-type-declarations` — reject type aliases and interfaces in matched files.
68
70
  - `no-unescaped-like` — require configured sanitizers for configured query methods.
69
71
  - `only-export-components` — allow only React component and type exports.
70
72
  - `require-file-factory` — derive and require a filename-based factory function.
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/export-file-prefix.ts
4
+ // src/rules/declaration-name.ts
5
5
  import { defineRule } from "@oxlint/plugins";
6
6
 
7
7
  // src/utils/helpers/ast.ts
@@ -194,16 +194,42 @@ function declarationsIsTrivialFunction(node) {
194
194
  }
195
195
  return statement.type === "ExpressionStatement" && declarationsIsTrivialExpression(statement.expression);
196
196
  }
197
- function declarationsCollectNamed(root) {
197
+ var declarationsKinds = ["function", "const", "let", "var", "class", "type", "interface", "enum"];
198
+ function declarationsNamedKind(node, ancestors) {
199
+ if (node.type === "FunctionDeclaration") {
200
+ return "function";
201
+ }
202
+ if (node.type === "ClassDeclaration") {
203
+ return "class";
204
+ }
205
+ if (node.type === "TSTypeAliasDeclaration") {
206
+ return "type";
207
+ }
208
+ if (node.type === "TSInterfaceDeclaration") {
209
+ return "interface";
210
+ }
211
+ if (node.type === "TSEnumDeclaration") {
212
+ return "enum";
213
+ }
214
+ if (node.type !== "VariableDeclarator") {
215
+ return;
216
+ }
217
+ const declaration = ancestors.findLast((ancestor) => ancestor.type === "VariableDeclaration");
218
+ return declaration?.type === "VariableDeclaration" && (declaration.kind === "const" || declaration.kind === "let" || declaration.kind === "var") ? declaration.kind : undefined;
219
+ }
220
+ function declarationsCollectNamed(root, kinds) {
221
+ const allowed = kinds && kinds.length > 0 ? new Set(kinds) : null;
198
222
  const result = [];
199
223
  astVisit(root, [], (node, ancestors) => {
200
- if ((node.type === "FunctionDeclaration" || node.type === "ClassDeclaration" || node.type === "TSTypeAliasDeclaration" || node.type === "TSInterfaceDeclaration" || node.type === "TSEnumDeclaration") && node.id?.name) {
201
- result.push({ name: node.id.name, node });
224
+ const kind = declarationsNamedKind(node, ancestors);
225
+ const name = node.type === "VariableDeclarator" && node.id.type === "Identifier" ? node.id.name : ("id" in node) && node.id && ("name" in node.id) ? node.id.name : undefined;
226
+ if (!kind || !name || allowed && !allowed.has(kind)) {
202
227
  return;
203
228
  }
204
- if (node.type === "VariableDeclarator" && node.id.type === "Identifier" && !ancestors.some((ancestor) => ancestor.type === "ForStatement" || ancestor.type === "ForInStatement" || ancestor.type === "ForOfStatement")) {
205
- result.push({ name: node.id.name, node });
229
+ if (node.type === "VariableDeclarator" && ancestors.some((ancestor) => ancestor.type === "ForStatement" || ancestor.type === "ForInStatement" || ancestor.type === "ForOfStatement")) {
230
+ return;
206
231
  }
232
+ result.push({ name, node, kind });
207
233
  });
208
234
  return result;
209
235
  }
@@ -396,6 +422,18 @@ function namingMatchTemplate(basename, template, placeholderPattern = "[a-z0-9-]
396
422
  }
397
423
  return new RegExp(`^${pattern}$`).exec(basename)?.groups ?? null;
398
424
  }
425
+ function namingNormalized(value, normalize) {
426
+ return normalize === "none" ? value : value.replaceAll(/[-_]/g, "").toLowerCase();
427
+ }
428
+ function namingFilePrefixes(stem, normalize = "remove-separators", singularize = "none") {
429
+ const prefixes = [namingNormalized(stem, normalize)];
430
+ const parts = stem.split(/[-_]+/).filter(Boolean);
431
+ const last = parts.at(-1) ?? "";
432
+ if (singularize === "trailing-s" && last.endsWith("s") && last.length > 1) {
433
+ prefixes.push(namingNormalized([...parts.slice(0, -1), last.slice(0, -1)].join("-"), normalize));
434
+ }
435
+ return [...new Set(prefixes.filter(Boolean))];
436
+ }
399
437
 
400
438
  // src/utils/helpers/factories.ts
401
439
  function factoriesExpandTemplate(template, groups) {
@@ -647,8 +685,66 @@ function schemasIsAllowedElement(node, allowScalars, namespaces, structuralMetho
647
685
  function schemasTypeOperator(node, namespaces, operators) {
648
686
  return node.typeName.type === "TSQualifiedName" && node.typeName.left.type === "Identifier" && namespaces.has(node.typeName.left.name) && operators.has(node.typeName.right.name) ? node.typeName.right.name : undefined;
649
687
  }
688
+ // src/rules/declaration-name.ts
689
+ var declarationName = defineRule({
690
+ meta: {
691
+ type: "problem",
692
+ schema: [{
693
+ type: "object",
694
+ additionalProperties: false,
695
+ properties: {
696
+ kinds: {
697
+ type: "array",
698
+ items: { type: "string", enum: [...declarationsKinds] }
699
+ },
700
+ pattern: { type: "string" },
701
+ flags: { type: "string" },
702
+ stem: { type: "string", enum: ["before-first-dot", "full-basename"] },
703
+ normalize: { type: "string", enum: ["remove-separators", "none"] },
704
+ singularize: { type: "string", enum: ["none", "trailing-s"] },
705
+ allowPattern: { type: "string" }
706
+ }
707
+ }],
708
+ messages: {
709
+ prefix: "'{{name}}' must start with file prefix '{{prefix}}'.",
710
+ pattern: "'{{name}}' must match {{pattern}}."
711
+ }
712
+ },
713
+ createOnce(context) {
714
+ return {
715
+ Program(program) {
716
+ const options2 = optionsFirst(context, {
717
+ stem: "before-first-dot",
718
+ normalize: "remove-separators"
719
+ });
720
+ const allowed = options2.allowPattern ? new RegExp(options2.allowPattern) : null;
721
+ const expected = options2.pattern ? new RegExp(options2.pattern, options2.flags) : null;
722
+ const basename = namingFileBasename(context.filename).replace(/\.(tsx?|jsx?)$/, "");
723
+ const stem = options2.stem === "full-basename" ? basename : basename.split(".")[0] ?? "";
724
+ const prefixes = namingFilePrefixes(stem, options2.normalize ?? "remove-separators", options2.singularize ?? "none");
725
+ const seen = new Set;
726
+ for (const item of declarationsCollectNamed(program, options2.kinds)) {
727
+ const key = `${item.name}:${item.node.start}:${item.node.end}`;
728
+ const comparableName = options2.normalize === "none" ? item.name : item.name.replaceAll("_", "").toLowerCase();
729
+ const matches = expected ? expected.test(item.name) : prefixes.some((prefix) => comparableName.startsWith(prefix));
730
+ if (seen.has(key) || allowed?.test(item.name) || matches) {
731
+ continue;
732
+ }
733
+ seen.add(key);
734
+ context.report({
735
+ node: item.node,
736
+ messageId: expected ? "pattern" : "prefix",
737
+ data: expected ? { name: item.name, pattern: options2.pattern ?? "" } : { name: item.name, prefix: prefixes.join(" or ") }
738
+ });
739
+ }
740
+ }
741
+ };
742
+ }
743
+ });
744
+
650
745
  // src/rules/export-file-prefix.ts
651
- var exportFilePrefix = defineRule({
746
+ import { defineRule as defineRule2 } from "@oxlint/plugins";
747
+ var exportFilePrefix = defineRule2({
652
748
  meta: {
653
749
  type: "problem",
654
750
  schema: [{
@@ -657,6 +753,7 @@ var exportFilePrefix = defineRule({
657
753
  properties: {
658
754
  stem: { type: "string", enum: ["before-first-dot", "full-basename"] },
659
755
  normalize: { type: "string", enum: ["remove-separators", "none"] },
756
+ singularize: { type: "string", enum: ["none", "trailing-s"] },
660
757
  allDeclarations: { type: "boolean" },
661
758
  allowPattern: { type: "string" }
662
759
  }
@@ -674,7 +771,7 @@ var exportFilePrefix = defineRule({
674
771
  });
675
772
  const basename = namingFileBasename(context.filename).replace(/\.(tsx?|jsx?)$/, "");
676
773
  const stem = options2.stem === "full-basename" ? basename : basename.split(".")[0] ?? "";
677
- const prefix = options2.normalize === "none" ? stem : stem.replaceAll(/[-_]/g, "").toLowerCase();
774
+ const prefixes = namingFilePrefixes(stem, options2.normalize ?? "remove-separators", options2.singularize ?? "none");
678
775
  const allowed = options2.allowPattern ? new RegExp(options2.allowPattern) : null;
679
776
  const names = options2.allDeclarations ? declarationsCollectNamed(program) : exportsCollect(program).map((binding) => ({
680
777
  name: binding.localName ?? binding.exportedName,
@@ -684,14 +781,14 @@ var exportFilePrefix = defineRule({
684
781
  for (const item of names) {
685
782
  const key = `${item.name}:${item.node.start}:${item.node.end}`;
686
783
  const comparableName = options2.normalize === "none" ? item.name : item.name.replaceAll("_", "").toLowerCase();
687
- if (seen.has(key) || allowed?.test(item.name) || comparableName.startsWith(prefix)) {
784
+ if (seen.has(key) || allowed?.test(item.name) || prefixes.some((prefix) => comparableName.startsWith(prefix))) {
688
785
  continue;
689
786
  }
690
787
  seen.add(key);
691
788
  context.report({
692
789
  node: item.node,
693
790
  messageId: "prefix",
694
- data: { name: item.name, prefix }
791
+ data: { name: item.name, prefix: prefixes.join(" or ") }
695
792
  });
696
793
  }
697
794
  }
@@ -700,8 +797,8 @@ var exportFilePrefix = defineRule({
700
797
  });
701
798
 
702
799
  // src/rules/export-name-pattern.ts
703
- import { defineRule as defineRule2 } from "@oxlint/plugins";
704
- var exportNamePattern = defineRule2({
800
+ import { defineRule as defineRule3 } from "@oxlint/plugins";
801
+ var exportNamePattern = defineRule3({
705
802
  meta: {
706
803
  type: "problem",
707
804
  schema: [{
@@ -751,8 +848,8 @@ var exportNamePattern = defineRule2({
751
848
  });
752
849
 
753
850
  // src/rules/filename-export-name.ts
754
- import { defineRule as defineRule3 } from "@oxlint/plugins";
755
- var filenameExportName = defineRule3({
851
+ import { defineRule as defineRule4 } from "@oxlint/plugins";
852
+ var filenameExportName = defineRule4({
756
853
  meta: {
757
854
  type: "problem",
758
855
  schema: [{
@@ -813,8 +910,8 @@ var filenameExportName = defineRule3({
813
910
  });
814
911
 
815
912
  // src/rules/filename-match.ts
816
- import { defineRule as defineRule4 } from "@oxlint/plugins";
817
- var filenameMatch = defineRule4({
913
+ import { defineRule as defineRule5 } from "@oxlint/plugins";
914
+ var filenameMatch = defineRule5({
818
915
  meta: {
819
916
  type: "problem",
820
917
  schema: [{
@@ -848,8 +945,8 @@ var filenameMatch = defineRule4({
848
945
  });
849
946
 
850
947
  // src/rules/folder-prefix.ts
851
- import { defineRule as defineRule5 } from "@oxlint/plugins";
852
- var folderPrefix = defineRule5({
948
+ import { defineRule as defineRule6 } from "@oxlint/plugins";
949
+ var folderPrefix = defineRule6({
853
950
  meta: {
854
951
  type: "problem",
855
952
  schema: [{
@@ -897,8 +994,8 @@ var folderPrefix = defineRule5({
897
994
  });
898
995
 
899
996
  // src/rules/no-extra-exports.ts
900
- import { defineRule as defineRule6 } from "@oxlint/plugins";
901
- var noExtraExports = defineRule6({
997
+ import { defineRule as defineRule7 } from "@oxlint/plugins";
998
+ var noExtraExports = defineRule7({
902
999
  meta: {
903
1000
  type: "problem",
904
1001
  schema: [{
@@ -941,8 +1038,8 @@ var noExtraExports = defineRule6({
941
1038
  });
942
1039
 
943
1040
  // src/rules/no-extra-factory-keys.ts
944
- import { defineRule as defineRule7 } from "@oxlint/plugins";
945
- var noExtraFactoryKeys = defineRule7({
1041
+ import { defineRule as defineRule8 } from "@oxlint/plugins";
1042
+ var noExtraFactoryKeys = defineRule8({
946
1043
  meta: {
947
1044
  type: "problem",
948
1045
  schema: [{
@@ -982,8 +1079,8 @@ var noExtraFactoryKeys = defineRule7({
982
1079
  });
983
1080
 
984
1081
  // src/rules/no-file-level-helpers.ts
985
- import { defineRule as defineRule8 } from "@oxlint/plugins";
986
- var noFileLevelHelpers = defineRule8({
1082
+ import { defineRule as defineRule9 } from "@oxlint/plugins";
1083
+ var noFileLevelHelpers = defineRule9({
987
1084
  meta: {
988
1085
  type: "problem",
989
1086
  schema: [{
@@ -1025,7 +1122,7 @@ var noFileLevelHelpers = defineRule8({
1025
1122
  });
1026
1123
 
1027
1124
  // src/rules/no-imported-type-alias.ts
1028
- import { defineRule as defineRule9 } from "@oxlint/plugins";
1125
+ import { defineRule as defineRule10 } from "@oxlint/plugins";
1029
1126
  function importedAliasTarget(declaration, imports) {
1030
1127
  if (declaration?.type !== "TSTypeAliasDeclaration" || declaration.typeAnnotation.type !== "TSTypeReference" || declaration.typeAnnotation.typeName.type !== "Identifier" || !imports.has(declaration.typeAnnotation.typeName.name)) {
1031
1128
  return;
@@ -1035,7 +1132,7 @@ function importedAliasTarget(declaration, imports) {
1035
1132
  function specifierLocalName(specifier) {
1036
1133
  return specifier.local.type === "Identifier" ? specifier.local.name : specifier.local.value;
1037
1134
  }
1038
- var noImportedTypeAlias = defineRule9({
1135
+ var noImportedTypeAlias = defineRule10({
1039
1136
  meta: {
1040
1137
  type: "problem",
1041
1138
  schema: [],
@@ -1085,8 +1182,8 @@ var noImportedTypeAlias = defineRule9({
1085
1182
  });
1086
1183
 
1087
1184
  // src/rules/no-inline-schema-elements.ts
1088
- import { defineRule as defineRule10 } from "@oxlint/plugins";
1089
- var noInlineSchemaElements = defineRule10({
1185
+ import { defineRule as defineRule11 } from "@oxlint/plugins";
1186
+ var noInlineSchemaElements = defineRule11({
1090
1187
  meta: {
1091
1188
  type: "problem",
1092
1189
  schema: [{
@@ -1134,13 +1231,13 @@ var noInlineSchemaElements = defineRule10({
1134
1231
  });
1135
1232
 
1136
1233
  // src/rules/no-local-schema-construction.ts
1137
- import { defineRule as defineRule11 } from "@oxlint/plugins";
1234
+ import { defineRule as defineRule12 } from "@oxlint/plugins";
1138
1235
  var defaultRuntimeImportMessage = "Do not import runtime schema constructors from {{source}}; import a named schema instead.";
1139
1236
  var defaultConstructionMessage = "Do not construct schemas locally; import a named schema instead.";
1140
1237
  function formatMessage(template, data) {
1141
1238
  return Object.entries(data).reduce((result, [key, value]) => result.replaceAll(`{{${key}}}`, value), template);
1142
1239
  }
1143
- var noLocalSchemaConstruction = defineRule11({
1240
+ var noLocalSchemaConstruction = defineRule12({
1144
1241
  meta: {
1145
1242
  type: "problem",
1146
1243
  schema: [{
@@ -1252,8 +1349,8 @@ var noLocalSchemaConstruction = defineRule11({
1252
1349
  });
1253
1350
 
1254
1351
  // src/rules/no-rederive-schema.ts
1255
- import { defineRule as defineRule12 } from "@oxlint/plugins";
1256
- var noRederiveSchema = defineRule12({
1352
+ import { defineRule as defineRule13 } from "@oxlint/plugins";
1353
+ var noRederiveSchema = defineRule13({
1257
1354
  meta: {
1258
1355
  type: "problem",
1259
1356
  schema: [{
@@ -1298,8 +1395,8 @@ var noRederiveSchema = defineRule12({
1298
1395
  });
1299
1396
 
1300
1397
  // src/rules/no-restricted-files.ts
1301
- import { defineRule as defineRule13 } from "@oxlint/plugins";
1302
- var noRestrictedFiles = defineRule13({
1398
+ import { defineRule as defineRule14 } from "@oxlint/plugins";
1399
+ var noRestrictedFiles = defineRule14({
1303
1400
  meta: {
1304
1401
  type: "problem",
1305
1402
  schema: [{
@@ -1329,7 +1426,7 @@ var noRestrictedFiles = defineRule13({
1329
1426
  });
1330
1427
 
1331
1428
  // src/rules/no-restricted-token.ts
1332
- import { defineRule as defineRule14 } from "@oxlint/plugins";
1429
+ import { defineRule as defineRule15 } from "@oxlint/plugins";
1333
1430
  function tokenIsTypeOnlyImport(node) {
1334
1431
  const parent = node.parent;
1335
1432
  if (parent?.type === "ImportSpecifier") {
@@ -1337,7 +1434,7 @@ function tokenIsTypeOnlyImport(node) {
1337
1434
  }
1338
1435
  return (parent?.type === "ImportDefaultSpecifier" || parent?.type === "ImportNamespaceSpecifier") && parent.parent.type === "ImportDeclaration" && parent.parent.importKind === "type";
1339
1436
  }
1340
- var noRestrictedToken = defineRule14({
1437
+ var noRestrictedToken = defineRule15({
1341
1438
  meta: {
1342
1439
  type: "problem",
1343
1440
  schema: [{
@@ -1379,8 +1476,8 @@ var noRestrictedToken = defineRule14({
1379
1476
  });
1380
1477
 
1381
1478
  // src/rules/no-runtime-in-types.ts
1382
- import { defineRule as defineRule15 } from "@oxlint/plugins";
1383
- var noRuntimeInTypes = defineRule15({
1479
+ import { defineRule as defineRule16 } from "@oxlint/plugins";
1480
+ var noRuntimeInTypes = defineRule16({
1384
1481
  meta: {
1385
1482
  type: "problem",
1386
1483
  schema: [{
@@ -1430,7 +1527,7 @@ var noRuntimeInTypes = defineRule15({
1430
1527
  });
1431
1528
 
1432
1529
  // src/rules/no-single-use-scalar-schema.ts
1433
- import { defineRule as defineRule16 } from "@oxlint/plugins";
1530
+ import { defineRule as defineRule17 } from "@oxlint/plugins";
1434
1531
  function isScalarSchema(node, namespaces, structuralMethods) {
1435
1532
  if (node.type !== "CallExpression" || node.callee.type !== "MemberExpression") {
1436
1533
  return false;
@@ -1464,7 +1561,7 @@ function isAllowedStructuralElement(identifier, initializer, ancestors, options2
1464
1561
  const method = call.callee.type === "MemberExpression" ? astStaticMemberName(call.callee) : undefined;
1465
1562
  return Boolean(method && options2.methods.includes(method) && schemasElements(call).includes(identifier));
1466
1563
  }
1467
- var noSingleUseScalarSchema = defineRule16({
1564
+ var noSingleUseScalarSchema = defineRule17({
1468
1565
  meta: {
1469
1566
  type: "suggestion",
1470
1567
  schema: [{
@@ -1532,8 +1629,8 @@ var noSingleUseScalarSchema = defineRule16({
1532
1629
  });
1533
1630
 
1534
1631
  // src/rules/no-top-level-functions.ts
1535
- import { defineRule as defineRule17 } from "@oxlint/plugins";
1536
- var noTopLevelFunctions = defineRule17({
1632
+ import { defineRule as defineRule18 } from "@oxlint/plugins";
1633
+ var noTopLevelFunctions = defineRule18({
1537
1634
  meta: {
1538
1635
  type: "problem",
1539
1636
  schema: [{
@@ -1590,8 +1687,8 @@ var noTopLevelFunctions = defineRule17({
1590
1687
  });
1591
1688
 
1592
1689
  // src/rules/no-trivial-functions.ts
1593
- import { defineRule as defineRule18 } from "@oxlint/plugins";
1594
- var noTrivialFunctions = defineRule18({
1690
+ import { defineRule as defineRule19 } from "@oxlint/plugins";
1691
+ var noTrivialFunctions = defineRule19({
1595
1692
  meta: {
1596
1693
  type: "problem",
1597
1694
  schema: [{
@@ -1628,9 +1725,45 @@ var noTrivialFunctions = defineRule18({
1628
1725
  }
1629
1726
  });
1630
1727
 
1728
+ // src/rules/no-type-declarations.ts
1729
+ import { defineRule as defineRule20 } from "@oxlint/plugins";
1730
+ var noTypeDeclarations = defineRule20({
1731
+ meta: {
1732
+ type: "problem",
1733
+ schema: [{
1734
+ type: "object",
1735
+ additionalProperties: false,
1736
+ properties: {
1737
+ allowPattern: { type: "string" }
1738
+ }
1739
+ }],
1740
+ messages: {
1741
+ typeDeclaration: "Type '{{name}}' must not be declared in this file."
1742
+ }
1743
+ },
1744
+ createOnce(context) {
1745
+ return {
1746
+ Program(program) {
1747
+ const { allowPattern } = optionsFirst(context, {});
1748
+ const allowed = allowPattern ? new RegExp(allowPattern) : null;
1749
+ for (const item of declarationsCollectNamed(program)) {
1750
+ if (item.node.type !== "TSTypeAliasDeclaration" && item.node.type !== "TSInterfaceDeclaration" || allowed?.test(item.name)) {
1751
+ continue;
1752
+ }
1753
+ context.report({
1754
+ node: item.node,
1755
+ messageId: "typeDeclaration",
1756
+ data: { name: item.name }
1757
+ });
1758
+ }
1759
+ }
1760
+ };
1761
+ }
1762
+ });
1763
+
1631
1764
  // src/rules/no-unescaped-like.ts
1632
- import { defineRule as defineRule19 } from "@oxlint/plugins";
1633
- var noUnescapedLike = defineRule19({
1765
+ import { defineRule as defineRule21 } from "@oxlint/plugins";
1766
+ var noUnescapedLike = defineRule21({
1634
1767
  meta: {
1635
1768
  type: "problem",
1636
1769
  schema: [{
@@ -1676,8 +1809,8 @@ var noUnescapedLike = defineRule19({
1676
1809
  });
1677
1810
 
1678
1811
  // src/rules/only-export-components.ts
1679
- import { defineRule as defineRule20 } from "@oxlint/plugins";
1680
- var onlyExportComponents = defineRule20({
1812
+ import { defineRule as defineRule22 } from "@oxlint/plugins";
1813
+ var onlyExportComponents = defineRule22({
1681
1814
  meta: {
1682
1815
  type: "problem",
1683
1816
  schema: [{
@@ -1733,8 +1866,8 @@ var onlyExportComponents = defineRule20({
1733
1866
  });
1734
1867
 
1735
1868
  // src/rules/require-file-factory.ts
1736
- import { defineRule as defineRule21 } from "@oxlint/plugins";
1737
- var requireFileFactory = defineRule21({
1869
+ import { defineRule as defineRule23 } from "@oxlint/plugins";
1870
+ var requireFileFactory = defineRule23({
1738
1871
  meta: {
1739
1872
  type: "problem",
1740
1873
  schema: [{
@@ -1780,8 +1913,8 @@ var requireFileFactory = defineRule21({
1780
1913
  });
1781
1914
 
1782
1915
  // src/rules/require-object-params.ts
1783
- import { defineRule as defineRule22 } from "@oxlint/plugins";
1784
- var requireObjectParams = defineRule22({
1916
+ import { defineRule as defineRule24 } from "@oxlint/plugins";
1917
+ var requireObjectParams = defineRule24({
1785
1918
  meta: {
1786
1919
  type: "problem",
1787
1920
  schema: [],
@@ -1807,8 +1940,8 @@ var requireObjectParams = defineRule22({
1807
1940
  });
1808
1941
 
1809
1942
  // src/rules/require-orpc-output.ts
1810
- import { defineRule as defineRule23 } from "@oxlint/plugins";
1811
- var requireOrpcOutput = defineRule23({
1943
+ import { defineRule as defineRule25 } from "@oxlint/plugins";
1944
+ var requireOrpcOutput = defineRule25({
1812
1945
  meta: {
1813
1946
  type: "problem",
1814
1947
  schema: [{
@@ -1850,8 +1983,8 @@ var requireOrpcOutput = defineRule23({
1850
1983
  });
1851
1984
 
1852
1985
  // src/rules/require-paired-call.ts
1853
- import { defineRule as defineRule24 } from "@oxlint/plugins";
1854
- var requirePairedCall = defineRule24({
1986
+ import { defineRule as defineRule26 } from "@oxlint/plugins";
1987
+ var requirePairedCall = defineRule26({
1855
1988
  meta: {
1856
1989
  type: "problem",
1857
1990
  schema: [{
@@ -1906,8 +2039,8 @@ var requirePairedCall = defineRule24({
1906
2039
  });
1907
2040
 
1908
2041
  // src/rules/route-surface.ts
1909
- import { defineRule as defineRule25 } from "@oxlint/plugins";
1910
- var routeSurface = defineRule25({
2042
+ import { defineRule as defineRule27 } from "@oxlint/plugins";
2043
+ var routeSurface = defineRule27({
1911
2044
  meta: {
1912
2045
  type: "problem",
1913
2046
  schema: [{
@@ -1952,6 +2085,7 @@ var routeSurface = defineRule25({
1952
2085
  var src_default = eslintCompatPlugin({
1953
2086
  meta: { name: "arch" },
1954
2087
  rules: {
2088
+ "declaration-name": declarationName,
1955
2089
  "export-file-prefix": exportFilePrefix,
1956
2090
  "export-name-pattern": exportNamePattern,
1957
2091
  "filename-export-name": filenameExportName,
@@ -1970,6 +2104,7 @@ var src_default = eslintCompatPlugin({
1970
2104
  "no-single-use-scalar-schema": noSingleUseScalarSchema,
1971
2105
  "no-top-level-functions": noTopLevelFunctions,
1972
2106
  "no-trivial-functions": noTrivialFunctions,
2107
+ "no-type-declarations": noTypeDeclarations,
1973
2108
  "no-unescaped-like": noUnescapedLike,
1974
2109
  "only-export-components": onlyExportComponents,
1975
2110
  "require-file-factory": requireFileFactory,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oxlint-plugin-arch",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Configurable architecture rules for Oxlint JavaScript plugins.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",