@noctcore/eslint-plugin-architecture 0.1.0 → 0.3.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/README.md +9 -2
- package/dist/index.cjs +1024 -30
- package/dist/index.d.cts +77 -0
- package/dist/index.d.ts +77 -0
- package/dist/index.js +1024 -30
- package/docs/rules/barrel-purity.md +57 -0
- package/docs/rules/colocated-test-required.md +48 -0
- package/docs/rules/filename-matches-export.md +56 -0
- package/docs/rules/max-import-depth.md +52 -0
- package/docs/rules/single-semantic-module.md +180 -0
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
|
|
2
2
|
|
|
3
|
+
declare const SEMANTIC_CATEGORIES: readonly ["type", "constant", "function", "class", "react-component", "hook", "schema", "enum"];
|
|
4
|
+
type SemanticCategory = (typeof SEMANTIC_CATEGORIES)[number];
|
|
5
|
+
type EnumCategory = Extract<SemanticCategory, 'enum' | 'type'>;
|
|
6
|
+
type SchemaLibrary = 'zod' | 'yup' | 'valibot';
|
|
7
|
+
interface SingleSemanticModuleOptions {
|
|
8
|
+
/** Category sets a module may mix, e.g. `[['constant', 'type', 'enum']]`. */
|
|
9
|
+
readonly allow?: readonly (readonly SemanticCategory[])[];
|
|
10
|
+
/** Whether a TS `enum` is its own category or counts as `type`. */
|
|
11
|
+
readonly enumCategory?: EnumCategory;
|
|
12
|
+
/** List every classified declaration and why in the report. */
|
|
13
|
+
readonly debug?: boolean;
|
|
14
|
+
/** Skip `declare ...` and `declare global` blocks entirely. */
|
|
15
|
+
readonly ignoreAmbientDeclarations?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Only the exported surface defines a module's semantics: a non-exported
|
|
18
|
+
* render helper, config object or class serves that surface and is not
|
|
19
|
+
* classified. Default true.
|
|
20
|
+
*/
|
|
21
|
+
readonly ignorePrivateDeclarations?: boolean;
|
|
22
|
+
readonly schemaLibraries?: readonly SchemaLibrary[];
|
|
23
|
+
readonly reactComponentDetection?: {
|
|
24
|
+
readonly enabled?: boolean;
|
|
25
|
+
};
|
|
26
|
+
readonly hookDetection?: {
|
|
27
|
+
readonly enabled?: boolean;
|
|
28
|
+
readonly namePattern?: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
3
32
|
interface NoCrossFeatureImportsOptions {
|
|
4
33
|
readonly featureRoot?: string;
|
|
5
34
|
readonly alias?: string;
|
|
@@ -7,27 +36,60 @@ interface NoCrossFeatureImportsOptions {
|
|
|
7
36
|
readonly allowTypeImports?: boolean;
|
|
8
37
|
}
|
|
9
38
|
|
|
39
|
+
interface MaxImportDepthOptions {
|
|
40
|
+
readonly max?: number;
|
|
41
|
+
readonly alias?: Readonly<Record<string, string>>;
|
|
42
|
+
}
|
|
43
|
+
|
|
10
44
|
interface IndexMustReexportDefaultOptions {
|
|
11
45
|
readonly ignorePaths?: readonly string[];
|
|
12
46
|
}
|
|
13
47
|
|
|
48
|
+
interface FilenameMatchesExportOptions {
|
|
49
|
+
readonly ignore?: readonly string[];
|
|
50
|
+
}
|
|
51
|
+
|
|
14
52
|
interface ComponentFolderStructureOptions {
|
|
15
53
|
readonly componentRoot?: string;
|
|
16
54
|
readonly requiredSiblings?: readonly string[];
|
|
17
55
|
readonly ignorePaths?: readonly string[];
|
|
18
56
|
}
|
|
19
57
|
|
|
58
|
+
interface ColocatedTestRequiredOptions {
|
|
59
|
+
readonly include?: readonly string[];
|
|
60
|
+
readonly ignore?: readonly string[];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
interface BarrelPurityOptions {
|
|
64
|
+
readonly allow?: readonly string[];
|
|
65
|
+
}
|
|
66
|
+
|
|
20
67
|
/** Every rule this plugin exposes, keyed by its (unprefixed) rule id. */
|
|
21
68
|
declare const rules: {
|
|
69
|
+
'barrel-purity': _typescript_eslint_utils_ts_eslint.RuleModule<"impureBarrel", [BarrelPurityOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
70
|
+
name: string;
|
|
71
|
+
};
|
|
72
|
+
'colocated-test-required': _typescript_eslint_utils_ts_eslint.RuleModule<"missingTest", [ColocatedTestRequiredOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
73
|
+
name: string;
|
|
74
|
+
};
|
|
22
75
|
'component-folder-structure': _typescript_eslint_utils_ts_eslint.RuleModule<"missingSiblings", [ComponentFolderStructureOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
23
76
|
name: string;
|
|
24
77
|
};
|
|
78
|
+
'filename-matches-export': _typescript_eslint_utils_ts_eslint.RuleModule<"filenameMismatch" | "renameExport", [FilenameMatchesExportOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
79
|
+
name: string;
|
|
80
|
+
};
|
|
25
81
|
'index-must-reexport-default': _typescript_eslint_utils_ts_eslint.RuleModule<"missingDefaultReexport", [IndexMustReexportDefaultOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
26
82
|
name: string;
|
|
27
83
|
};
|
|
84
|
+
'max-import-depth': _typescript_eslint_utils_ts_eslint.RuleModule<"tooDeep", [MaxImportDepthOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
85
|
+
name: string;
|
|
86
|
+
};
|
|
28
87
|
'no-cross-feature-imports': _typescript_eslint_utils_ts_eslint.RuleModule<"crossFeatureImport", [NoCrossFeatureImportsOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
29
88
|
name: string;
|
|
30
89
|
};
|
|
90
|
+
'single-semantic-module': _typescript_eslint_utils_ts_eslint.RuleModule<"mixedSemanticCategories", [SingleSemanticModuleOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
91
|
+
name: string;
|
|
92
|
+
};
|
|
31
93
|
};
|
|
32
94
|
|
|
33
95
|
declare const plugin: {
|
|
@@ -36,15 +98,30 @@ declare const plugin: {
|
|
|
36
98
|
version: string;
|
|
37
99
|
};
|
|
38
100
|
rules: {
|
|
101
|
+
'barrel-purity': _typescript_eslint_utils_ts_eslint.RuleModule<"impureBarrel", [BarrelPurityOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
102
|
+
name: string;
|
|
103
|
+
};
|
|
104
|
+
'colocated-test-required': _typescript_eslint_utils_ts_eslint.RuleModule<"missingTest", [ColocatedTestRequiredOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
105
|
+
name: string;
|
|
106
|
+
};
|
|
39
107
|
'component-folder-structure': _typescript_eslint_utils_ts_eslint.RuleModule<"missingSiblings", [ComponentFolderStructureOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
40
108
|
name: string;
|
|
41
109
|
};
|
|
110
|
+
'filename-matches-export': _typescript_eslint_utils_ts_eslint.RuleModule<"filenameMismatch" | "renameExport", [FilenameMatchesExportOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
111
|
+
name: string;
|
|
112
|
+
};
|
|
42
113
|
'index-must-reexport-default': _typescript_eslint_utils_ts_eslint.RuleModule<"missingDefaultReexport", [IndexMustReexportDefaultOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
43
114
|
name: string;
|
|
44
115
|
};
|
|
116
|
+
'max-import-depth': _typescript_eslint_utils_ts_eslint.RuleModule<"tooDeep", [MaxImportDepthOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
117
|
+
name: string;
|
|
118
|
+
};
|
|
45
119
|
'no-cross-feature-imports': _typescript_eslint_utils_ts_eslint.RuleModule<"crossFeatureImport", [NoCrossFeatureImportsOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
46
120
|
name: string;
|
|
47
121
|
};
|
|
122
|
+
'single-semantic-module': _typescript_eslint_utils_ts_eslint.RuleModule<"mixedSemanticCategories", [SingleSemanticModuleOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
123
|
+
name: string;
|
|
124
|
+
};
|
|
48
125
|
};
|
|
49
126
|
configs: Record<string, unknown>;
|
|
50
127
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
|
|
2
2
|
|
|
3
|
+
declare const SEMANTIC_CATEGORIES: readonly ["type", "constant", "function", "class", "react-component", "hook", "schema", "enum"];
|
|
4
|
+
type SemanticCategory = (typeof SEMANTIC_CATEGORIES)[number];
|
|
5
|
+
type EnumCategory = Extract<SemanticCategory, 'enum' | 'type'>;
|
|
6
|
+
type SchemaLibrary = 'zod' | 'yup' | 'valibot';
|
|
7
|
+
interface SingleSemanticModuleOptions {
|
|
8
|
+
/** Category sets a module may mix, e.g. `[['constant', 'type', 'enum']]`. */
|
|
9
|
+
readonly allow?: readonly (readonly SemanticCategory[])[];
|
|
10
|
+
/** Whether a TS `enum` is its own category or counts as `type`. */
|
|
11
|
+
readonly enumCategory?: EnumCategory;
|
|
12
|
+
/** List every classified declaration and why in the report. */
|
|
13
|
+
readonly debug?: boolean;
|
|
14
|
+
/** Skip `declare ...` and `declare global` blocks entirely. */
|
|
15
|
+
readonly ignoreAmbientDeclarations?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Only the exported surface defines a module's semantics: a non-exported
|
|
18
|
+
* render helper, config object or class serves that surface and is not
|
|
19
|
+
* classified. Default true.
|
|
20
|
+
*/
|
|
21
|
+
readonly ignorePrivateDeclarations?: boolean;
|
|
22
|
+
readonly schemaLibraries?: readonly SchemaLibrary[];
|
|
23
|
+
readonly reactComponentDetection?: {
|
|
24
|
+
readonly enabled?: boolean;
|
|
25
|
+
};
|
|
26
|
+
readonly hookDetection?: {
|
|
27
|
+
readonly enabled?: boolean;
|
|
28
|
+
readonly namePattern?: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
3
32
|
interface NoCrossFeatureImportsOptions {
|
|
4
33
|
readonly featureRoot?: string;
|
|
5
34
|
readonly alias?: string;
|
|
@@ -7,27 +36,60 @@ interface NoCrossFeatureImportsOptions {
|
|
|
7
36
|
readonly allowTypeImports?: boolean;
|
|
8
37
|
}
|
|
9
38
|
|
|
39
|
+
interface MaxImportDepthOptions {
|
|
40
|
+
readonly max?: number;
|
|
41
|
+
readonly alias?: Readonly<Record<string, string>>;
|
|
42
|
+
}
|
|
43
|
+
|
|
10
44
|
interface IndexMustReexportDefaultOptions {
|
|
11
45
|
readonly ignorePaths?: readonly string[];
|
|
12
46
|
}
|
|
13
47
|
|
|
48
|
+
interface FilenameMatchesExportOptions {
|
|
49
|
+
readonly ignore?: readonly string[];
|
|
50
|
+
}
|
|
51
|
+
|
|
14
52
|
interface ComponentFolderStructureOptions {
|
|
15
53
|
readonly componentRoot?: string;
|
|
16
54
|
readonly requiredSiblings?: readonly string[];
|
|
17
55
|
readonly ignorePaths?: readonly string[];
|
|
18
56
|
}
|
|
19
57
|
|
|
58
|
+
interface ColocatedTestRequiredOptions {
|
|
59
|
+
readonly include?: readonly string[];
|
|
60
|
+
readonly ignore?: readonly string[];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
interface BarrelPurityOptions {
|
|
64
|
+
readonly allow?: readonly string[];
|
|
65
|
+
}
|
|
66
|
+
|
|
20
67
|
/** Every rule this plugin exposes, keyed by its (unprefixed) rule id. */
|
|
21
68
|
declare const rules: {
|
|
69
|
+
'barrel-purity': _typescript_eslint_utils_ts_eslint.RuleModule<"impureBarrel", [BarrelPurityOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
70
|
+
name: string;
|
|
71
|
+
};
|
|
72
|
+
'colocated-test-required': _typescript_eslint_utils_ts_eslint.RuleModule<"missingTest", [ColocatedTestRequiredOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
73
|
+
name: string;
|
|
74
|
+
};
|
|
22
75
|
'component-folder-structure': _typescript_eslint_utils_ts_eslint.RuleModule<"missingSiblings", [ComponentFolderStructureOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
23
76
|
name: string;
|
|
24
77
|
};
|
|
78
|
+
'filename-matches-export': _typescript_eslint_utils_ts_eslint.RuleModule<"filenameMismatch" | "renameExport", [FilenameMatchesExportOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
79
|
+
name: string;
|
|
80
|
+
};
|
|
25
81
|
'index-must-reexport-default': _typescript_eslint_utils_ts_eslint.RuleModule<"missingDefaultReexport", [IndexMustReexportDefaultOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
26
82
|
name: string;
|
|
27
83
|
};
|
|
84
|
+
'max-import-depth': _typescript_eslint_utils_ts_eslint.RuleModule<"tooDeep", [MaxImportDepthOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
85
|
+
name: string;
|
|
86
|
+
};
|
|
28
87
|
'no-cross-feature-imports': _typescript_eslint_utils_ts_eslint.RuleModule<"crossFeatureImport", [NoCrossFeatureImportsOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
29
88
|
name: string;
|
|
30
89
|
};
|
|
90
|
+
'single-semantic-module': _typescript_eslint_utils_ts_eslint.RuleModule<"mixedSemanticCategories", [SingleSemanticModuleOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
91
|
+
name: string;
|
|
92
|
+
};
|
|
31
93
|
};
|
|
32
94
|
|
|
33
95
|
declare const plugin: {
|
|
@@ -36,15 +98,30 @@ declare const plugin: {
|
|
|
36
98
|
version: string;
|
|
37
99
|
};
|
|
38
100
|
rules: {
|
|
101
|
+
'barrel-purity': _typescript_eslint_utils_ts_eslint.RuleModule<"impureBarrel", [BarrelPurityOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
102
|
+
name: string;
|
|
103
|
+
};
|
|
104
|
+
'colocated-test-required': _typescript_eslint_utils_ts_eslint.RuleModule<"missingTest", [ColocatedTestRequiredOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
105
|
+
name: string;
|
|
106
|
+
};
|
|
39
107
|
'component-folder-structure': _typescript_eslint_utils_ts_eslint.RuleModule<"missingSiblings", [ComponentFolderStructureOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
40
108
|
name: string;
|
|
41
109
|
};
|
|
110
|
+
'filename-matches-export': _typescript_eslint_utils_ts_eslint.RuleModule<"filenameMismatch" | "renameExport", [FilenameMatchesExportOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
111
|
+
name: string;
|
|
112
|
+
};
|
|
42
113
|
'index-must-reexport-default': _typescript_eslint_utils_ts_eslint.RuleModule<"missingDefaultReexport", [IndexMustReexportDefaultOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
43
114
|
name: string;
|
|
44
115
|
};
|
|
116
|
+
'max-import-depth': _typescript_eslint_utils_ts_eslint.RuleModule<"tooDeep", [MaxImportDepthOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
117
|
+
name: string;
|
|
118
|
+
};
|
|
45
119
|
'no-cross-feature-imports': _typescript_eslint_utils_ts_eslint.RuleModule<"crossFeatureImport", [NoCrossFeatureImportsOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
46
120
|
name: string;
|
|
47
121
|
};
|
|
122
|
+
'single-semantic-module': _typescript_eslint_utils_ts_eslint.RuleModule<"mixedSemanticCategories", [SingleSemanticModuleOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
123
|
+
name: string;
|
|
124
|
+
};
|
|
48
125
|
};
|
|
49
126
|
configs: Record<string, unknown>;
|
|
50
127
|
};
|