@enhance-eng/archangel 0.2.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.
@@ -695,9 +695,12 @@
695
695
  },
696
696
  {
697
697
  "$ref": "#/definitions/namePattern"
698
+ },
699
+ {
700
+ "$ref": "#/definitions/nameList"
698
701
  }
699
702
  ],
700
- "description": "A style that the name, up to the first dot, must be in, or a name pattern that the full name, without the last extension, must match."
703
+ "description": "A style that the name, up to the first dot, must be in, or a name pattern that the full name, without the last extension, must match, or a list of them, of which one must match."
701
704
  }
702
705
  }
703
706
  },
@@ -753,9 +756,12 @@
753
756
  },
754
757
  {
755
758
  "$ref": "#/definitions/namePattern"
759
+ },
760
+ {
761
+ "$ref": "#/definitions/nameList"
756
762
  }
757
763
  ],
758
- "description": "A style that each folder's name must be in, or a name pattern that it must match, which may use `{FolderName}` for the folder that holds it."
764
+ "description": "A style that each folder's name must be in, or a name pattern that it must match, which may use `{FolderName}` for the folder that holds it, or a list of them, of which one must match."
759
765
  }
760
766
  }
761
767
  },
@@ -1433,7 +1439,22 @@
1433
1439
  "namePattern": {
1434
1440
  "type": "string",
1435
1441
  "minLength": 1,
1436
- "description": "A name: text, `*` for any text, and `{FileName}`, `{fileName}`, `{file-name}`, `{file_name}` or `{FILE_NAME}` for the file's name in each style, or the same spellings of `{FolderName}` for the name of the folder that holds it."
1442
+ "description": "A name: text, `*` for any text or no text, and `{FileName}`, `{fileName}`, `{file-name}`, `{file_name}` or `{FILE_NAME}` for the file's name in each style, or the same spellings of `{FolderName}` for the name of the folder that holds it."
1443
+ },
1444
+ "nameList": {
1445
+ "type": "array",
1446
+ "minItems": 1,
1447
+ "items": {
1448
+ "anyOf": [
1449
+ {
1450
+ "$ref": "#/definitions/style"
1451
+ },
1452
+ {
1453
+ "$ref": "#/definitions/namePattern"
1454
+ }
1455
+ ]
1456
+ },
1457
+ "description": "The names that a `mustBeNamed` rule permits. One entry must match."
1437
1458
  }
1438
1459
  },
1439
1460
  "anyOf": [
package/index.d.ts CHANGED
@@ -177,12 +177,15 @@ export interface ImportLimits {
177
177
  export type NameStyle = 'kebab-case' | 'camelCase' | 'PascalCase' | 'snake_case' | 'SCREAMING_SNAKE_CASE';
178
178
 
179
179
  /**
180
- * A name: text, `*` for any text, and `{FileName}`, `{fileName}`, `{file-name}`, `{file_name}` or
180
+ * A name: text, `*` for any text or no text, and `{FileName}`, `{fileName}`, `{file-name}`, `{file_name}` or
181
181
  * `{FILE_NAME}` for the file's name in each style, or the same spellings of `{FolderName}` for the
182
182
  * name of the folder that holds it.
183
183
  */
184
184
  export type NamePattern = string;
185
185
 
186
+ /** One name that a `mustBeNamed` rule permits: a style or a name pattern. */
187
+ export type NameEntry = NameStyle | (NamePattern & {});
188
+
186
189
  type Conditions<Other> = {
187
190
  /** The files may not import the other side. */
188
191
  readonly mayNotImport: Other;
@@ -192,9 +195,9 @@ type Conditions<Other> = {
192
195
  readonly mayOnlyBeImportedBy: Other;
193
196
  /**
194
197
  * The name, up to the first dot, is in a style, or the full name, without the last extension,
195
- * matches a name pattern.
198
+ * matches a name pattern. In a list, one entry must match.
196
199
  */
197
- readonly mustBeNamed: NameStyle | (NamePattern & {});
200
+ readonly mustBeNamed: NameEntry | readonly [NameEntry, ...NameEntry[]];
198
201
  /**
199
202
  * Each instance of `files`, an element with a capture, has a file that matches the pattern, or
200
203
  * one of the patterns.
@@ -311,6 +314,16 @@ export type ConditionName<P extends Plugins> = {
311
314
  : never;
312
315
  }[Extract<keyof P, string>];
313
316
 
317
+ /** The conditions of the `fsd` preset, which a config that extends it can use with its own files. */
318
+ export type FsdConditionName = `fsd/${
319
+ | 'typo-in-layer-name'
320
+ | 'ambiguous-slice-names'
321
+ | 'inconsistent-naming'
322
+ | 'insignificant-slice'
323
+ | 'repetitive-naming'
324
+ | 'excessive-slicing'
325
+ | 'shared-lib-grouping'}`;
326
+
314
327
  /** A rule that uses a plugin's condition, whose options the condition's schema checks. */
315
328
  export type PluginRule<E extends Elements, S extends Selectors, P extends Plugins> = Omit<
316
329
  CommonOptions,
@@ -320,7 +333,7 @@ export type PluginRule<E extends Elements, S extends Selectors, P extends Plugin
320
333
  /** The files whose records the condition sees. */
321
334
  readonly files: Files<E, S>;
322
335
  /** The condition, as `<plugin>/<condition>`. */
323
- readonly plugin: NoInfer<ConditionName<P>>;
336
+ readonly plugin: NoInfer<ConditionName<P>> | FsdConditionName;
324
337
  /** The options, which the condition's JSON Schema checks when the config loads. */
325
338
  readonly options?: unknown;
326
339
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enhance-eng/archangel",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Make architecture verifiable. Architecture tests for TypeScript, checked in milliseconds: imports, cycles, names, folder structure and exports.",
5
5
  "keywords": [
6
6
  "architecture",
@@ -53,13 +53,13 @@
53
53
  "pluralize": "8.0.0"
54
54
  },
55
55
  "optionalDependencies": {
56
- "@enhance-eng/archangel-darwin-arm64": "0.2.0",
57
- "@enhance-eng/archangel-darwin-x64": "0.2.0",
58
- "@enhance-eng/archangel-linux-arm64-gnu": "0.2.0",
59
- "@enhance-eng/archangel-linux-arm64-musl": "0.2.0",
60
- "@enhance-eng/archangel-linux-x64-gnu": "0.2.0",
61
- "@enhance-eng/archangel-linux-x64-musl": "0.2.0",
62
- "@enhance-eng/archangel-win32-x64": "0.2.0"
56
+ "@enhance-eng/archangel-darwin-arm64": "0.3.0",
57
+ "@enhance-eng/archangel-darwin-x64": "0.3.0",
58
+ "@enhance-eng/archangel-linux-arm64-gnu": "0.3.0",
59
+ "@enhance-eng/archangel-linux-arm64-musl": "0.3.0",
60
+ "@enhance-eng/archangel-linux-x64-gnu": "0.3.0",
61
+ "@enhance-eng/archangel-linux-x64-musl": "0.3.0",
62
+ "@enhance-eng/archangel-win32-x64": "0.3.0"
63
63
  },
64
64
  "tsd": {
65
65
  "compilerOptions": {