@morriconeluca/eslint-plugin-faf 0.5.0 → 0.6.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/dist/main.d.cts CHANGED
@@ -1,52 +1,361 @@
1
- import * as eslint from 'eslint';
2
- import { ESLint, Linter } from 'eslint';
1
+ import { Rule, Linter } from 'eslint';
2
+
3
+ declare function createConformity(packageVersion: string): Rule.RuleModule;
3
4
 
4
5
  /**
5
- * Custom type definition for the ESLint Fractal Architecture Framework (FAF) plugin.
6
- * Omits and refines the native ESLint Plugin configs to strictly enforce Flat Configuration types
7
- * compatible with ESLint v9 and v10.
6
+ * Common configuration declarations shared across all fractal trees.
8
7
  */
9
- type TFafPlugin = Omit<ESLint.Plugin, 'configs'> & {
10
- configs: {
8
+ type TFAFCommonConfig = TFAFSharedConfig & {
9
+ /**
10
+ * Map of path alias prefixes to base target directories within codebase.
11
+ */
12
+ readonly aliases?: Readonly<Record<string, string>>;
13
+ /**
14
+ * Root fragment origins must be declared exclusively in local configurations.
15
+ */
16
+ readonly rootFragments?: never;
17
+ /**
18
+ * Root layer origins must be declared exclusively in local configurations.
19
+ */
20
+ readonly rootLayers?: never;
21
+ };
22
+ /**
23
+ * Root configuration object exported as default from fafconfig.ts.
24
+ *
25
+ * @example
26
+ * import type { TFAFConfig } from '@morriconeluca/eslint-plugin-faf';
27
+ *
28
+ * export default {
29
+ * faf: {
30
+ * locals: [
31
+ * {
32
+ * rootLayers: ['src'],
33
+ * },
34
+ * ],
35
+ * },
36
+ * } satisfies TFAFConfig;
37
+ */
38
+ type TFAFConfig = {
39
+ /**
40
+ * Architectural declarations governing fractal trees across the codebase.
41
+ */
42
+ readonly faf: {
11
43
  /**
12
- * Recommended FAF preset. Enables all FAF architecture constraints as blocking errors.
44
+ * Shared declarations inherited or overridden property-by-property in locals.
45
+ *
46
+ * @default {} Defaults to an empty shared configuration.
13
47
  */
14
- recommended: Linter.Config;
48
+ readonly common?: TFAFCommonConfig;
49
+ /**
50
+ * Architectural configurations for individual trees via designated origins.
51
+ */
52
+ readonly locals: TFAFNonEmptyArray<TFAFLocalConfig>;
15
53
  };
16
54
  };
17
-
18
55
  /**
19
- * Predefined configuration presets exposed by the FAF ESLint plugin.
20
- * Includes the recommended flat configuration preset that registers the plugin
21
- * and activates all taxonomy and dependency rules as blocking "error" diagnostics.
56
+ * Authorized egress dependency from internal logical nodes to external local modules.
22
57
  */
23
- declare const configs: TFafPlugin['configs'];
24
-
58
+ type TFAFExternalDependency = {
59
+ /**
60
+ * POSIX paths of internal logical node files permitted to import external modules.
61
+ */
62
+ readonly from: TFAFNonEmptyArray<string>;
63
+ /**
64
+ * POSIX paths of modular local files residing outside all fractal trees.
65
+ */
66
+ readonly to: TFAFNonEmptyArray<string>;
67
+ };
68
+ /**
69
+ * Family of foreign nodes matching path patterns within designated tree scopes.
70
+ */
71
+ type TFAFForeignNodeFamily = {
72
+ /**
73
+ * Directory scopes relative to configuration file where patterns apply.
74
+ */
75
+ readonly paths: TFAFNonEmptyArray<string>;
76
+ /**
77
+ * Case-sensitive file matching patterns applied within the designated paths.
78
+ *
79
+ * @example ['*.md']
80
+ */
81
+ readonly patterns: TFAFNonEmptyArray<string>;
82
+ };
83
+ /**
84
+ * Tiered hierarchy where each non-empty group occupies the positional rank
85
+ * matching its index starting from zero. Only strictly descending dependencies
86
+ * are authorized. Duplicate names require validator rejection. The outer array
87
+ * may be empty, but internal tiers must contain at least one item.
88
+ */
89
+ type TFAFHierarchy = readonly TFAFNonEmptyArray<string>[];
25
90
  /**
26
- * Mapping of FAF rule identifiers to their respective ESLint rule modules.
27
- * All rules are namespaced under 'faf/*' when consumed in configurations.
28
- */
29
- declare const rules: {
30
- readonly 'category-mutually-exclusive': eslint.Rule.RuleModule;
31
- readonly 'enforce-access-node': eslint.Rule.RuleModule;
32
- readonly 'foreign-domain-isolation': eslint.Rule.RuleModule;
33
- readonly 'fragment-master-node': eslint.Rule.RuleModule;
34
- readonly 'logical-domain-placement': eslint.Rule.RuleModule;
35
- readonly 'naming-conventions': eslint.Rule.RuleModule;
36
- readonly 'no-direct-fragment-import': eslint.Rule.RuleModule;
37
- readonly 'no-fractal-branch-leak': eslint.Rule.RuleModule;
38
- readonly 'no-peer-dependency': eslint.Rule.RuleModule;
39
- readonly 'no-private-category-leak': eslint.Rule.RuleModule;
40
- readonly 'root-node-dependency-direction': eslint.Rule.RuleModule;
91
+ * Local configuration defining one or more fractal trees via root origins.
92
+ */
93
+ type TFAFLocalConfig = TFAFSharedConfig & ({
94
+ /**
95
+ * Non-empty array of apical root fragment origins.
96
+ */
97
+ readonly rootFragments: TFAFNonEmptyArray<TFAFRootFragment>;
98
+ } | {
99
+ /**
100
+ * Non-empty array of root layer origin paths.
101
+ */
102
+ readonly rootLayers: TFAFNonEmptyArray<string>;
103
+ }) & {
104
+ /**
105
+ * Path aliases must be declared exclusively in the common configuration.
106
+ */
107
+ readonly aliases?: never;
108
+ /**
109
+ * Apical root fragments originating distinct fractal trees.
110
+ */
111
+ readonly rootFragments?: readonly TFAFRootFragment[];
112
+ /**
113
+ * Origin directory paths designated as root layers for fractal trees.
114
+ */
115
+ readonly rootLayers?: readonly string[];
41
116
  };
42
-
43
117
  /**
44
- * Default export representing the ESLint plugin for the Fractal Architecture Framework (FAF).
45
- * Assembles configs, rules, and package metadata.
46
- *
47
- * Exposes rules and configs both as named exports (for backward compatibility/direct consumption)
48
- * and within the default plugin export container.
118
+ * Local horizontal hierarchy applied exclusively to designated parent directories.
119
+ */
120
+ type TFAFLocalHorizontalHierarchy = {
121
+ /**
122
+ * Tiered ordering applied to direct children of designated parent directories.
123
+ */
124
+ readonly hierarchies: TFAFHierarchy;
125
+ /**
126
+ * Parent directory paths relative to configuration file where ordering applies.
127
+ */
128
+ readonly paths: TFAFNonEmptyArray<string>;
129
+ };
130
+ /**
131
+ * Mimetic path structure mapping an external hierarchical address space.
132
+ */
133
+ type TFAFMimeticPathStructure = {
134
+ /**
135
+ * Closed catalog of action verbs recognized as prefixes in path fragments.
136
+ */
137
+ readonly actions?: TFAFNonEmptyArray<string>;
138
+ /**
139
+ * POSIX paths of parent categories hosting the mimetic path structure.
140
+ */
141
+ readonly paths: TFAFNonEmptyArray<string>;
142
+ };
143
+ /**
144
+ * Non-empty readonly array containing at least one element of type T.
49
145
  */
146
+ type TFAFNonEmptyArray<T> = readonly [T, ...T[]];
147
+ /**
148
+ * Role definition for standard architectural responsibilities. The presence
149
+ * of implicit extensions enforces category-nodes form and statically forbids
150
+ * setting isCategoryNode to false.
151
+ */
152
+ type TFAFRole = {
153
+ /**
154
+ * Enables multiple symbols within logical nodes bearing this explicit role.
155
+ * Never waives the master node uniqueness law or re-export prohibition.
156
+ *
157
+ * @default false
158
+ */
159
+ readonly allowMultipleSymbols?: boolean;
160
+ /**
161
+ * Exact category directory name, including the leading underscore.
162
+ */
163
+ readonly category: string;
164
+ /**
165
+ * File extensions with leading dot associated with this implicit role.
166
+ *
167
+ * @example ['.png', '.jpg', '.svg']
168
+ */
169
+ readonly implicitRoleExtensions?: TFAFNonEmptyArray<string>;
170
+ /**
171
+ * Indicates whether classified units are category nodes instead of fragments.
172
+ */
173
+ readonly isCategoryNode?: boolean;
174
+ /**
175
+ * Exact and unique name of the role within the catalog.
176
+ */
177
+ readonly name: string;
178
+ } & ({
179
+ /**
180
+ * Implicit role extensions associated with this role.
181
+ */
182
+ readonly implicitRoleExtensions: TFAFNonEmptyArray<string>;
183
+ /**
184
+ * Category nodes form must be true when implicit extensions are provided.
185
+ */
186
+ readonly isCategoryNode?: true;
187
+ } | {
188
+ /**
189
+ * Implicit role extensions must not be defined in this variant.
190
+ */
191
+ readonly implicitRoleExtensions?: never;
192
+ });
193
+ /**
194
+ * Ordered catalog of roles determining internal fragment node ranks.
195
+ * Each entry is either a single role or a non-empty group of roles sharing rank.
196
+ */
197
+ type TFAFRoles = readonly (TFAFNonEmptyArray<TFAFRole> | TFAFRole)[];
198
+ /**
199
+ * Authorization for directed dependencies between root nodes across root fragments.
200
+ */
201
+ type TFAFRootDependencyEdge = {
202
+ /**
203
+ * File names of source root nodes within the enclosing root fragment.
204
+ */
205
+ readonly from: TFAFNonEmptyArray<string>;
206
+ /**
207
+ * POSIX paths of target root nodes in other root fragments of the same tree.
208
+ */
209
+ readonly to: TFAFNonEmptyArray<string>;
210
+ };
211
+ /**
212
+ * Boundary root fragment declaring root nodes, child root fragments, and edges.
213
+ */
214
+ type TFAFRootFragment = {
215
+ /**
216
+ * Inter-root-fragment authorizations towards root nodes in other root fragments.
217
+ *
218
+ * @default [] Defaults to an empty list.
219
+ */
220
+ readonly dependencyEdges?: readonly TFAFRootDependencyEdge[];
221
+ /**
222
+ * POSIX path of the root fragment directory relative to the config file.
223
+ */
224
+ readonly path: string;
225
+ /**
226
+ * Exhaustive enumeration of direct boundary files, arranged into tiered levels.
227
+ */
228
+ readonly rootNodes: TFAFHierarchy;
229
+ /**
230
+ * Directly nested descendant boundaries within the same tree.
231
+ *
232
+ * @default [] Defaults to an empty list.
233
+ */
234
+ readonly subRootFragments?: readonly TFAFRootFragment[];
235
+ };
236
+ /**
237
+ * Declarations shareable between global common settings and local configurations.
238
+ */
239
+ type TFAFSharedConfig = {
240
+ /**
241
+ * Specific authorizations granting internal units permission to import external local modules.
242
+ *
243
+ * @default [] Defaults to an empty list.
244
+ */
245
+ readonly externalDependencies?: readonly TFAFExternalDependency[];
246
+ /**
247
+ * Folder locations excluded from the dependency graph and architecture rules.
248
+ *
249
+ * @default [] Defaults to an empty list.
250
+ */
251
+ readonly foreignDomains?: readonly string[];
252
+ /**
253
+ * Specific file paths or glob matching definitions excluded from architecture norms.
254
+ *
255
+ * @default [] Defaults to an empty list.
256
+ */
257
+ readonly foreignNodes?: readonly (string | TFAFForeignNodeFamily)[];
258
+ /**
259
+ * Default descending rank specifications applied across matching sibling directories.
260
+ *
261
+ * @default [] Defaults to an empty list.
262
+ */
263
+ readonly horizontalHierarchies?: readonly TFAFHierarchy[];
264
+ /**
265
+ * Targeted descending rank definitions bound to explicit folder locations.
266
+ *
267
+ * @default [] Defaults to an empty list.
268
+ */
269
+ readonly localHorizontalHierarchies?: readonly TFAFLocalHorizontalHierarchy[];
270
+ /**
271
+ * Designated organizational folders mirroring external HTTP or command address spaces.
272
+ *
273
+ * @default [] Defaults to an empty list.
274
+ */
275
+ readonly mimeticPathStructures?: readonly TFAFMimeticPathStructure[];
276
+ /**
277
+ * Exposed entry files accessible to external consumers across boundary frontiers.
278
+ *
279
+ * @default [] Defaults to an empty list.
280
+ */
281
+ readonly publicRootNodes?: readonly string[];
282
+ /**
283
+ * Ordered catalog of architectural roles and internal fragment hierarchies.
284
+ */
285
+ readonly roles?: TFAFRoles;
286
+ /**
287
+ * Specialized responsibilities reserved for entry files in test and auxiliary sub-graphs.
288
+ *
289
+ * @default [] Defaults to an empty list.
290
+ */
291
+ readonly subGraphRoles?: readonly TFAFSubGraphRole[];
292
+ /**
293
+ * Explicit unidirectional access grants between separate architectural trees.
294
+ *
295
+ * @default [] Defaults to an empty list.
296
+ */
297
+ readonly treeDependencies?: readonly TFAFTreeDependency[];
298
+ };
299
+ /**
300
+ * Dedicated role reserved for entry points into isolated execution sub-graphs.
301
+ */
302
+ type TFAFSubGraphRole = {
303
+ /**
304
+ * Unique name of the sub-graph role, disjoint from standard roles.
305
+ */
306
+ readonly name: string;
307
+ };
308
+ /**
309
+ * Authorized directed dependency relation between distinct fractal trees.
310
+ */
311
+ type TFAFTreeDependency = {
312
+ /**
313
+ * Origin paths of source fractal trees initiating the dependency.
314
+ */
315
+ readonly from: TFAFNonEmptyArray<string>;
316
+ /**
317
+ * Origin paths of target fractal trees exposing their public surface.
318
+ */
319
+ readonly to: TFAFNonEmptyArray<string>;
320
+ };
321
+
322
+ type TFafPlugin = {
323
+ configs: {
324
+ recommended: Linter.Config & {
325
+ plugins: {
326
+ readonly faf: TFafPlugin;
327
+ };
328
+ };
329
+ };
330
+ meta: {
331
+ readonly name: string;
332
+ readonly namespace: 'faf';
333
+ readonly version: string;
334
+ };
335
+ rules: {
336
+ conformity: ReturnType<typeof createConformity>;
337
+ };
338
+ };
50
339
  declare const plugin: TFafPlugin;
51
340
 
52
- export { configs, plugin as default, rules };
341
+ declare namespace plugin {
342
+ export type {
343
+ TFAFCommonConfig,
344
+ TFAFConfig,
345
+ TFAFExternalDependency,
346
+ TFAFForeignNodeFamily,
347
+ TFAFHierarchy,
348
+ TFAFLocalConfig,
349
+ TFAFLocalHorizontalHierarchy,
350
+ TFAFMimeticPathStructure,
351
+ TFAFNonEmptyArray,
352
+ TFAFRole,
353
+ TFAFRoles,
354
+ TFAFRootDependencyEdge,
355
+ TFAFRootFragment,
356
+ TFAFSharedConfig,
357
+ TFAFSubGraphRole,
358
+ TFAFTreeDependency
359
+ };
360
+ }
361
+ export = plugin;