@starci/eslint-canon-be 1.0.0 → 1.0.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.
- package/README.md +69 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# @starci/eslint-canon-be
|
|
2
|
+
|
|
3
|
+
**37 ESLint rules, from 15 laws, that hold a NestJS-shaped back end to one way of being written.**
|
|
4
|
+
|
|
5
|
+
Not a style pack. These rules enforce *architecture*: which layer may import which, whether a
|
|
6
|
+
failure carries its own identity, where a query is allowed to be built, what an end-to-end test is
|
|
7
|
+
permitted to assume. Prettier decides how code looks; this decides what it is allowed to be.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm i -D @starci/eslint-canon-be
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Use it
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import starciBe, { recommended } from "@starci/eslint-canon-be"
|
|
17
|
+
|
|
18
|
+
export default [
|
|
19
|
+
// …your own ignores, language options and other plugins…
|
|
20
|
+
{
|
|
21
|
+
files: ["src/**/*.ts"],
|
|
22
|
+
plugins: { "starci-be": starciBe },
|
|
23
|
+
rules: recommended,
|
|
24
|
+
},
|
|
25
|
+
]
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Which globs the law applies to is your repository's fact. What the law says is not — so there is no
|
|
29
|
+
option to switch a rule off or lower it to a warning.
|
|
30
|
+
|
|
31
|
+
Also exported: `rules`, `ruleOwners`, `lawOwners`.
|
|
32
|
+
|
|
33
|
+
## What it actually catches
|
|
34
|
+
|
|
35
|
+
A sample, not the list:
|
|
36
|
+
|
|
37
|
+
| Area | What the rules hold |
|
|
38
|
+
|---|---|
|
|
39
|
+
| **Exceptions** | Every failure throws a domain exception carrying its own identity and metadata — never a bare `Error`, never a framework built-in, never an exception declared outside the exceptions folder |
|
|
40
|
+
| **CQRS** | A handler does not assemble an aggregate inline; reads and writes do not share one path |
|
|
41
|
+
| **Module layering** | An import that climbs a layer it was not given is a build failure, not a review comment |
|
|
42
|
+
| **Data access** | Queries stay where the layer says they may be built |
|
|
43
|
+
| **Transport** | The wire shape is declared, not inferred from whatever a handler happened to return |
|
|
44
|
+
| **Observability** | A failure is logged as a typed exception, so a log line can be traced to the law that names it |
|
|
45
|
+
| **End-to-end flows** | One file, one flow, named steps, and **never sleep** — poll until the state settles, with a deadline |
|
|
46
|
+
| **CDC · event delivery** | Projections and events follow the declared delivery contract |
|
|
47
|
+
| **Comments · naming · type safety** | Comments say why; no double cast through `unknown` |
|
|
48
|
+
|
|
49
|
+
Every rule names the law that declares it — `ruleOwners` maps rule name to law, so a failing build
|
|
50
|
+
line leads straight to the document that explains why.
|
|
51
|
+
|
|
52
|
+
## Companion
|
|
53
|
+
|
|
54
|
+
- **[@starci/eslint-canon-fe](https://www.npmjs.com/package/@starci/eslint-canon-fe)** — the
|
|
55
|
+
front-end half: 58 rules from 16 laws covering component tiers, structure contracts, the
|
|
56
|
+
fetch/draw split, vendor boundaries and the design-token scale.
|
|
57
|
+
|
|
58
|
+
## Where the laws live
|
|
59
|
+
|
|
60
|
+
Each rule is the enforceable half of a written law. The prose — why the rule exists, what it
|
|
61
|
+
refuses, which cases sit just outside it — is published openly at
|
|
62
|
+
[starci183/starci-claude-skills](https://github.com/starci183/starci-claude-skills).
|
|
63
|
+
|
|
64
|
+
A rule that cannot be pointed at in real code is a proposal, not a law. Everything here is
|
|
65
|
+
pointed at.
|
|
66
|
+
|
|
67
|
+
## Requirements
|
|
68
|
+
|
|
69
|
+
ESLint 9+ (flat config), Node 20.9+.
|
package/package.json
CHANGED