oxlint-plugin-arch 0.4.0 → 0.5.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/CHANGELOG.md +46 -0
- package/README.md +203 -7
- package/dist/configs/boundaries.d.ts +2 -0
- package/dist/configs/modules.d.ts +2 -0
- package/dist/configs/plugins.d.ts +3 -0
- package/dist/configs/react.d.ts +2 -0
- package/dist/configs/source.d.ts +2 -0
- package/dist/configs/tests.d.ts +2 -0
- package/dist/configs/types.d.ts +2 -0
- package/dist/constants/preset.constants.d.ts +28 -0
- package/dist/index.js +1045 -630
- package/dist/presets/index.d.ts +2 -0
- package/dist/presets/index.js +1354 -0
- package/dist/presets/tanstack-start-react-modules-preset.d.ts +3 -0
- package/dist/presets/tanstack-start-react-modules-preset.js +1354 -0
- package/dist/rules/dillon-anti-slop/index.js +1588 -0
- package/dist/rules/module-policy/index.js +1743 -0
- package/dist/services/preset-compose.d.ts +3 -0
- package/dist/services/preset-context.d.ts +2 -0
- package/dist/types/preset.types.d.ts +119 -0
- package/dist/utils/helpers/preset.d.ts +6 -0
- package/package.json +45 -10
- package/src/rules/dillon-anti-slop/LICENSE +21 -0
- package/src/rules/dillon-anti-slop/UPSTREAM.md +19 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { OxlintConfig, OxlintOverride } from 'oxlint';
|
|
2
|
+
export type PresetPolicy = boolean | ((current: OxlintOverride[]) => OxlintOverride[]);
|
|
3
|
+
export type PresetPolicyName = 'typePlacement' | 'typeSafety' | 'serviceStructure' | 'fileLayout' | 'naming' | 'comments' | 'formatting' | 'statementLayout' | 'imports' | 'react' | 'effects' | 'memoization' | 'routes' | 'forms' | 'schemas' | 'boundaries' | 'tests' | 'trivialFunctions' | 'mutableState' | 'backend' | 'tailwind' | 'shadcn' | 'rpcClientOwnership';
|
|
4
|
+
export type PresetRole = 'web' | 'server' | 'runner' | 'scripts' | 'packages';
|
|
5
|
+
export type PresetFolderLayout = 'flat' | 'domain';
|
|
6
|
+
export interface PresetArchitectureEntry {
|
|
7
|
+
role: PresetRole;
|
|
8
|
+
layout?: Record<string, PresetFolderLayout>;
|
|
9
|
+
}
|
|
10
|
+
export type PresetArchitecture = Record<string, PresetRole | PresetArchitectureEntry>;
|
|
11
|
+
export interface PresetResolvedRoot {
|
|
12
|
+
role: PresetRole;
|
|
13
|
+
layout: Record<string, PresetFolderLayout>;
|
|
14
|
+
}
|
|
15
|
+
export interface PresetFolderScope {
|
|
16
|
+
path: string;
|
|
17
|
+
folder: string;
|
|
18
|
+
mode: PresetFolderLayout;
|
|
19
|
+
}
|
|
20
|
+
export interface PresetOptions {
|
|
21
|
+
root?: string;
|
|
22
|
+
architecture?: PresetArchitecture;
|
|
23
|
+
severity?: 'error' | 'warn';
|
|
24
|
+
limits?: PresetLimitsOptions;
|
|
25
|
+
modules?: PresetModulesOptions;
|
|
26
|
+
imports?: PresetImportsOptions;
|
|
27
|
+
orpc?: PresetOrpcOptions;
|
|
28
|
+
sql?: PresetSqlOptions;
|
|
29
|
+
forms?: PresetFormsOptions;
|
|
30
|
+
react?: PresetReactOptions;
|
|
31
|
+
policies?: PresetPolicyOptions;
|
|
32
|
+
ignorePatterns?: string[];
|
|
33
|
+
ruleExclusions?: Record<string, string[]>;
|
|
34
|
+
cliFiles?: string[];
|
|
35
|
+
tanstackStart?: PresetTanstackStartOptions;
|
|
36
|
+
tailwind?: false | PresetTailwindOptions;
|
|
37
|
+
shadcn?: false | PresetShadcnOptions;
|
|
38
|
+
}
|
|
39
|
+
export interface PresetPolicyOptions extends Partial<Record<PresetPolicyName, PresetPolicy>> {
|
|
40
|
+
}
|
|
41
|
+
export interface PresetLimitsOptions {
|
|
42
|
+
maxFileLines?: number;
|
|
43
|
+
maxFunctionComplexity?: number;
|
|
44
|
+
}
|
|
45
|
+
export interface PresetModulesOptions {
|
|
46
|
+
customFileRoles?: string[];
|
|
47
|
+
}
|
|
48
|
+
export interface PresetImportsOptions {
|
|
49
|
+
backendEntryPoints?: string[];
|
|
50
|
+
aliases?: Record<string, string>;
|
|
51
|
+
internalSortPatterns?: string[];
|
|
52
|
+
}
|
|
53
|
+
export interface PresetOrpcOptions {
|
|
54
|
+
publicProcedureFiles?: string[];
|
|
55
|
+
outputSchemaComposers?: string[];
|
|
56
|
+
clientOwnerFile?: string;
|
|
57
|
+
}
|
|
58
|
+
export interface PresetSqlOptions {
|
|
59
|
+
likeSanitizers?: string[];
|
|
60
|
+
}
|
|
61
|
+
export interface PresetFormsOptions {
|
|
62
|
+
schemaResolver?: string;
|
|
63
|
+
}
|
|
64
|
+
export interface PresetReactOptions {
|
|
65
|
+
compiler?: boolean;
|
|
66
|
+
}
|
|
67
|
+
export interface PresetTanstackStartOptions {
|
|
68
|
+
additionalServerOnlyImports?: string[];
|
|
69
|
+
additionalClientOnlyImports?: string[];
|
|
70
|
+
computedImportAllowedFiles?: string[];
|
|
71
|
+
}
|
|
72
|
+
export interface PresetTailwindOptions {
|
|
73
|
+
cssEntryPoint?: string;
|
|
74
|
+
cssEntryPointsByRoot?: Record<string, string>;
|
|
75
|
+
rootFontSize?: number;
|
|
76
|
+
}
|
|
77
|
+
export interface PresetShadcnOptions {
|
|
78
|
+
uiImportPath?: string;
|
|
79
|
+
componentImportSources?: string[];
|
|
80
|
+
}
|
|
81
|
+
export type PresetRules = NonNullable<OxlintConfig['rules']>;
|
|
82
|
+
export type PresetPolicies = Partial<Record<PresetPolicyName, OxlintOverride[]>>;
|
|
83
|
+
export interface PresetManifest {
|
|
84
|
+
name?: string;
|
|
85
|
+
}
|
|
86
|
+
export interface PresetImportRestriction {
|
|
87
|
+
group: string[];
|
|
88
|
+
message: string;
|
|
89
|
+
}
|
|
90
|
+
export interface PresetContext {
|
|
91
|
+
options: PresetOptions;
|
|
92
|
+
architecture: Record<string, PresetResolvedRoot>;
|
|
93
|
+
folders: PresetFolderScope[];
|
|
94
|
+
rpcClients: string[];
|
|
95
|
+
packages: string[];
|
|
96
|
+
scripts: string[];
|
|
97
|
+
root: string;
|
|
98
|
+
level: 'error' | 'warn';
|
|
99
|
+
css: Record<string, string>;
|
|
100
|
+
baseImports: PresetImportRestriction[];
|
|
101
|
+
web: string[];
|
|
102
|
+
backend: string[];
|
|
103
|
+
app: string[];
|
|
104
|
+
appFiles: string[];
|
|
105
|
+
webFiles: string[];
|
|
106
|
+
backendFiles: string[];
|
|
107
|
+
services: string[];
|
|
108
|
+
utilities: string[];
|
|
109
|
+
types: string[];
|
|
110
|
+
ui: string[];
|
|
111
|
+
generated: string[];
|
|
112
|
+
testFiles: string[];
|
|
113
|
+
safetyFiles: string[];
|
|
114
|
+
components: string[];
|
|
115
|
+
hooks: string[];
|
|
116
|
+
publicEntrypoints: string[];
|
|
117
|
+
}
|
|
118
|
+
export type PresetJsPlugins = NonNullable<OxlintConfig['jsPlugins']>;
|
|
119
|
+
export type PresetSettings = NonNullable<OxlintConfig['settings']>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { OxlintOverride } from 'oxlint';
|
|
2
|
+
import type { PresetRules } from '../../types/preset.types.ts';
|
|
3
|
+
export declare function presetScopes(roots: string[], suffix?: string): string[];
|
|
4
|
+
export declare function presetOverride(files: string[], rules: PresetRules, excludeFiles?: string[]): OxlintOverride;
|
|
5
|
+
export declare function presetPackageName(root: string, directory: string): string | undefined;
|
|
6
|
+
export declare function presetSeverity(rules: PresetRules, level: 'error' | 'warn'): PresetRules;
|
package/package.json
CHANGED
|
@@ -1,23 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oxlint-plugin-arch",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Configurable architecture rules for Oxlint JavaScript plugins.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"exports": {
|
|
8
|
-
".": "./dist/index.js"
|
|
8
|
+
".": "./dist/index.js",
|
|
9
|
+
"./presets": {
|
|
10
|
+
"types": "./dist/presets/index.d.ts",
|
|
11
|
+
"default": "./dist/presets/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./presets/tanstack-start-react-modules-preset": {
|
|
14
|
+
"types": "./dist/presets/tanstack-start-react-modules-preset.d.ts",
|
|
15
|
+
"default": "./dist/presets/tanstack-start-react-modules-preset.js"
|
|
16
|
+
}
|
|
9
17
|
},
|
|
10
18
|
"files": [
|
|
11
19
|
"CHANGELOG.md",
|
|
20
|
+
"src/rules/dillon-anti-slop/LICENSE",
|
|
21
|
+
"src/rules/dillon-anti-slop/UPSTREAM.md",
|
|
12
22
|
"dist"
|
|
13
23
|
],
|
|
14
24
|
"scripts": {
|
|
15
|
-
"build": "bun build src/index.ts
|
|
16
|
-
"check": "bun run lint && bun run
|
|
25
|
+
"build": "bun build src/index.ts src/presets/index.ts src/presets/tanstack-start-react-modules-preset.ts src/rules/dillon-anti-slop/index.ts src/rules/module-policy/index.ts --root src --outdir dist --target node --format esm --packages external && tsc --project tsconfig.build.json",
|
|
26
|
+
"check": "bun run lint && bun run build && bun run typecheck && bun run test && bun run check:examples",
|
|
17
27
|
"lint": "oxlint src examples scripts",
|
|
18
28
|
"test": "vitest run src/tests",
|
|
19
29
|
"typecheck": "tsc --noEmit",
|
|
20
|
-
"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",
|
|
30
|
+
"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",
|
|
21
31
|
"prepublishOnly": "bun run check",
|
|
22
32
|
"release": "bash scripts/release.sh",
|
|
23
33
|
"release:dry-run": "bash scripts/release.sh --dry-run",
|
|
@@ -26,17 +36,37 @@
|
|
|
26
36
|
"release:major": "bash scripts/release.sh major --yes"
|
|
27
37
|
},
|
|
28
38
|
"dependencies": {
|
|
29
|
-
"@
|
|
39
|
+
"@eslint-community/eslint-plugin-eslint-comments": "4.8.1",
|
|
40
|
+
"@oxlint/plugins": "1.85.0",
|
|
41
|
+
"@regru/eslint-plugin-prefer-early-return": "1.0.0",
|
|
42
|
+
"@shadcn/lint": "0.1.5",
|
|
43
|
+
"eslint-plugin-import": "2.32.0",
|
|
44
|
+
"eslint-plugin-perfectionist": "5.12.1",
|
|
45
|
+
"eslint-plugin-react": "7.37.5",
|
|
46
|
+
"eslint-plugin-react-you-might-not-need-an-effect": "1.0.2",
|
|
47
|
+
"eslint-plugin-svg-jsx": "1.3.0",
|
|
48
|
+
"eslint-plugin-tsdoc": "0.5.3",
|
|
49
|
+
"eslint-plugin-unused-imports": "4.4.1",
|
|
50
|
+
"oxlint-plugin-eslint": "1.85.0",
|
|
51
|
+
"oxlint-tailwindcss": "1.14.0"
|
|
30
52
|
},
|
|
31
53
|
"peerDependencies": {
|
|
32
|
-
"oxlint": ">=1.
|
|
54
|
+
"oxlint": ">=1.85.0",
|
|
55
|
+
"oxlint-tsgolint": ">=7.0.2003"
|
|
33
56
|
},
|
|
34
57
|
"devDependencies": {
|
|
58
|
+
"@orpc/server": "1.15.4",
|
|
59
|
+
"@tanstack/react-router": "1.170.41",
|
|
35
60
|
"@types/node": "26.0.1",
|
|
61
|
+
"@types/react": "19.3.0",
|
|
36
62
|
"bumpp": "10.4.1",
|
|
37
|
-
"oxlint": "1.
|
|
63
|
+
"oxlint": "1.85.0",
|
|
64
|
+
"oxlint-tsgolint": "7.0.2003",
|
|
65
|
+
"react": "19.3.0",
|
|
66
|
+
"tailwindcss": "4.3.3",
|
|
38
67
|
"typescript": "6.0.3",
|
|
39
|
-
"vitest": "4.1.9"
|
|
68
|
+
"vitest": "4.1.9",
|
|
69
|
+
"zod": "4.6.5"
|
|
40
70
|
},
|
|
41
71
|
"packageManager": "bun@1.3.14",
|
|
42
72
|
"license": "MIT",
|
|
@@ -57,5 +87,10 @@
|
|
|
57
87
|
"architecture",
|
|
58
88
|
"lint",
|
|
59
89
|
"plugin"
|
|
60
|
-
]
|
|
90
|
+
],
|
|
91
|
+
"peerDependenciesMeta": {
|
|
92
|
+
"oxlint-tsgolint": {
|
|
93
|
+
"optional": true
|
|
94
|
+
}
|
|
95
|
+
}
|
|
61
96
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Dillon Mulroy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Dillon Mulroy's anti-slop rules
|
|
2
|
+
|
|
3
|
+
Upstream: https://github.com/dmmulroy/anti-slop
|
|
4
|
+
|
|
5
|
+
Author: Dillon Mulroy. Licensed under MIT; see LICENSE in this directory.
|
|
6
|
+
|
|
7
|
+
These files were copied from the existing vendored rules in
|
|
8
|
+
`/Users/jon/projects/orbs/packages/tooling/src/oxlint/anti-slop`.
|
|
9
|
+
The original upstream revision of that copy has not been established. This is
|
|
10
|
+
not a fresh copy of upstream main and must not be described as one.
|
|
11
|
+
|
|
12
|
+
Local packaging changes rename the plugin namespace to `dillon-anti-slop`.
|
|
13
|
+
The TanStack preset selects the enabled rules; this directory implements them
|
|
14
|
+
and is not a separate preset. Upstream intentionally distributes source for
|
|
15
|
+
vendoring and does not publish an official npm package.
|
|
16
|
+
|
|
17
|
+
Local behavior fixes recognize `SAFETY:` comments on exported declarations and
|
|
18
|
+
export-default assertions, while retaining statement boundaries for other
|
|
19
|
+
assertions. Covered by `src/tests/safety-comment.test.ts` and preset fixtures.
|