oxlint-plugin-arch 0.13.1 → 0.13.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.
- package/CHANGELOG.md +40 -0
- package/README.md +6 -6
- package/dist/index.js +1411 -267
- package/dist/preset/groups/top.d.ts +2 -0
- package/dist/preset/preset-sets.d.ts +2 -0
- package/dist/preset/preset.constants.d.ts +0 -1
- package/dist/preset/preset.js +251 -41
- package/dist/preset/preset.utils.d.ts +1 -0
- package/dist/rules/code/code-inside.d.ts +1 -0
- package/dist/rules/effect/effect-layer-keys.d.ts +1 -0
- package/dist/rules/effect/effect-service-params.d.ts +1 -0
- package/dist/rules/effect/effect-yield-name.d.ts +1 -0
- package/dist/rules/effect/effect-yields-first.d.ts +1 -0
- package/dist/rules/files/files-siblings.d.ts +1 -0
- package/dist/rules/files/files-top-level.d.ts +1 -0
- package/dist/rules/naming/naming-imports.d.ts +1 -0
- package/dist/rules/naming/naming-keys.d.ts +1 -0
- package/dist/rules/naming/naming-labels.d.ts +1 -0
- package/dist/rules/naming/naming-pairs.d.ts +1 -0
- package/dist/types/boundaries.types.d.ts +7 -0
- package/dist/types/code.types.d.ts +11 -0
- package/dist/types/effect.types.d.ts +20 -0
- package/dist/types/files.types.d.ts +33 -3
- package/dist/types/naming.types.d.ts +70 -2
- package/dist/types/preset.types.d.ts +26 -0
- package/dist/utils/naming.utils.d.ts +4 -1
- package/dist/utils/options.utils.d.ts +1 -0
- package/dist/vendor/dillon-anti-slop/index.js +3 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { NamingCaptureOptions } from './naming.types.ts';
|
|
2
2
|
import type { OptionsPattern } from './options.types.ts';
|
|
3
3
|
import type { ESTree } from '@oxlint/plugins';
|
|
4
4
|
export interface FilesComponentsOnlyOptions {
|
|
@@ -24,8 +24,7 @@ export interface FilesDomainConstantsOptions {
|
|
|
24
24
|
roles?: string[];
|
|
25
25
|
file?: string;
|
|
26
26
|
}
|
|
27
|
-
export interface FilesExportsOptions extends
|
|
28
|
-
stem?: NamingStemMode | 'folder';
|
|
27
|
+
export interface FilesExportsOptions extends NamingCaptureOptions {
|
|
29
28
|
names?: string[];
|
|
30
29
|
patterns?: string[];
|
|
31
30
|
types?: boolean;
|
|
@@ -89,3 +88,34 @@ export interface FilesExternalsManifest {
|
|
|
89
88
|
dependencies?: Record<string, string>;
|
|
90
89
|
optionalDependencies?: Record<string, string>;
|
|
91
90
|
}
|
|
91
|
+
export type FilesTopLevelKind = 'import' | 'export' | 'reexport' | 'default' | 'type' | 'interface' | 'enum' | 'class' | 'namespace' | 'const' | 'let' | 'var' | 'function' | 'function-const' | 'call' | 'statement';
|
|
92
|
+
export interface FilesTopLevelEntry {
|
|
93
|
+
kind: FilesTopLevelKind | FilesTopLevelKind[];
|
|
94
|
+
names?: OptionsPattern;
|
|
95
|
+
from?: OptionsPattern;
|
|
96
|
+
exported?: boolean;
|
|
97
|
+
message?: string;
|
|
98
|
+
}
|
|
99
|
+
export interface FilesTopLevelOptions extends NamingCaptureOptions {
|
|
100
|
+
allow?: (string | FilesTopLevelEntry)[];
|
|
101
|
+
deny?: (string | FilesTopLevelEntry)[];
|
|
102
|
+
message?: string;
|
|
103
|
+
}
|
|
104
|
+
export interface FilesTopLevelItem {
|
|
105
|
+
kind: FilesTopLevelKind;
|
|
106
|
+
name: string;
|
|
107
|
+
from: string;
|
|
108
|
+
exported: boolean;
|
|
109
|
+
node: ESTree.Node;
|
|
110
|
+
}
|
|
111
|
+
export interface FilesTopLevelMatcher {
|
|
112
|
+
kinds: FilesTopLevelKind[];
|
|
113
|
+
names: RegExp[] | null;
|
|
114
|
+
from: RegExp[] | null;
|
|
115
|
+
exported?: boolean;
|
|
116
|
+
message: string;
|
|
117
|
+
}
|
|
118
|
+
export interface FilesSiblingsOptions {
|
|
119
|
+
require: OptionsPattern;
|
|
120
|
+
message?: string;
|
|
121
|
+
}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import type { DeclarationsKind } from './declarations.types.ts';
|
|
2
2
|
import type { OptionsPattern } from './options.types.ts';
|
|
3
3
|
export type NamingStemMode = 'before-first-dot' | 'full-basename';
|
|
4
|
+
export type NamingPrefixSource = 'file' | 'folder' | 'parent';
|
|
4
5
|
export interface NamingExportsStem {
|
|
5
6
|
stem?: NamingStemMode;
|
|
6
7
|
roles?: string[];
|
|
7
8
|
separators?: string[];
|
|
8
9
|
normalize?: 'remove-separators' | 'none';
|
|
9
10
|
singularize?: 'none' | 'trailing-s';
|
|
11
|
+
prefix?: NamingPrefixSource[];
|
|
12
|
+
}
|
|
13
|
+
export interface NamingCaptureOptions extends Pick<NamingExportsStem, 'roles' | 'separators' | 'singularize'> {
|
|
14
|
+
stem?: NamingStemMode | 'folder';
|
|
15
|
+
file?: string;
|
|
16
|
+
placeholder?: string;
|
|
10
17
|
}
|
|
11
18
|
export interface NamingDeclarationsOptions extends NamingExportsStem {
|
|
12
19
|
kinds?: DeclarationsKind[];
|
|
@@ -31,17 +38,19 @@ export interface NamingExportsPatternOptions extends NamingExportsBase {
|
|
|
31
38
|
export interface NamingExportsTemplateOptions extends NamingExportsBase {
|
|
32
39
|
mode: 'template';
|
|
33
40
|
file: string;
|
|
34
|
-
export: string;
|
|
41
|
+
export: string | string[];
|
|
35
42
|
match?: 'all' | 'some';
|
|
36
43
|
placeholder?: string;
|
|
37
44
|
camelCase?: boolean;
|
|
38
45
|
}
|
|
39
46
|
export type NamingExportsOptions = NamingExportsPrefixOptions | NamingExportsPatternOptions | NamingExportsTemplateOptions;
|
|
40
47
|
export interface NamingFileOptions {
|
|
41
|
-
pattern
|
|
48
|
+
pattern?: OptionsPattern;
|
|
42
49
|
message: string;
|
|
43
50
|
flags?: string;
|
|
44
51
|
unique?: string;
|
|
52
|
+
template?: OptionsPattern;
|
|
53
|
+
placeholder?: string;
|
|
45
54
|
}
|
|
46
55
|
export interface NamingFolderOptions {
|
|
47
56
|
singularize?: 'none' | 'trailing-s';
|
|
@@ -53,4 +62,63 @@ export interface NamingTypesOptions {
|
|
|
53
62
|
pattern?: OptionsPattern;
|
|
54
63
|
message?: string;
|
|
55
64
|
}
|
|
65
|
+
export interface NamingDeclarationsCheck {
|
|
66
|
+
kinds: Set<DeclarationsKind> | null;
|
|
67
|
+
allowed: RegExp[];
|
|
68
|
+
expected: RegExp[];
|
|
69
|
+
prefixes: string[];
|
|
70
|
+
label: string;
|
|
71
|
+
normalize: NamingExportsStem['normalize'];
|
|
72
|
+
}
|
|
73
|
+
export interface NamingImportsEntry {
|
|
74
|
+
source: string;
|
|
75
|
+
name: string | string[];
|
|
76
|
+
namespace?: boolean;
|
|
77
|
+
placeholder?: string;
|
|
78
|
+
}
|
|
79
|
+
export interface NamingImportsOptions {
|
|
80
|
+
imports: NamingImportsEntry[];
|
|
81
|
+
}
|
|
82
|
+
export interface NamingImportsCompiled {
|
|
83
|
+
pattern: RegExp;
|
|
84
|
+
names: string[];
|
|
85
|
+
namespace: boolean;
|
|
86
|
+
}
|
|
87
|
+
export interface NamingLabelsEntry {
|
|
88
|
+
callee: OptionsPattern;
|
|
89
|
+
property?: string;
|
|
90
|
+
name?: OptionsPattern;
|
|
91
|
+
pattern?: OptionsPattern;
|
|
92
|
+
drop?: OptionsPattern;
|
|
93
|
+
loose?: boolean;
|
|
94
|
+
within?: OptionsPattern;
|
|
95
|
+
}
|
|
96
|
+
export interface NamingLabelsOptions {
|
|
97
|
+
labels: NamingLabelsEntry[];
|
|
98
|
+
}
|
|
99
|
+
export interface NamingLabelsCompiled {
|
|
100
|
+
callees: RegExp[];
|
|
101
|
+
entry: NamingLabelsEntry;
|
|
102
|
+
drop: RegExp[];
|
|
103
|
+
patterns: string[];
|
|
104
|
+
within: RegExp[];
|
|
105
|
+
}
|
|
106
|
+
export interface NamingKeysOptions {
|
|
107
|
+
callees?: string[];
|
|
108
|
+
exports?: OptionsPattern;
|
|
109
|
+
name?: OptionsPattern;
|
|
110
|
+
keys?: OptionsPattern;
|
|
111
|
+
inline?: boolean;
|
|
112
|
+
delegate?: boolean;
|
|
113
|
+
allow?: OptionsPattern;
|
|
114
|
+
singularize?: 'none' | 'trailing-s';
|
|
115
|
+
}
|
|
116
|
+
export interface NamingPairsEntry {
|
|
117
|
+
methods: [string, string];
|
|
118
|
+
strip?: OptionsPattern;
|
|
119
|
+
allow?: OptionsPattern;
|
|
120
|
+
}
|
|
121
|
+
export interface NamingPairsOptions {
|
|
122
|
+
pairs: NamingPairsEntry[];
|
|
123
|
+
}
|
|
56
124
|
export {};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { BoundariesDenyOnly } from './boundaries.types.ts';
|
|
2
|
+
import type { FilesTopLevelEntry, FilesTopLevelOptions } from './files.types.ts';
|
|
1
3
|
import type { OptionsPattern } from './options.types.ts';
|
|
2
4
|
import type * as EffectTsgo from '@effect/tsgo/oxlint-presets';
|
|
3
5
|
import type * as EffectLinteffect from '@opsydyn/oxlint-effect';
|
|
@@ -38,6 +40,7 @@ export interface PresetNamingOptions {
|
|
|
38
40
|
exports?: boolean | string;
|
|
39
41
|
folders?: boolean;
|
|
40
42
|
unique?: string;
|
|
43
|
+
imports?: Record<string, string | string[] | false>;
|
|
41
44
|
}
|
|
42
45
|
export interface PresetCommentsOptions {
|
|
43
46
|
directives?: boolean;
|
|
@@ -110,6 +113,15 @@ export interface PresetBackendOptions {
|
|
|
110
113
|
export interface PresetDenyOptions {
|
|
111
114
|
imports?: Record<string, string | false>;
|
|
112
115
|
calls?: Record<string, string | false>;
|
|
116
|
+
only?: PresetDenyOnly[];
|
|
117
|
+
}
|
|
118
|
+
export interface PresetDenyOnly extends BoundariesDenyOnly {
|
|
119
|
+
each?: string;
|
|
120
|
+
}
|
|
121
|
+
export type PresetSet = string[] | Record<string, string>;
|
|
122
|
+
export type PresetSetValue = string | number | boolean | null | undefined | PresetSetValue[] | PresetSetObject;
|
|
123
|
+
export interface PresetSetObject {
|
|
124
|
+
[key: string]: PresetSetValue;
|
|
113
125
|
}
|
|
114
126
|
export interface PresetOrpcOptions {
|
|
115
127
|
public?: string[];
|
|
@@ -121,6 +133,12 @@ export interface PresetEffectOptions {
|
|
|
121
133
|
exports?: OptionsPattern;
|
|
122
134
|
skip?: OptionsPattern;
|
|
123
135
|
entries?: string[];
|
|
136
|
+
files?: string[];
|
|
137
|
+
strict?: boolean;
|
|
138
|
+
}
|
|
139
|
+
export interface PresetEffectContract {
|
|
140
|
+
name: string;
|
|
141
|
+
source: string;
|
|
124
142
|
}
|
|
125
143
|
export interface PresetEffectStyle {
|
|
126
144
|
rules: PresetRules;
|
|
@@ -155,6 +173,7 @@ export interface PresetGroups {
|
|
|
155
173
|
effect?: PresetSwitch | PresetEffectOptions;
|
|
156
174
|
console?: boolean;
|
|
157
175
|
deny?: PresetSwitch | PresetDenyOptions;
|
|
176
|
+
top?: PresetSwitch | FilesTopLevelOptions | (string | FilesTopLevelEntry)[];
|
|
158
177
|
externals?: PresetSwitch;
|
|
159
178
|
}
|
|
160
179
|
export type PresetGroupName = keyof PresetGroups;
|
|
@@ -170,6 +189,7 @@ export interface PresetConfig {
|
|
|
170
189
|
root?: string;
|
|
171
190
|
folders?: PresetFolders;
|
|
172
191
|
detect?: boolean;
|
|
192
|
+
sets?: Record<string, PresetSet>;
|
|
173
193
|
}
|
|
174
194
|
export type PresetRecipe = PresetGroups & Partial<Record<symbol, string>>;
|
|
175
195
|
export type PresetRules = NonNullable<OxlintConfig['rules']>;
|
|
@@ -204,11 +224,17 @@ export interface PresetResolvedGroups {
|
|
|
204
224
|
code: boolean;
|
|
205
225
|
width: number;
|
|
206
226
|
entries: string[];
|
|
227
|
+
files: string[];
|
|
228
|
+
strict: boolean;
|
|
207
229
|
};
|
|
208
230
|
console: PresetEmptyOptions;
|
|
209
231
|
deny: {
|
|
210
232
|
imports: Record<string, string | false>;
|
|
211
233
|
calls: Record<string, string | false>;
|
|
234
|
+
only: BoundariesDenyOnly[];
|
|
235
|
+
};
|
|
236
|
+
top: {
|
|
237
|
+
[K in keyof Required<FilesTopLevelOptions>]: FilesTopLevelOptions[K] | undefined;
|
|
212
238
|
};
|
|
213
239
|
externals: PresetEmptyOptions;
|
|
214
240
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NamingExportsStem, NamingStemMode } from '../types/naming.types.ts';
|
|
1
|
+
import type { NamingCaptureOptions, NamingExportsStem, NamingStemMode } from '../types/naming.types.ts';
|
|
2
2
|
import type { OptionsSchemaProperties } from '../types/options.types.ts';
|
|
3
3
|
export declare const namingStemModes: readonly NamingStemMode[];
|
|
4
4
|
export declare const namingStemSchemaProperties: OptionsSchemaProperties;
|
|
@@ -8,4 +8,7 @@ export declare function namingCamelCase(value: string): string;
|
|
|
8
8
|
export declare function namingNormalized(value: string, normalize: 'remove-separators' | 'none'): string;
|
|
9
9
|
export declare function namingFileStem(basename: string, mode?: NamingStemMode, trailingRoles?: readonly string[], roleSeparators?: readonly string[]): string;
|
|
10
10
|
export declare function namingFilePrefixesFor(filename: string, options: NamingExportsStem): string[];
|
|
11
|
+
export declare function namingTemplatePattern(template: string, placeholder?: string): RegExp | null;
|
|
12
|
+
export declare function namingCaptures(filename: string, options?: NamingCaptureOptions): Record<string, string> | null;
|
|
13
|
+
export declare function namingExpand(template: string, captures: Record<string, string>, camelCase: boolean, escape?: (value: string) => string): string;
|
|
11
14
|
export declare function namingHasFilePrefix(name: string, prefixes: readonly string[], normalize: NamingExportsStem['normalize']): boolean;
|
|
@@ -10,3 +10,4 @@ export declare function optionsGlob(pattern: string): RegExp;
|
|
|
10
10
|
export declare function optionsPatternLabel(pattern: OptionsPattern | undefined): string;
|
|
11
11
|
export declare function optionsAssertMockingApis(patterns: string[]): void;
|
|
12
12
|
export declare function optionsEscape(value: string): string;
|
|
13
|
+
export declare function optionsWildcards(names: OptionsPattern | undefined): RegExp[];
|
|
@@ -155,6 +155,9 @@ function optionsAssertMockingApis(patterns) {
|
|
|
155
155
|
function optionsEscape(value) {
|
|
156
156
|
return value.replaceAll(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
157
157
|
}
|
|
158
|
+
function optionsWildcards(names) {
|
|
159
|
+
return [names ?? []].flat().map((name) => new RegExp(`^${name.split("*").map(optionsEscape).join(".*")}$`));
|
|
160
|
+
}
|
|
158
161
|
|
|
159
162
|
// src/utils/ast.utils.ts
|
|
160
163
|
var astSkippedKeys = new Set(["parent", "type", "start", "end", "range", "loc", "tokens", "comments"]);
|