oxlint-plugin-arch 0.6.1 → 0.6.2

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.
Files changed (59) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +34 -0
  3. package/dist/index.js +122 -122
  4. package/dist/presets/index.js +6 -7
  5. package/dist/presets/tanstack-start-react-modules-preset.js +6 -7
  6. package/dist/rules/dillon-anti-slop/index.d.ts +2 -0
  7. package/dist/rules/dillon-anti-slop/index.js +2 -2
  8. package/dist/rules/dillon-anti-slop/rules/no-chained-type-assertions.d.ts +1 -0
  9. package/dist/rules/dillon-anti-slop/rules/no-conditional-empty-object-spread.d.ts +1 -0
  10. package/dist/rules/dillon-anti-slop/rules/no-known-value-widening.d.ts +1 -0
  11. package/dist/rules/dillon-anti-slop/rules/no-module-mocking.d.ts +1 -0
  12. package/dist/rules/dillon-anti-slop/rules/no-object-parameters.d.ts +1 -0
  13. package/dist/rules/dillon-anti-slop/rules/no-reflect-apply.d.ts +1 -0
  14. package/dist/rules/dillon-anti-slop/rules/no-reflect-get.d.ts +1 -0
  15. package/dist/rules/dillon-anti-slop/rules/no-runtime-typeof.d.ts +1 -0
  16. package/dist/rules/dillon-anti-slop/rules/no-shape-in-symbol-names.d.ts +1 -0
  17. package/dist/rules/dillon-anti-slop/rules/no-unknown-parameters.d.ts +1 -0
  18. package/dist/rules/dillon-anti-slop/rules/no-unknown-returns.d.ts +1 -0
  19. package/dist/rules/dillon-anti-slop/rules/no-unknown-type-aliases.d.ts +1 -0
  20. package/dist/rules/dillon-anti-slop/rules/no-unsafe-dictionary-type.d.ts +1 -0
  21. package/dist/rules/dillon-anti-slop/rules/no-widen-then-assert.d.ts +1 -0
  22. package/dist/rules/dillon-anti-slop/rules/require-safety-comment-for-type-assertion.d.ts +1 -0
  23. package/dist/rules/dillon-anti-slop/shared/dictionary-types.d.ts +19 -0
  24. package/dist/rules/dillon-anti-slop/shared/lexical-type-parameters.d.ts +4 -0
  25. package/dist/rules/dillon-anti-slop/shared/reflect-method.d.ts +2 -0
  26. package/dist/rules/module-policy/domain-constants.d.ts +2 -0
  27. package/dist/rules/module-policy/import-boundaries.d.ts +2 -0
  28. package/dist/rules/module-policy/index.d.ts +2 -0
  29. package/dist/rules/module-policy/index.js +49 -49
  30. package/dist/rules/module-policy/memoization.d.ts +2 -0
  31. package/dist/rules/module-policy/reasoned-directives.d.ts +2 -0
  32. package/dist/rules/module-policy/service-functions.d.ts +2 -0
  33. package/dist/rules/module-policy/service-types.d.ts +2 -0
  34. package/dist/rules/module-policy/tanstack-runtime.d.ts +2 -0
  35. package/dist/rules/module-policy/test-assertions.d.ts +2 -0
  36. package/dist/rules/module-policy/test-modifiers.d.ts +2 -0
  37. package/dist/types/module-policy.types.d.ts +34 -0
  38. package/dist/types/test-analysis.types.d.ts +11 -0
  39. package/dist/utils/helpers/ast.d.ts +12 -0
  40. package/dist/utils/helpers/boundaries.d.ts +3 -0
  41. package/dist/utils/helpers/comments.d.ts +6 -0
  42. package/dist/utils/helpers/declarations.d.ts +35 -0
  43. package/dist/utils/helpers/exports.d.ts +18 -0
  44. package/dist/utils/helpers/factories.d.ts +9 -0
  45. package/dist/utils/helpers/guards.d.ts +11 -0
  46. package/dist/utils/helpers/index.d.ts +16 -0
  47. package/dist/utils/helpers/layout.d.ts +15 -0
  48. package/dist/utils/helpers/naming.d.ts +13 -0
  49. package/dist/utils/helpers/options.d.ts +22 -0
  50. package/dist/utils/helpers/orpc.d.ts +3 -0
  51. package/dist/utils/helpers/react-components.d.ts +13 -0
  52. package/dist/utils/helpers/routes.d.ts +5 -0
  53. package/dist/utils/helpers/sanitizers.d.ts +3 -0
  54. package/dist/utils/helpers/schemas.d.ts +10 -0
  55. package/dist/utils/helpers/syntax.d.ts +1 -0
  56. package/dist/utils/helpers/test-tables.d.ts +8 -0
  57. package/dist/utils/helpers/trivial.d.ts +6 -0
  58. package/dist/utils/index.d.ts +1 -0
  59. package/package.json +9 -2
@@ -0,0 +1,18 @@
1
+ import type { AstRuntimeFunction } from './ast.ts';
2
+ import type { ESTree } from '@oxlint/plugins';
3
+ export interface ExportsBinding {
4
+ exportedName: string;
5
+ localName?: string;
6
+ node: ESTree.Node;
7
+ declaration?: ESTree.Declaration;
8
+ initializer?: ESTree.Expression | null;
9
+ typeOnly: boolean;
10
+ default: boolean;
11
+ reExport: boolean;
12
+ }
13
+ export interface ExportsFunction {
14
+ name: string;
15
+ node: AstRuntimeFunction;
16
+ }
17
+ export declare function exportsCollect(program: ESTree.Program): ExportsBinding[];
18
+ export declare function exportsCollectFunctions(program: ESTree.Program): ExportsFunction[];
@@ -0,0 +1,9 @@
1
+ import type { ESTree } from '@oxlint/plugins';
2
+ export interface FactoriesFunction {
3
+ name: string;
4
+ node: ESTree.Function | ESTree.ArrowFunctionExpression;
5
+ }
6
+ export declare function factoriesExpandTemplate(template: string, groups: Record<string, string>, camelCase?: boolean): string;
7
+ export declare function factoriesCollectTopLevel(program: ESTree.Program, pattern: RegExp): FactoriesFunction[];
8
+ export declare function factoriesDirectlyReturnedObjects(factory: FactoriesFunction): ESTree.ObjectExpression[];
9
+ export declare function factoriesObjectPropertyName(property: ESTree.ObjectPropertyKind): string | undefined;
@@ -0,0 +1,11 @@
1
+ import type { AstRuntimeFunction } from './ast.ts';
2
+ import type { ESTree } from '@oxlint/plugins';
3
+ interface GuardsState {
4
+ values: Set<string>;
5
+ predicates: Set<string>;
6
+ primitive: boolean;
7
+ returned: boolean;
8
+ globalArray: (node: ESTree.Node) => boolean;
9
+ }
10
+ export declare function guardsIsGenericHelper(node: AstRuntimeFunction, globalArray: GuardsState['globalArray']): boolean;
11
+ export {};
@@ -0,0 +1,16 @@
1
+ export * from './ast.ts';
2
+ export * from './comments.ts';
3
+ export * from './declarations.ts';
4
+ export * from './exports.ts';
5
+ export * from './factories.ts';
6
+ export * from './guards.ts';
7
+ export * from './layout.ts';
8
+ export * from './naming.ts';
9
+ export * from './options.ts';
10
+ export * from './orpc.ts';
11
+ export * from './react-components.ts';
12
+ export * from './routes.ts';
13
+ export * from './sanitizers.ts';
14
+ export * from './schemas.ts';
15
+ export * from './trivial.ts';
16
+ export * from './boundaries.ts';
@@ -0,0 +1,15 @@
1
+ export type LayoutIndent = number | 'tab';
2
+ export declare const layoutIndentSchema: {
3
+ anyOf: ({
4
+ type: string;
5
+ minimum: number;
6
+ enum?: undefined;
7
+ } | {
8
+ type: string;
9
+ enum: string[];
10
+ minimum?: undefined;
11
+ })[];
12
+ };
13
+ export declare function layoutLineIndent(text: string, offset: number): string;
14
+ export declare function layoutIndentUnit(indent?: LayoutIndent): string;
15
+ export declare function layoutNewline(text: string): string;
@@ -0,0 +1,13 @@
1
+ export declare function namingPosixPath(filePath: string): string;
2
+ export declare function namingFileBasename(filePath: string): string;
3
+ export declare function namingDirSegments(filePath: string): string[];
4
+ export declare function namingSegmentsAfter(filePath: string, after: string): string[] | undefined;
5
+ export declare function namingFolderPrefixes(folders: string[], separator: string, singularize: 'none' | 'trailing-s'): string[];
6
+ export declare function namingPascalCase(value: string): string;
7
+ export declare function namingCamelCase(value: string): string;
8
+ export declare function namingMatchTemplate(basename: string, template: string, placeholderPattern?: string): Record<string, string> | null;
9
+ export declare const namingStemModes: readonly ["before-first-dot", "full-basename"];
10
+ export type NamingStemMode = (typeof namingStemModes)[number];
11
+ export declare function namingNormalized(value: string, normalize: 'remove-separators' | 'none'): string;
12
+ export declare function namingFileStem(basename: string, mode?: NamingStemMode, trailingRoles?: readonly string[], roleSeparators?: readonly string[]): string;
13
+ export declare function namingFilePrefixes(stem: string, normalize?: 'remove-separators' | 'none', singularize?: 'none' | 'trailing-s'): string[];
@@ -0,0 +1,22 @@
1
+ import type { Context } from '@oxlint/plugins';
2
+ export declare function optionsFirst<T>(context: Context, fallback?: T): T;
3
+ export type OptionsPattern = string | string[];
4
+ export declare const optionsPatternSchema: {
5
+ anyOf: ({
6
+ type: string;
7
+ items?: undefined;
8
+ minItems?: undefined;
9
+ } | {
10
+ type: string;
11
+ items: {
12
+ type: string;
13
+ };
14
+ minItems: number;
15
+ })[];
16
+ };
17
+ /** Compiles a regex option that accepts one pattern or a list where any pattern may match. */
18
+ export declare function optionsPatterns(pattern: OptionsPattern | undefined, flags?: string): RegExp[];
19
+ /** Like `optionsPatterns`, for options where an empty string has always meant "not set". */
20
+ export declare function optionsOptionalPatterns(pattern: OptionsPattern | undefined, flags?: string): RegExp[];
21
+ export declare function optionsPatternLabel(pattern: OptionsPattern | undefined): string;
22
+ export declare function optionsPatternsTest(patterns: RegExp[], value: string): boolean;
@@ -0,0 +1,3 @@
1
+ import type { ESTree } from '@oxlint/plugins';
2
+ export declare function orpcFindChainCall(expression: ESTree.Expression, method: string): ESTree.CallExpression | undefined;
3
+ export declare function orpcIsNamedOrComposedArgument(argument: ESTree.Argument | undefined, composers: Set<string>): boolean;
@@ -0,0 +1,13 @@
1
+ import type { AstRuntimeFunction } from './ast.ts';
2
+ import type { ESTree } from '@oxlint/plugins';
3
+ export interface ReactComponentsCandidate {
4
+ name: string;
5
+ node: ESTree.Node;
6
+ declaration?: ESTree.Declaration;
7
+ initializer?: ESTree.Expression | null;
8
+ typeOnly?: boolean;
9
+ }
10
+ export declare function reactComponentsExportCandidates(program: ESTree.Program): ReactComponentsCandidate[];
11
+ export declare function reactComponentsFunctionReturnsOutput(program: ESTree.Program, node: AstRuntimeFunction): boolean;
12
+ export declare function reactComponentsIsLike(program: ESTree.Program, candidate: ReactComponentsCandidate): boolean;
13
+ export declare function reactComponentsPascalFromBasename(basename: string): string;
@@ -0,0 +1,5 @@
1
+ import type { Context, ESTree } from '@oxlint/plugins';
2
+ export declare function routesInspectFunction(context: Context, item: {
3
+ name: string;
4
+ node: ESTree.Function | ESTree.ArrowFunctionExpression;
5
+ }, bannedHooks: Set<string>, banIntrinsicJsx: boolean): void;
@@ -0,0 +1,3 @@
1
+ import type { ESTree } from '@oxlint/plugins';
2
+ export declare function sanitizersCallsConfigured(node: unknown, names: Set<string>): boolean;
3
+ export declare function sanitizersConfiguredBindings(program: ESTree.Program, names: Set<string>): Set<string>;
@@ -0,0 +1,10 @@
1
+ import type { ESTree } from '@oxlint/plugins';
2
+ export declare function schemasIsPackage(source: string, packages: ReadonlySet<string>): boolean;
3
+ export declare function schemasIsCall(node: ESTree.CallExpression, namespaces: Set<string>): boolean;
4
+ export declare function schemasRuntimeImportLocals(node: ESTree.ImportDeclaration): string[];
5
+ export declare function schemasIsRuntimeImport(node: ESTree.ImportDeclaration, packages: ReadonlySet<string>): boolean;
6
+ export declare function schemasIsRuntimeReexport(node: ESTree.ExportNamedDeclaration | ESTree.ExportAllDeclaration, packages: ReadonlySet<string>): boolean;
7
+ export declare function schemasIsConstruction(node: ESTree.CallExpression, constructors: ReadonlySet<string>): boolean;
8
+ export declare function schemasElements(node: ESTree.CallExpression): ESTree.Argument[];
9
+ export declare function schemasIsAllowedElement(node: ESTree.Argument, allowScalars: boolean, namespaces: Set<string>, structuralMethods: Set<string>): boolean;
10
+ export declare function schemasTypeOperator(node: ESTree.TSTypeReference, namespaces: Set<string>, operators: Set<string>): string | undefined;
@@ -0,0 +1 @@
1
+ export declare function syntaxRule(selector: string, message: string): import("@oxlint/plugins").Rule;
@@ -0,0 +1,8 @@
1
+ import type { ESTree, SourceCode } from '@oxlint/plugins';
2
+ import type { AstRuntimeFunction } from './ast.ts';
3
+ import type { TestRegistration, TestTableRow } from '../../types/test-analysis.types.ts';
4
+ export declare function testTablesRegistration(call: ESTree.CallExpression, names: string[], functions: Map<ESTree.Node, AstRuntimeFunction>): TestRegistration | undefined;
5
+ export declare function testTablesResolve(expression: ESTree.Expression, values: Map<ESTree.Node, ESTree.Expression>): ESTree.Expression;
6
+ export declare function testTablesRows(registration: TestRegistration, sourceCode: SourceCode, values: Map<ESTree.Node, ESTree.Expression>, functions: Map<ESTree.Node, AstRuntimeFunction>): TestTableRow[] | undefined;
7
+ export declare function testTablesCallName(node: ESTree.Node): string | undefined;
8
+ export declare function testTablesAssertionPattern(name: string): RegExp;
@@ -0,0 +1,6 @@
1
+ import type { AstRuntimeFunction } from './ast.ts';
2
+ import type { ESTree } from '@oxlint/plugins';
3
+ export declare function trivialExpression(node: AstRuntimeFunction): ESTree.Expression | null;
4
+ export declare function trivialUnwrap(expression: ESTree.Expression): ESTree.Expression;
5
+ export declare function trivialCallRoot(expression: ESTree.Expression): string | undefined;
6
+ export declare function trivialIsForwarder(node: AstRuntimeFunction, expression: ESTree.Expression): boolean;
@@ -0,0 +1 @@
1
+ export * from './helpers/index.ts';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oxlint-plugin-arch",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Configurable architecture rules for Oxlint JavaScript plugins.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -13,6 +13,14 @@
13
13
  "./presets/tanstack-start-react-modules-preset": {
14
14
  "types": "./dist/presets/tanstack-start-react-modules-preset.d.ts",
15
15
  "default": "./dist/presets/tanstack-start-react-modules-preset.js"
16
+ },
17
+ "./rules/dillon-anti-slop": {
18
+ "types": "./dist/rules/dillon-anti-slop/index.d.ts",
19
+ "default": "./dist/rules/dillon-anti-slop/index.js"
20
+ },
21
+ "./rules/module-policy": {
22
+ "types": "./dist/rules/module-policy/index.d.ts",
23
+ "default": "./dist/rules/module-policy/index.js"
16
24
  }
17
25
  },
18
26
  "files": [
@@ -30,7 +38,6 @@
30
38
  "check:examples": "oxlint examples/minimal.oxlint.config.ts -c examples/minimal.oxlint.config.ts --disable-nested-config && oxlint examples/full.oxlint.config.ts -c examples/full.oxlint.config.ts --disable-nested-config && oxlint examples/dist.oxlint.config.ts -c examples/dist.oxlint.config.ts --disable-nested-config && oxlint examples/monorepo.oxlint.config.ts -c examples/monorepo.oxlint.config.ts --disable-nested-config && oxlint --print-config -c examples/preset.oxlint.config.ts > /dev/null",
31
39
  "prepublishOnly": "bun run check",
32
40
  "release": "bash scripts/release.sh",
33
- "release:dry-run": "bash scripts/release.sh --dry-run",
34
41
  "release:patch": "bash scripts/release.sh patch --yes",
35
42
  "release:minor": "bash scripts/release.sh minor --yes",
36
43
  "release:major": "bash scripts/release.sh major --yes"