@comity-dev/eslint-plugin 0.3.0 → 0.3.1

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.
@@ -3,23 +3,40 @@
3
3
  *
4
4
  * Forbid imports that violate Comity's canonical layering policy.
5
5
  *
6
- * Disallowed edges (default):
7
- * - primitives → any @comity/*
8
- * - kernel → anything except primitives
9
- * - composition → anything except primitives, kernel
10
- * - core → adapters
11
- * - adapters → adapters (except integration-adapter → technology-adapter)
6
+ * The permitted edges per source layer are the table `LAYER_PROFILES` below. They follow
7
+ * ADR-025 §5 (formal package dependencies: Application → Technology Adapters → Core
8
+ * Modules → composition → kernel → primitives; every edge points downward), together with
9
+ * `layering-policy.md` §2 and `architecture-validation.md` §4.1:
12
10
  *
13
- * Technology adapters MAY import the core contract they implement
14
- * (declared via `implements` metadata).
11
+ * - primitives → no internal package
12
+ * - kernel → primitives
13
+ * (kernel → composition is forbidden, ADR-025 §5 "Forbidden")
14
+ * - composition → primitives, kernel
15
+ * (composition → any Core Module is forbidden, ADR-025 hard
16
+ * invariant)
17
+ * - core → primitives, kernel, composition, core
18
+ * (Core → Core is further gated by ADR-008, not by this rule)
19
+ * - technology-adapter → primitives, kernel, composition, and the Core Module it
20
+ * implements
21
+ * - integration-adapter → primitives, kernel, core, technology-adapter
15
22
  *
16
- * Allowed Core-to-Core edges are gated by ADR-008; this rule does NOT
17
- * evaluate that register (it is enforced separately by the dependency
18
- * rules / orchestrator). Use this rule only to catch the obvious violations.
23
+ * Technology Adapters MAY import the core contract they implement (declared via
24
+ * `implements` metadata).
25
+ *
26
+ * A source package whose layer has no profile (for example `dev-tooling`), and a target
27
+ * that is not in the supplied classification, are outside this rule's scope. The
28
+ * classification is data supplied by the consumer (ADR-026); this rule never exempts a
29
+ * layer: there is no option to remove one.
30
+ *
31
+ * Allowed Core-to-Core edges are gated by ADR-008; this rule does NOT evaluate that
32
+ * register (it is enforced separately by the dependency rules / orchestrator). The
33
+ * sibling generator `@comity-dev/dependency-rules` expresses the same layer policy for
34
+ * dependency-cruiser; see `architecture-validation.md` §4.1 for how the two relate.
19
35
  *
20
36
  * Standard references:
37
+ * - ADR-025 §5 (formal package dependencies)
21
38
  * - layering-policy.md §2 (canonical layering model)
22
- * - architecture-validation.md §7
39
+ * - architecture-validation.md §4.1, §7
23
40
  * - ADR-007 (adapter categories)
24
41
  */
25
42
  type Rule = unknown;
@@ -3,23 +3,40 @@
3
3
  *
4
4
  * Forbid imports that violate Comity's canonical layering policy.
5
5
  *
6
- * Disallowed edges (default):
7
- * - primitives → any @comity/*
8
- * - kernel → anything except primitives
9
- * - composition → anything except primitives, kernel
10
- * - core → adapters
11
- * - adapters → adapters (except integration-adapter → technology-adapter)
6
+ * The permitted edges per source layer are the table `LAYER_PROFILES` below. They follow
7
+ * ADR-025 §5 (formal package dependencies: Application → Technology Adapters → Core
8
+ * Modules → composition → kernel → primitives; every edge points downward), together with
9
+ * `layering-policy.md` §2 and `architecture-validation.md` §4.1:
12
10
  *
13
- * Technology adapters MAY import the core contract they implement
14
- * (declared via `implements` metadata).
11
+ * - primitives → no internal package
12
+ * - kernel → primitives
13
+ * (kernel → composition is forbidden, ADR-025 §5 "Forbidden")
14
+ * - composition → primitives, kernel
15
+ * (composition → any Core Module is forbidden, ADR-025 hard
16
+ * invariant)
17
+ * - core → primitives, kernel, composition, core
18
+ * (Core → Core is further gated by ADR-008, not by this rule)
19
+ * - technology-adapter → primitives, kernel, composition, and the Core Module it
20
+ * implements
21
+ * - integration-adapter → primitives, kernel, core, technology-adapter
15
22
  *
16
- * Allowed Core-to-Core edges are gated by ADR-008; this rule does NOT
17
- * evaluate that register (it is enforced separately by the dependency
18
- * rules / orchestrator). Use this rule only to catch the obvious violations.
23
+ * Technology Adapters MAY import the core contract they implement (declared via
24
+ * `implements` metadata).
25
+ *
26
+ * A source package whose layer has no profile (for example `dev-tooling`), and a target
27
+ * that is not in the supplied classification, are outside this rule's scope. The
28
+ * classification is data supplied by the consumer (ADR-026); this rule never exempts a
29
+ * layer: there is no option to remove one.
30
+ *
31
+ * Allowed Core-to-Core edges are gated by ADR-008; this rule does NOT evaluate that
32
+ * register (it is enforced separately by the dependency rules / orchestrator). The
33
+ * sibling generator `@comity-dev/dependency-rules` expresses the same layer policy for
34
+ * dependency-cruiser; see `architecture-validation.md` §4.1 for how the two relate.
19
35
  *
20
36
  * Standard references:
37
+ * - ADR-025 §5 (formal package dependencies)
21
38
  * - layering-policy.md §2 (canonical layering model)
22
- * - architecture-validation.md §7
39
+ * - architecture-validation.md §4.1, §7
23
40
  * - ADR-007 (adapter categories)
24
41
  */
25
42
  const messages = {
@@ -29,9 +46,9 @@ const LAYER_PROFILES = {
29
46
  primitives: { allowed: new Set() },
30
47
  kernel: { allowed: new Set(["primitives"]) },
31
48
  composition: { allowed: new Set(["primitives", "kernel"]) },
32
- core: { allowed: new Set(["primitives", "kernel", "core"]) },
49
+ core: { allowed: new Set(["primitives", "kernel", "composition", "core"]) },
33
50
  "technology-adapter": {
34
- allowed: new Set(["primitives", "kernel"]),
51
+ allowed: new Set(["primitives", "kernel", "composition"]),
35
52
  },
36
53
  "integration-adapter": {
37
54
  allowed: new Set(["primitives", "kernel", "core", "technology-adapter"]),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comity-dev/eslint-plugin",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Reusable ESLint rules for Comity source-code policy. Development tooling.",
5
5
  "type": "module",
6
6
  "private": false,
@@ -39,7 +39,7 @@
39
39
  "typescript": "^5.9.3"
40
40
  },
41
41
  "scripts": {
42
- "build": "tsc -p tsconfig.json",
42
+ "build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.json",
43
43
  "test": "vitest run"
44
44
  }
45
45
  }