@activatus/code-standards 3.3.0 → 3.3.2
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 +27 -3
- package/docs/Guides/migrating.md +6 -6
- package/docs/Guides/regression-checks.md +18 -3
- package/docs/Guides/setup.md +29 -19
- package/docs/Standards/documentation.md +1 -0
- package/docs/Standards/eslint.md +9 -9
- package/docs/Standards/prettier.md +5 -1
- package/docs/Standards/readable-code.md +2 -2
- package/docs/Structure/folder-structure.md +65 -24
- package/docs/templates.mdx +14 -0
- package/docs/version-history.md +72 -9
- package/package.json +1 -1
- package/scripts/verifyStandards/checkComponents.mjs +2 -0
- package/scripts/verifyStandards/checkConstants.mjs +22 -48
- package/scripts/verifyStandards/checkStructure.mjs +45 -5
- package/scripts/verifyStandards/formatReport.mjs +1 -1
- package/scripts/verifyStandards/projectFiles.mjs +1 -46
- package/scripts/verifyStandards/recordedExceptions.mjs +176 -0
- package/scripts/verifyStandards/runChecks.mjs +23 -5
- package/static/templates/.prettierignore +7 -0
- package/static/templates/AGENTS.md +5 -4
- package/static/templates/docs/development/coding-standards.md +2 -2
- package/static/templates/eslint/base/eslint.config.mjs +2 -2
- package/static/templates/eslint/nextjs/eslint.config.mjs +2 -2
- package/static/templates/eslint/react/eslint.config.mjs +2 -2
- package/static/templates/eslint/typescript/eslint.config.mjs +2 -2
- package/static/templates/tests/visual/playwright.config.mjs +5 -3
package/README.md
CHANGED
|
@@ -32,9 +32,9 @@ pnpm add -D @activatus/code-standards@latest
|
|
|
32
32
|
|
|
33
33
|
Then tell your agent: **"Follow the Activatus Code Standards. Start with `node_modules/@activatus/code-standards/docs/Guides/setup.md`."** It prints a numbered list of the standards, you say which ones you don't want, and it sets up the rest. You never touch the terminal.
|
|
34
34
|
|
|
35
|
-
The package version is the standards version
|
|
35
|
+
The package version is the standards version, and a project records it in full, such as `3.3.2`, so the agent always knows where the project's up to.
|
|
36
36
|
|
|
37
|
-
> 🔢 **Updating a project to newer standards?** Run `pnpm add -D @activatus/code-standards@latest`, then point the agent at the **[Version History](https://activatus-code-standards.vercel.app/docs/version-history)**: it reads only the
|
|
37
|
+
> 🔢 **Updating a project to newer standards?** Run `pnpm add -D @activatus/code-standards@latest`, then point the agent at the **[Version History](https://activatus-code-standards.vercel.app/docs/version-history)**: it reads only the entries newer than the project's version, does exactly what each one says, and records the new version. Cheaper than shouting the whole pub a round.
|
|
38
38
|
|
|
39
39
|
---
|
|
40
40
|
|
|
@@ -97,6 +97,7 @@ The full detail's on the site. This is the version you'd tell someone over a sch
|
|
|
97
97
|
- 📦 **One parameter per function.** Need more? Pass an object, so the call explains itself.
|
|
98
98
|
- 🚪 **Return early.** Deal with the dodgy cases up top instead of nesting four `if`s deep like a set of Russian dolls.
|
|
99
99
|
- 🔢 **No magic numbers.** `MAXIMUM_RETRY_ATTEMPTS`, not a random `3` sitting there like it owns the place.
|
|
100
|
+
- 🗃️ **Links go in `r`, words people see go in `s`.** Everything else sits at the top of the file that uses it until something else needs it too. Not sure where a value goes? The agent parks it in `unsortedValues.ts` and asks you at the end, instead of stopping the job to have a yarn about it.
|
|
100
101
|
- 🏷️ **Type names end in `Props` or `Type`.** So you can tell what you're looking at.
|
|
101
102
|
- 💬 **Comments explain why, not what.** And no commented-out code. Git remembers, you don't have to.
|
|
102
103
|
|
|
@@ -116,6 +117,28 @@ The full detail's on the site. This is the version you'd tell someone over a sch
|
|
|
116
117
|
|
|
117
118
|
- 🧭 **Branches, commit messages, Pull Requests and whether AI agents may commit are up to each project.** Every team runs its work differently, so it goes in the project's own `AGENTS.md` and docs, not here. These standards are the base for the code itself.
|
|
118
119
|
|
|
120
|
+
### 🚦 Status circles
|
|
121
|
+
|
|
122
|
+
Setup asks if you want them. Say yes, and the agent reports every ticket or piece of work as one line, with a circle that tells you at a glance whether you need to lift a finger:
|
|
123
|
+
|
|
124
|
+
| Circle | Means |
|
|
125
|
+
| ------ | ---------------------------------------------------------------------------- |
|
|
126
|
+
| ✅ | Merged, in UAT or done. Nothing to do |
|
|
127
|
+
| 🟢 | Pull Request ready for you to review and merge. The link is the Pull Request |
|
|
128
|
+
| 🟣 | The agent's working on it |
|
|
129
|
+
| 🟡 | Done and checked, but not committed yet. You commit it, or tell the agent to |
|
|
130
|
+
| 🟠 | Waiting on another ticket or Pull Request first |
|
|
131
|
+
| 🔴 | Blocked, or you need to do something. It says what |
|
|
132
|
+
| ⚪ | Not started |
|
|
133
|
+
|
|
134
|
+
A line looks like this:
|
|
135
|
+
|
|
136
|
+
```text
|
|
137
|
+
🟢 ACT-12 Short title: #19
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
The ticket ID links to the ticket and the number links to the Pull Request. Only what you need to act on makes the list: no essay about what it did while you were at smoko. Full detail in [Working with Agents](https://activatus-code-standards.vercel.app/docs/Standards/working-with-agents#status-circles).
|
|
141
|
+
|
|
119
142
|
### 📦 Third-party code
|
|
120
143
|
|
|
121
144
|
- 📦 **Third-party code is exempt.** Anything in `node_modules/` or `vendor/` isn't ours. Don't lint it, don't tidy it, leave it be.
|
|
@@ -144,6 +167,7 @@ static/templates/
|
|
|
144
167
|
├── eslint/ # 🚨 Four flavours: base, typescript, react, nextjs
|
|
145
168
|
├── stylelint/ # 💅 CSS and SCSS
|
|
146
169
|
├── prettier.config.mjs # ✨ Formatting
|
|
170
|
+
├── .prettierignore # 🙈 What Prettier leaves alone
|
|
147
171
|
├── globals.css # 🎨 Tailwind + starter colour palette
|
|
148
172
|
├── .editorconfig # ⌨️ Editor whitespace rules
|
|
149
173
|
└── .nvmrc / .envrc # 🟢 Node version switching
|
|
@@ -180,7 +204,7 @@ Reckon a rule's wrong, or there's one missing? Good. Standards that never change
|
|
|
180
204
|
1. 🌿 **Branch off `main`**, named after the ticket (`ACT-14-update-eslint-page`), or `type/short-description` if there's no ticket (`docs/update-eslint-page`).
|
|
181
205
|
2. 📝 **Edit or add a Markdown file in `docs/`.** Name it in kebab-case (`naming-conventions.md`, not `namingConventions.md`), because the file name becomes the page's URL. Yes, we follow our own rules here.
|
|
182
206
|
3. 📋 **Changing a config?** Edit the file in `static/templates/` and the matching page in `docs/Standards/` so the two don't drift apart. For an ESLint config, run `pnpm check:eslint-templates`: it lints each config against itself and fails if the ESLint page shows an old copy. Add `--update-docs` to copy the configs onto the page.
|
|
183
|
-
4. 🔢 **Add a version** to `docs/version-history.md`: what changed, and what a project has to do about it. Bump
|
|
207
|
+
4. 🔢 **Add a version** to `docs/version-history.md`: what changed, and what a project has to do about it. Bump `package.json` to match: the first number when most projects rework most of their code, the middle when files move, the last when only the inside of files changes. See [How versions are numbered](https://activatus-code-standards.vercel.app/docs/version-history#how-versions-are-numbered). Publish it to npm (npmjs.com) once it's merged. We use pnpm for everything, so that's `pnpm publish`, which lands in the same npm registry as `npm publish`. Projects read only the new versions, so if it's not in there, nobody hears about it.
|
|
184
208
|
5. 🔨 **Run `pnpm build`.** It fails on broken links, so you'll know quick smart if you've stuffed one.
|
|
185
209
|
6. 🚀 **Open a pull request** and say why the change makes life better.
|
|
186
210
|
|
package/docs/Guides/migrating.md
CHANGED
|
@@ -50,7 +50,7 @@ The standards apply to **code we write**, not to packages we pull in. Do not lin
|
|
|
50
50
|
|
|
51
51
|
## Stage 0 — Regression check
|
|
52
52
|
|
|
53
|
-
Optional, and recommended when Stages 4 to 6 will move a lot of code. Set up the [regression check](/docs/Guides/regression-checks) and take its baseline from the **live production site
|
|
53
|
+
Optional, and recommended when Stages 4 to 6 will move a lot of code. Set up the [regression check](/docs/Guides/regression-checks) and take its baseline from the **last known-good page**, before anything changes: the live production site, or the branch's last commit before the migration when its page has already changed from production. Record which. Every later stage must pass it unchanged.
|
|
54
54
|
|
|
55
55
|
**Take the baseline first, then move one kind of thing at a time.** The constants moves (Stage 4) and the folder moves (Stage 5a) are separate steps, each followed by a full regression run. When a run fails, only one kind of move can have caused it.
|
|
56
56
|
|
|
@@ -179,16 +179,16 @@ node node_modules/@activatus/code-standards/scripts/renameSymbol.mjs --list rena
|
|
|
179
179
|
|
|
180
180
|
## Stage 4 — Constants
|
|
181
181
|
|
|
182
|
-
Applies setup standard 12.1. Move every link into `r
|
|
182
|
+
Applies setup standard 12.1. Move every link into `r` and every piece of text people see or hear into `s`, in `lib/constants/`. Every other value stays with the code that uses it until more than one file needs it; a shared value moves to the file in `lib/constants/` that fits. See [Constants](/docs/Structure/folder-structure#constants).
|
|
183
183
|
|
|
184
184
|
- **Move the values, nothing else.** The page must look and work exactly as before.
|
|
185
|
-
- **
|
|
186
|
-
- **Move animation and artwork objects whole.** Never pull their numbers out into `numbers.ts`.
|
|
187
|
-
- **Where each value goes is the project's call.** Read the [Constants table](/docs/Structure/folder-structure#constants) and decide.
|
|
185
|
+
- **A value one file uses moves to the top of that file.** A component's own constants file is folded into the files that use it, or into `lib/constants/` for the values more than one file shares.
|
|
186
|
+
- **Move animation and artwork objects whole.** Never pull their numbers out into `numbers.ts`.
|
|
187
|
+
- **Where each value goes is the project's call.** Read the [Constants table](/docs/Structure/folder-structure#constants) and decide. When it is not clear, put the value in `lib/constants/unsortedValues.ts`, carry on, and ask the person at the end of the stage: see [When it is not clear where a value goes](/docs/Structure/folder-structure#unsorted-values).
|
|
188
188
|
- **An id moves into the object that uses it.** **CSS written as a string moves to `globals.css`**, never into a constants file. A media query the code reads stays in its object in `animation.ts`.
|
|
189
189
|
- **Only text people see or hear goes in `s`.** Internal strings, such as ids, keys and log messages, stay where they are used: a key in the object that uses them, or a named constant at the top of the file.
|
|
190
190
|
- **A list of items with links** keeps its words in `s` and its links in `r` under the same keys, and a loop looks each one up by its key: see [the example](/docs/Structure/folder-structure#a-list-of-items-with-links). Delete any separate lookup object that maps a key to its link.
|
|
191
|
-
- **Every constant except `r` and `s` gets a real type from `lib/types/`**, never `as const`. Move the types it uses there too. `lib/types/` reads a constant's type with `import type` straight from its file. See [Types for constants](/docs/Structure/folder-structure#types-for-constants).
|
|
191
|
+
- **Every object and list constant in `lib/constants/` except `r` and `s` gets a real type from `lib/types/`**, never `as const`. A constant at the top of the file that uses it is typed from that file's own `.types.ts`. A single number or string needs none. Move the types it uses there too. `lib/types/` reads a constant's type with `import type` straight from its file. See [Types for constants](/docs/Structure/folder-structure#types-for-constants).
|
|
192
192
|
|
|
193
193
|
## Stage 5 — Components
|
|
194
194
|
|
|
@@ -44,13 +44,19 @@ So every run sees the same thing, the page clock is frozen and moved on by hand,
|
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
4. **Freeze the test files.** Add `tests/visual/` to `.prettierignore`, and add this line to the project's `AGENTS.md`, outside the code standards section: "Never edit `tests/visual/` or update its baseline without the person's yes."
|
|
47
|
-
5. **Take the baseline from the live production site
|
|
47
|
+
5. **Take the baseline before the refactor starts, from the last known-good page.** That is the live production site, unless the branch's page has already changed from production for another reason, such as a redesign not yet live. Then it is the branch's last commit before the refactor: build that commit in a separate worktree, serve it, and point the baseline at it.
|
|
48
48
|
|
|
49
49
|
```bash
|
|
50
|
+
# From production
|
|
50
51
|
VISUAL_PRODUCTION_URL=https://example.com pnpm test:visual:update
|
|
52
|
+
|
|
53
|
+
# From the last commit before the refactor: build and serve it in its
|
|
54
|
+
# own worktree, then point the baseline at it
|
|
55
|
+
git worktree add ../before-refactor <commit>
|
|
56
|
+
VISUAL_PRODUCTION_URL=http://localhost:3200 pnpm test:visual:update
|
|
51
57
|
```
|
|
52
58
|
|
|
53
|
-
Commit `tests/visual/baseline
|
|
59
|
+
Commit `tests/visual/baseline/`, and **record where it came from** in `docs/testing/regression.md`: the production URL, or the commit and the date.
|
|
54
60
|
|
|
55
61
|
## Running it
|
|
56
62
|
|
|
@@ -62,12 +68,21 @@ It builds the project and starts the production build on port 3100, then measure
|
|
|
62
68
|
|
|
63
69
|
## Rules
|
|
64
70
|
|
|
65
|
-
- **The baseline comes from the
|
|
71
|
+
- **The baseline comes from the last known-good page**, never from the branch being tested: the live production site, or the branch's last commit before the refactor when its page has already changed from production. A baseline taken from the branch under test would only prove the branch matches itself.
|
|
66
72
|
- **It runs against a production build**, on its own port, never against `pnpm dev`.
|
|
67
73
|
- **An agent never updates the baseline without the person's yes.** A failing check means something visible changed. Find out what, and fix the code. Updating the baseline to make it pass hides the change.
|
|
68
74
|
- **The test files are frozen** for the whole refactor: an agent never edits them to make a check pass.
|
|
75
|
+
- **Record a check only after it has run.** `docs/testing/regression.md` says what was decided, and gets the baseline's source and each result only once they exist. Never write a URL, commit, date or "passed" for a check that has not happened yet.
|
|
69
76
|
- **A code standards update that changes only types may still be applied to a frozen test**, such as replacing `as const` with a real type, with the person's yes. A copy of the template takes the new template whole; a project's own test takes just the typing change. Nothing the test does may change, and the check must still pass against the **existing** baseline, never a new one: passing proves nothing changed.
|
|
70
77
|
|
|
78
|
+
## Comparing two local servers instead
|
|
79
|
+
|
|
80
|
+
A project that skips Playwright can still compare the page before and after: run the last known-good commit and the branch side by side, each with `next dev` on its own port, and compare their rendered HTML or screenshots.
|
|
81
|
+
|
|
82
|
+
- **Export the old commit to its own folder**, such as with `git worktree add ../before-refactor <commit>`.
|
|
83
|
+
- **Copy `node_modules` into it. Never symlink it.** Turbopack refuses a `node_modules` that points outside the project folder. On macOS, `cp -Rc node_modules ../before-refactor/` makes a copy-on-write clone in seconds that takes almost no extra disk space.
|
|
84
|
+
- **Record what was compared, and the result, only once it has run**, the same as the Playwright check.
|
|
85
|
+
|
|
71
86
|
## The blind spot
|
|
72
87
|
|
|
73
88
|
**A frozen clock only samples fixed moments.** The check measures each scroll stop after moving the clock on by the same amount every time. A change to the timing between those moments, such as an animation that now runs slower but ends in the same place, passes. When a refactor touches animation timing, check those parts by eye as well.
|
package/docs/Guides/setup.md
CHANGED
|
@@ -37,10 +37,13 @@ minimumReleaseAgeExclude:
|
|
|
37
37
|
|
|
38
38
|
Newer pnpm versions may add this exclusion for you when you run `pnpm add`. Check the file either way, and add it if it is not there: an update hits the same check when a new version of the standards has only just been published. The entry is the plain package name, with no version. If pnpm wrote one with versions in it, such as `'@activatus/code-standards@3.0.4 || 3.0.5'`, replace it with the plain name: otherwise pnpm adds another version to it on every update.
|
|
39
39
|
|
|
40
|
-
**pnpm owns `pnpm-workspace.yaml
|
|
40
|
+
**Copy `static/templates/.prettierignore`** to the project root, or add its lines to the project's own. pnpm owns `pnpm-workspace.yaml` and rewrites it on every install, with single quotes, so `pnpm format:check` would fail after every update. `AGENTS.md` and the agent skills are copied from the standards and compared word for word by the [standards check](#checking-a-project), so Prettier must leave them alone too:
|
|
41
41
|
|
|
42
42
|
```text title=".prettierignore"
|
|
43
43
|
pnpm-workspace.yaml
|
|
44
|
+
AGENTS.md
|
|
45
|
+
.agents/skills/
|
|
46
|
+
.claude/commands/
|
|
44
47
|
```
|
|
45
48
|
|
|
46
49
|
The standards are now in `node_modules/@activatus/code-standards/`:
|
|
@@ -83,8 +86,8 @@ Tell me the numbers to skip or change, or say "all good".
|
|
|
83
86
|
10. Node version set by .nvmrc and direnv
|
|
84
87
|
11. Styling: Tailwind, flexbox first, colours only from the global palette
|
|
85
88
|
12. Folder structure: folders at the project root; reusable helper functions in utils/ (no business rules, no outside calls)
|
|
86
|
-
12.1. Constants: r for every link
|
|
87
|
-
13. Components live where they are used: components/ui/, components/shared/, or beside their page
|
|
89
|
+
12.1. Constants: r for every link and s for every piece of text, in lib/constants/; other values stay with the code that uses them until they are shared
|
|
90
|
+
13. Components live where they are used: components/ui/, components/layout/, components/shared/, or beside their page
|
|
88
91
|
14. Component files in a fixed order, with index.ts exports, and server and client code in separate files
|
|
89
92
|
15. Design System Components: every project builds the standard components with the same props
|
|
90
93
|
16. Imports: no circular imports, import from folders not files
|
|
@@ -113,7 +116,14 @@ Then wait for the answer.
|
|
|
113
116
|
| "Change 7: we use Biome for formatting" | Apply 7 as they describe it |
|
|
114
117
|
| Something unclear | Ask. Do not guess |
|
|
115
118
|
|
|
116
|
-
**Record the answer** in `docs/development/coding-standards.md`, under "Details". For each skipped or changed standard, write its number
|
|
119
|
+
**Record the answer** in `docs/development/coding-standards.md`, under "Details". For each skipped or changed standard, write one line with its number and name from the list, then what is different and the reason the person gave. An exception that covers only some files names them, in backticks, after `for`:
|
|
120
|
+
|
|
121
|
+
```text
|
|
122
|
+
- 7. Prettier — skipped: the project uses Biome for formatting (2026-10-23).
|
|
123
|
+
- 4. Every function and component has a test file — changed for `app/api/**`: legacy routes, tested when each is replaced (2026-10-27).
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**Every path after `for` goes in backticks**: a `for` with none fails the check, because it would otherwise cover every file. **Start no other line under "Details" with a number.** The [standards check](#checking-a-project) reads a line that starts with a number as an exception to that standard, and fails on one it cannot read. Use bullet points for anything else. If nothing is different, write "No differences". Copy the file from `static/templates/docs/development/coding-standards.md` if it does not exist.
|
|
117
127
|
|
|
118
128
|
The list has nothing about branches or commit messages. Those are the project's own workflow. Ask the person how they work, and write it in the "Project workflow" section of `AGENTS.md`. See [Project workflow](/docs/Standards/agent-specs#project-workflow).
|
|
119
129
|
|
|
@@ -165,17 +175,17 @@ Do only the standards the person agreed to. Copy every file from `node_modules/@
|
|
|
165
175
|
|
|
166
176
|
**An existing project with code already in it** also needs its code brought up to the standards. Do that with [Migrating an Existing Project](/docs/Guides/migrating), one stage at a time, after the config files below are in place.
|
|
167
177
|
|
|
168
|
-
| Standard | What to set up
|
|
169
|
-
| ------------------------ |
|
|
170
|
-
| 6. ESLint | Copy the config for the project's framework from `static/templates/eslint/`: `base`, `typescript`, `react` or `nextjs`, and copy `static/templates/eslint.overrides.mjs` beside it. Install the packages listed on the [ESLint page](/docs/Standards/eslint). Add the scripts `"lint": "eslint ."` and `"lint:fix": "eslint . --fix"`
|
|
171
|
-
| 7. Prettier | `pnpm add -D prettier prettier-plugin-tailwindcss`. Copy `static/templates/prettier.config.mjs`. Add the `format` and `format:check` scripts exactly as on the [Prettier page](/docs/Standards/prettier#usage)
|
|
172
|
-
| 8. Stylelint | Only if the project has hand-written CSS or SCSS. Copy the config from `static/templates/stylelint/css/` or `scss/`. See [Stylelint](/docs/Standards/stylelint)
|
|
173
|
-
| 9. EditorConfig | Copy `static/templates/.editorconfig`
|
|
174
|
-
| 10. Node version | Copy `static/templates/.nvmrc` and `static/templates/.envrc`. See [direnv + nvm](/docs/Standards/direnv)
|
|
175
|
-
| 11. Styling | Copy `static/templates/globals.css` to `app/globals.css`. Ask the person for the project's colours, and replace the example palette
|
|
176
|
-
| 12.1. Constants | Create `lib/constants/` with `routes.ts` (`r`), `strings.ts` (`s`)
|
|
177
|
-
| 18. Docs | Copy `static/templates/docs/` to `docs/` and `static/templates/docsSite/` to `docsSite/`. Add the `/docs` route from `static/templates/next.config.mjs`. See [Setting it up](/docs/Standards/documentation#-setting-it-up)
|
|
178
|
-
| 21. AGENTS.md and skills | Copy `static/templates/AGENTS.md` to the project root and fill in every `[placeholder]`. If the framework wrote its own `AGENTS.md` (Next.js does), keep any instruction it gives about reading the framework's own docs. Copy `static/templates/skills/` into `.agents/skills/`, and again into `.claude/commands/`. Add the `standards:check` script: see [Checking a project](#checking-a-project)
|
|
178
|
+
| Standard | What to set up |
|
|
179
|
+
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
180
|
+
| 6. ESLint | Copy the config for the project's framework from `static/templates/eslint/`: `base`, `typescript`, `react` or `nextjs`, and copy `static/templates/eslint.overrides.mjs` beside it. Install the packages listed on the [ESLint page](/docs/Standards/eslint). Add the scripts `"lint": "eslint ."` and `"lint:fix": "eslint . --fix"` |
|
|
181
|
+
| 7. Prettier | `pnpm add -D prettier prettier-plugin-tailwindcss`. Copy `static/templates/prettier.config.mjs`. Add the `format` and `format:check` scripts exactly as on the [Prettier page](/docs/Standards/prettier#usage) |
|
|
182
|
+
| 8. Stylelint | Only if the project has hand-written CSS or SCSS. Copy the config from `static/templates/stylelint/css/` or `scss/`. See [Stylelint](/docs/Standards/stylelint) |
|
|
183
|
+
| 9. EditorConfig | Copy `static/templates/.editorconfig` |
|
|
184
|
+
| 10. Node version | Copy `static/templates/.nvmrc` and `static/templates/.envrc`. See [direnv + nvm](/docs/Standards/direnv) |
|
|
185
|
+
| 11. Styling | Copy `static/templates/globals.css` to `app/globals.css`. Ask the person for the project's colours, and replace the example palette |
|
|
186
|
+
| 12.1. Constants | Create `lib/constants/` with `routes.ts` (`r`), `strings.ts` (`s`) and an `index.ts` that exports them. Create `noData.ts` once the data's shape is decided, and `numbers.ts`, `animation.ts`, `status.ts` and the others once more than one file shares a value. If the project keeps them somewhere else, such as `app/constants/`, move them. See [Constants](/docs/Structure/folder-structure#constants) |
|
|
187
|
+
| 18. Docs | Copy `static/templates/docs/` to `docs/` and `static/templates/docsSite/` to `docsSite/`. Add the `/docs` route from `static/templates/next.config.mjs`. See [Setting it up](/docs/Standards/documentation#-setting-it-up) |
|
|
188
|
+
| 21. AGENTS.md and skills | Copy `static/templates/AGENTS.md` to the project root and fill in every `[placeholder]`. If the framework wrote its own `AGENTS.md` (Next.js does), keep any instruction it gives about reading the framework's own docs. Copy `static/templates/skills/` into `.agents/skills/`, and again into `.claude/commands/`. Add the `standards:check` script: see [Checking a project](#checking-a-project) |
|
|
179
189
|
|
|
180
190
|
The other standards are rules for how code is written. There is nothing to install for them: follow them in every change.
|
|
181
191
|
|
|
@@ -258,15 +268,15 @@ It reports, and never changes a file. Each finding gives the standard's number a
|
|
|
258
268
|
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
259
269
|
| 21 | `AGENTS.md` has the code standards version and an unchanged Code standards section; the skills match the templates |
|
|
260
270
|
| 6 to 10 | `eslint.config.mjs`, `prettier.config.mjs`, `stylelint.config.mjs`, `.editorconfig` and `.envrc` match the templates; `eslint.overrides.mjs`, `.nvmrc` and the format scripts are in place |
|
|
261
|
-
| 12.1 | `lib/constants/` has `index.ts`, `routes.ts
|
|
262
|
-
| 13 |
|
|
263
|
-
| 21 | `docs/development/coding-standards.md` records the five agent answers under "Details"
|
|
271
|
+
| 12.1 | `lib/constants/` has `index.ts`, `routes.ts` and `strings.ts`, and no `unsortedValues.ts` is left waiting |
|
|
272
|
+
| 13 | `components/` holds only `ui/`, `layout/` and `shared/`, every sub-component sits flat in its root component's `components/` folder, and the homepage is in `app/(homepage)/` |
|
|
273
|
+
| 21 | `docs/development/coding-standards.md` records the five agent answers under "Details", and every numbered line there is a well-formed exception |
|
|
264
274
|
| 11 | `docs/design/design-system.md` has a filled-in Colour palette table |
|
|
265
275
|
| 15 | Every `components/ui/` component is on the Design System Components list, or recorded under "Components for the standards" |
|
|
266
276
|
| 4 | Every file that exports a function or component has a test file beside it |
|
|
267
277
|
| 18 | Every doc template is in place, and every doc has one "Group — Menu item" title matching its file name, a Status line, and Decision, Why and Related sections |
|
|
268
278
|
|
|
269
|
-
**It follows the project's own rules, not only the standard ones.** A finding for a standard recorded as skipped or changed in `docs/development/coding-standards.md` is listed as a recorded exception to check by hand, and does not fail the check. The project's ESLint changes live in `eslint.overrides.mjs`, which it never compares. It also lists any Unfinished changes.
|
|
279
|
+
**It follows the project's own rules, not only the standard ones.** A finding for a standard recorded as skipped or changed in `docs/development/coding-standards.md` is listed as a recorded exception to check by hand, and does not fail the check. An exception that names files covers only those files. A numbered line under "Details" that is not shaped like an exception fails the check, because it would otherwise switch a standard off by accident. The project's ESLint changes live in `eslint.overrides.mjs`, which it never compares. It also lists any Unfinished changes.
|
|
270
280
|
|
|
271
281
|
**The check is a helper, not the standard.** Passing it does not mean every rule is followed: names, the order inside a component and much more still need reading. And a finding that is wrong for the project is not fixed by bending the code to the script: record the exception in `coding-standards.md`, with the person's yes.
|
|
272
282
|
|
|
@@ -357,5 +357,6 @@ Converting a doc does not change its decision, so the **Updated** date stays as
|
|
|
357
357
|
- **Read the files directly.** Do not start the docs site to read them.
|
|
358
358
|
- **Check the Status.** `Decided` is settled. `Current plan` may change. `Under evaluation` and `Not started` are **not decisions** — do not treat them as one, and do not invent one. Ask.
|
|
359
359
|
- **Update the docs in the same change** as the code, and change the **Updated** date.
|
|
360
|
+
- **Record a check only after it has run.** Never write a URL, commit, date or "passed" for a check that has not happened yet. Write what was decided, and add the result once it exists.
|
|
360
361
|
- **Write into the matching file.** Create a new file only when a topic has no home, in kebab-case, using the [doc format](#-the-doc-format).
|
|
361
362
|
- **Do not edit anything in `docsSite/`** unless the task is about the docs viewer itself.
|
package/docs/Standards/eslint.md
CHANGED
|
@@ -196,8 +196,8 @@ const config = [
|
|
|
196
196
|
rules: { "max-lines": "off", "no-magic-numbers": "off" },
|
|
197
197
|
},
|
|
198
198
|
{
|
|
199
|
-
// The
|
|
200
|
-
files: ["lib/constants
|
|
199
|
+
// The constants files are data, not logic, so they can be long.
|
|
200
|
+
files: ["lib/constants/*.{js,mjs}"],
|
|
201
201
|
rules: { "max-lines": "off" },
|
|
202
202
|
},
|
|
203
203
|
{
|
|
@@ -401,8 +401,8 @@ const config = [
|
|
|
401
401
|
},
|
|
402
402
|
},
|
|
403
403
|
{
|
|
404
|
-
// The
|
|
405
|
-
files: ["lib/constants
|
|
404
|
+
// The constants files are data, not logic, so they can be long.
|
|
405
|
+
files: ["lib/constants/*.ts"],
|
|
406
406
|
rules: { "max-lines": "off" },
|
|
407
407
|
},
|
|
408
408
|
{
|
|
@@ -646,8 +646,8 @@ const config = [
|
|
|
646
646
|
},
|
|
647
647
|
},
|
|
648
648
|
{
|
|
649
|
-
// The
|
|
650
|
-
files: ["lib/constants
|
|
649
|
+
// The constants files are data, not logic, so they can be long.
|
|
650
|
+
files: ["lib/constants/*.ts"],
|
|
651
651
|
rules: { "max-lines": "off" },
|
|
652
652
|
},
|
|
653
653
|
{
|
|
@@ -893,8 +893,8 @@ const config = [
|
|
|
893
893
|
},
|
|
894
894
|
},
|
|
895
895
|
{
|
|
896
|
-
// The
|
|
897
|
-
files: ["lib/constants
|
|
896
|
+
// The constants files are data, not logic, so they can be long.
|
|
897
|
+
files: ["lib/constants/*.ts"],
|
|
898
898
|
rules: { "max-lines": "off" },
|
|
899
899
|
},
|
|
900
900
|
{
|
|
@@ -1054,7 +1054,7 @@ Every `eslint-disable` comment must say why, after `--`. A rule is never switche
|
|
|
1054
1054
|
|
|
1055
1055
|
### `max-lines: 300`
|
|
1056
1056
|
|
|
1057
|
-
No file is longer than 300 lines, not counting blank lines and comments. Test files are exempt, and so are the
|
|
1057
|
+
No file is longer than 300 lines, not counting blank lines and comments. Test files are exempt, and so are the files in `lib/constants/`, which hold data only. See [Readable Code](/docs/Standards/readable-code#no-file-longer-than-300-lines).
|
|
1058
1058
|
|
|
1059
1059
|
### `max-depth: 3`
|
|
1060
1060
|
|
|
@@ -72,11 +72,15 @@ Both scripts work on the same list of files: every file git tracks, plus every n
|
|
|
72
72
|
| One person's local tool files, such as `.claude/settings.local.json` | That person's `.git/info/exclude` or global git ignore. Never `.prettierignore` |
|
|
73
73
|
| Files the whole project keeps out of git, such as `build/` | `.gitignore` |
|
|
74
74
|
| Files in git that Prettier must not format, such as `pnpm-workspace.yaml` | `.prettierignore`, shared by the whole project |
|
|
75
|
+
| `AGENTS.md`, `.agents/skills/` and `.claude/commands/` | `.prettierignore`, shared by the whole project |
|
|
75
76
|
|
|
76
|
-
pnpm rewrites `pnpm-workspace.yaml` in its own style on every install, so it always goes in `.prettierignore
|
|
77
|
+
pnpm rewrites `pnpm-workspace.yaml` in its own style on every install, so it always goes in `.prettierignore`. So do `AGENTS.md` and the agent skills: they are copied from the standards, and `pnpm standards:check` compares them word for word, so a Prettier rewrite would fail it. The template has all four: copy `static/templates/.prettierignore`.
|
|
77
78
|
|
|
78
79
|
```text title=".prettierignore"
|
|
79
80
|
pnpm-workspace.yaml
|
|
81
|
+
AGENTS.md
|
|
82
|
+
.agents/skills/
|
|
83
|
+
.claude/commands/
|
|
80
84
|
```
|
|
81
85
|
|
|
82
86
|
## Tailwind class sorting
|
|
@@ -43,7 +43,7 @@ A file over 300 lines is doing more than one job. Split it before it gets there:
|
|
|
43
43
|
|
|
44
44
|
Blank lines and comments do not count towards the limit. **Test files are exempt** — a thorough test file can run long.
|
|
45
45
|
|
|
46
|
-
**The
|
|
46
|
+
**The files in `lib/constants/` are exempt too**, such as `routes.ts`, `strings.ts` and `numbers.ts`. They are lists of data, not logic, and a big app has a lot of links, text and motion. Splitting them would mean more places to look for one label. They stay data only: no functions in them. See [Constants](/docs/Structure/folder-structure#constants).
|
|
47
47
|
|
|
48
48
|
---
|
|
49
49
|
|
|
@@ -313,7 +313,7 @@ if (order.status === "shipped") {
|
|
|
313
313
|
|
|
314
314
|
**`-1`, `0` and `1` are allowed**, because they are part of how code works rather than a choice anyone makes: `0` is the start or nothing (`items[0]`, `length === 0`), `1` is one more or one less (`index + 1`), and `-1` is "not found" (`indexOf`). Any other number was chosen by someone, so its name says what it controls. Even `2` gets a name.
|
|
315
315
|
|
|
316
|
-
|
|
316
|
+
A number only one file uses is a named constant at the top of that file; a number more than one file uses lives in `lib/constants/numbers.ts`. Numbers that only mean something together, such as the steps of an animation, stay whole as one object in `animation.ts` or `artwork.ts`. See [Numbers](/docs/Structure/folder-structure#numbers-named-and-kept-by-topic) for where they go, and [Naming Conventions](/docs/Structure/naming-conventions#constants) for how to name them.
|
|
317
317
|
|
|
318
318
|
---
|
|
319
319
|
|
|
@@ -71,11 +71,9 @@ project-root/
|
|
|
71
71
|
│ ├── constants/ # Constants shared across the app: see Constants below
|
|
72
72
|
│ │ ├── routes.ts # r: every link
|
|
73
73
|
│ │ ├── strings.ts # s: every piece of static text
|
|
74
|
-
│ │ ├── numbers.ts #
|
|
74
|
+
│ │ ├── numbers.ts # Numbers more than one file uses
|
|
75
75
|
│ │ ├── noData.ts # Stand-in data for local development
|
|
76
|
-
│ │ ├──
|
|
77
|
-
│ │ ├── artwork.ts # What is drawn and where, once there is any
|
|
78
|
-
│ │ ├── classNames.ts # Class names shared between files, once there are any
|
|
76
|
+
│ │ ├── status.ts # Statuses the app shares, once there are any
|
|
79
77
|
│ │ └── index.ts
|
|
80
78
|
│ ├── errors/ # Error types and handlers shared across the app
|
|
81
79
|
│ └── types/ # Types shared across the app; a component's own types stay in its types.ts
|
|
@@ -299,25 +297,29 @@ Add the export to `utils/index.ts` whenever you add a function.
|
|
|
299
297
|
|
|
300
298
|
---
|
|
301
299
|
|
|
302
|
-
## 🔤 Constants: `r`, `s
|
|
300
|
+
## 🔤 Constants: `r`, `s` and shared values {#constants}
|
|
303
301
|
|
|
304
|
-
Every link
|
|
302
|
+
**Every link goes in `r`, and every piece of text people see or hear goes in `s`**, both in `lib/constants/`, never written straight into a component. A link then changes in one place, and every piece of text is in one place when the site is translated into other languages.
|
|
303
|
+
|
|
304
|
+
**Every other value lives with the code that uses it, until it is shared.** A number, list or internal string that one file uses is a named constant at the top of that file. Once more than one file needs it, it moves to `lib/constants/`, into the file that fits it.
|
|
305
305
|
|
|
306
306
|
```text
|
|
307
307
|
lib/constants/
|
|
308
|
-
├── routes.ts
|
|
309
|
-
├── strings.ts
|
|
310
|
-
├── numbers.ts
|
|
311
|
-
├── noData.ts
|
|
312
|
-
├── animation.ts
|
|
313
|
-
├── artwork.ts
|
|
314
|
-
├── classNames.ts
|
|
315
|
-
|
|
308
|
+
├── routes.ts # r: every link
|
|
309
|
+
├── strings.ts # s: every piece of text people see or hear
|
|
310
|
+
├── numbers.ts # Numbers more than one file uses
|
|
311
|
+
├── noData.ts # Stand-in data, once the data's shape is decided
|
|
312
|
+
├── animation.ts # How things move, when more than one file uses it
|
|
313
|
+
├── artwork.ts # What is drawn and where, when more than one file uses it
|
|
314
|
+
├── classNames.ts # Class names shared between files
|
|
315
|
+
├── status.ts # Statuses the app shares
|
|
316
|
+
├── unsortedValues.ts # Values waiting for the person to say where they go
|
|
317
|
+
└── index.ts # Exports all of them
|
|
316
318
|
```
|
|
317
319
|
|
|
318
|
-
|
|
320
|
+
`routes.ts`, `strings.ts` and `index.ts` exist from the start. Every other file is created only once there is something to put in it. Each is one file, never split by topic.
|
|
319
321
|
|
|
320
|
-
| A value that is…
|
|
322
|
+
| A shared value that is… | Goes in |
|
|
321
323
|
| ----------------------------------------------------------- | ------------------- |
|
|
322
324
|
| A link | `r` in `routes.ts` |
|
|
323
325
|
| Text people see or hear | `s` in `strings.ts` |
|
|
@@ -326,8 +328,9 @@ lib/constants/
|
|
|
326
328
|
| A group of values that together say how something moves | `animation.ts` |
|
|
327
329
|
| A group of values that together say what is drawn and where | `artwork.ts` |
|
|
328
330
|
| A Tailwind class string used by more than one file | `classNames.ts` |
|
|
331
|
+
| A status more than one part of the app reads | `status.ts` |
|
|
329
332
|
|
|
330
|
-
**This table is the base, and where each value goes is the project's call.**
|
|
333
|
+
**This table is the base, and where each value goes is the project's call.** A shared value that fits none of these goes in a file of its own in `lib/constants/`, named after what it holds. When it is not clear where a value goes, it goes in [`unsortedValues.ts`](#unsorted-values) until the person says.
|
|
331
334
|
|
|
332
335
|
A file outside the folder imports everything it needs in one line:
|
|
333
336
|
|
|
@@ -371,7 +374,7 @@ export const s = {
|
|
|
371
374
|
|
|
372
375
|
- **The keys of `s` are the site's translation keys.** When a site gets more languages, each key is translated into each language. Name each key after what the text says or does, and never use one key for two different jobs.
|
|
373
376
|
- **Only real copy goes in `s`.** Dummy text belongs in `noData.ts`.
|
|
374
|
-
- **Internal strings are not `s`.** Ids, keys, event names, log messages and media queries are never shown to people. Each is a key in the object that uses it, or a named constant at the top of the file that uses it, such as `const CLOSE_EVENT = "close";`.
|
|
377
|
+
- **Internal strings are not `s`.** Ids, keys, event names, log messages and media queries are never shown to people. Each is a key in the object that uses it, or a named constant at the top of the file that uses it, such as `const CLOSE_EVENT = "close";`. A status more than one part of the app reads goes in [`status.ts`](#statuses).
|
|
375
378
|
|
|
376
379
|
### A list of items with links
|
|
377
380
|
|
|
@@ -453,11 +456,11 @@ const insights =
|
|
|
453
456
|
- **Dummy values sit at the top of `noData.ts`** as their own constants, `DUMMY_HEADING` and the rest. They are never added to `s`.
|
|
454
457
|
- **noData is for the whole site.** All of it lives in this one file.
|
|
455
458
|
|
|
456
|
-
### Numbers: named,
|
|
459
|
+
### Numbers: named, and shared from one file {#numbers-named-and-kept-by-topic}
|
|
457
460
|
|
|
458
461
|
**A number other than `-1`, `0` or `1` gets a name**, such as `MAXIMUM_RETRY_ATTEMPTS`. Those three mean "nothing", "one more" and "not found", so they read clearly as they are. Any other number was chosen by someone, and its name says what it controls. ESLint checks this with `no-magic-numbers`.
|
|
459
462
|
|
|
460
|
-
**
|
|
463
|
+
**A number only one file uses is a named constant at the top of that file. A number more than one file uses lives in `lib/constants/numbers.ts`.** There is no `n` object: each number is its own `SCREAMING_SNAKE_CASE` export.
|
|
461
464
|
|
|
462
465
|
```ts title="lib/constants/numbers.ts"
|
|
463
466
|
export const COOKIE_DURATION_DAYS = 30;
|
|
@@ -475,7 +478,9 @@ export const SESSION_TIMEOUT_MILLISECONDS = 900_000;
|
|
|
475
478
|
**`animation.ts` holds every object that says how and when something moves.**
|
|
476
479
|
|
|
477
480
|
```ts title="lib/constants/animation.ts"
|
|
478
|
-
|
|
481
|
+
import type { EntranceAnimationType } from "@/lib/types";
|
|
482
|
+
|
|
483
|
+
export const ENTRANCE_ANIMATION: EntranceAnimationType = {
|
|
479
484
|
delaySeconds: 0.1,
|
|
480
485
|
durationSeconds: 0.4,
|
|
481
486
|
offsetPixels: 24,
|
|
@@ -492,7 +497,9 @@ export const ENTRANCE_ANIMATION = {
|
|
|
492
497
|
**`artwork.ts` holds every object that says what is drawn, where it ends up, and how it is grouped.** Where something ends up is artwork; how and when it gets there is animation.
|
|
493
498
|
|
|
494
499
|
```ts title="lib/constants/artwork.ts"
|
|
495
|
-
|
|
500
|
+
import type { IllustrationLayoutType } from "@/lib/types";
|
|
501
|
+
|
|
502
|
+
export const ILLUSTRATION_LAYOUT: IllustrationLayoutType = {
|
|
496
503
|
heightPixels: 600,
|
|
497
504
|
widthPixels: 800,
|
|
498
505
|
};
|
|
@@ -514,9 +521,42 @@ export const SURFACE_CLASS_NAME =
|
|
|
514
521
|
- **A class name used in one file stays inline in that file.**
|
|
515
522
|
- **Name each export after what it styles, ending in `_CLASS_NAME`**, or `_CLASS_NAMES` for a set keyed by variant.
|
|
516
523
|
|
|
524
|
+
### Statuses {#statuses}
|
|
525
|
+
|
|
526
|
+
**`status.ts` holds the statuses more than one part of the app reads**, such as the states a review or a workflow can be in. A status only one file reads stays at the top of that file.
|
|
527
|
+
|
|
528
|
+
```ts title="lib/types/status.ts"
|
|
529
|
+
export type ReviewStatusType = "passed" | "rejected" | "errored";
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
```ts title="lib/constants/status.ts"
|
|
533
|
+
import type { ReviewStatusType } from "@/lib/types";
|
|
534
|
+
|
|
535
|
+
export const REVIEW_FAILED_STATUSES: readonly ReviewStatusType[] = [
|
|
536
|
+
"rejected",
|
|
537
|
+
"errored",
|
|
538
|
+
];
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
- **The status is the value the code checks. The words people see stay in `s`**, under the same key: `"rejected"` is what the code compares, and `s.reviewStatuses.rejected` is the "Rejected" on the badge.
|
|
542
|
+
- **Name each export after what it lists**, ending in `_STATUSES` or `_STATES`.
|
|
543
|
+
|
|
544
|
+
### When it is not clear where a value goes {#unsorted-values}
|
|
545
|
+
|
|
546
|
+
**Put it in `lib/constants/unsortedValues.ts`, and carry on.** The work never waits for the answer.
|
|
547
|
+
|
|
548
|
+
**At the end of the work, ask the person about every value in it**, one line each, with where you would put it: at the top of the file that uses it, or in a shared file named after what it holds.
|
|
549
|
+
|
|
550
|
+
```text
|
|
551
|
+
REVIEW_FAILED_STATUSES (used in runReview and ReviewBadge)
|
|
552
|
+
→ keep it in runReview.ts, or move it to lib/constants/status.ts?
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
Move each value where the person says, then delete the file. [`pnpm standards:check`](/docs/Guides/setup#checking-a-project) reports `unsortedValues.ts` for as long as it exists, so nothing is left waiting.
|
|
556
|
+
|
|
517
557
|
### Types for constants {#types-for-constants}
|
|
518
558
|
|
|
519
|
-
**Every constant gets a real type where it is declared, from `lib/types/`.** `r` and `s` are the exception: their types are read from their values, such as `keyof typeof r.plans`, so they are never typed by hand.
|
|
559
|
+
**Every object and list constant in `lib/constants/` gets a real type where it is declared, from `lib/types/`.** `r` and `s` are the exception: their types are read from their values, such as `keyof typeof r.plans`, so they are never typed by hand. **A single number or string needs no type of its own**: `const COOKIE_DURATION_DAYS = 30;` is already exactly typed, and writing `: number` adds nothing.
|
|
520
560
|
|
|
521
561
|
```ts title="lib/types/animation.ts"
|
|
522
562
|
export interface EntranceAnimationType {
|
|
@@ -536,6 +576,7 @@ export const ENTRANCE_ANIMATION: EntranceAnimationType = {
|
|
|
536
576
|
};
|
|
537
577
|
```
|
|
538
578
|
|
|
579
|
+
- **A constant kept at the top of the file that uses it is typed beside it**, from that file's own `.types.ts`, the same as its `Props`. `lib/types/` is for the shared constants.
|
|
539
580
|
- **Types live in `lib/types/`, in files named by topic**, such as `animation.ts` and `artwork.ts`. A types file is not exempt from the 300-line limit: split it by topic when it grows.
|
|
540
581
|
- **A type a constant needs lives in `lib/types/`**, with every type it depends on. Components import it from `@/lib/types`.
|
|
541
582
|
- **`lib/types/` reads a constant's type straight from its file**: `import type { r } from "@/lib/constants/routes";`, never through `@/lib/constants`. It is the one exception to importing constants in one line. `import type` is removed at build, so the two folders reading each other's types never makes a real loop.
|
|
@@ -586,7 +627,7 @@ export const ENTRANCE_ANIMATION: EntranceAnimationType = {
|
|
|
586
627
|
A list of keys a loop runs over, such as `planIds` in [A list of items with links](#a-list-of-items-with-links), is not a loose id: it stays a list.
|
|
587
628
|
|
|
588
629
|
- **CSS belongs in a stylesheet, never in a constant.** Styles written as a string in TypeScript move to `globals.css`. Styles for when JavaScript is off go there under `@media (scripting: none)`; a browser without that query misses the fallback, and the standard accepts that. **A media query the code reads is not CSS**, such as the one an animation library matches to switch motion off: it stays in its object in `animation.ts`.
|
|
589
|
-
- **
|
|
630
|
+
- **Every file in `lib/constants/` can run past 300 lines.** They are data only, so ESLint does not apply `max-lines` to them. Keep each one a single file: never split them to get under the limit.
|
|
590
631
|
|
|
591
632
|
---
|
|
592
633
|
|
package/docs/templates.mdx
CHANGED
|
@@ -9,6 +9,7 @@ import eslintReact from "!!raw-loader!@site/static/templates/eslint/react/eslint
|
|
|
9
9
|
import eslintNextjs from "!!raw-loader!@site/static/templates/eslint/nextjs/eslint.config.mjs";
|
|
10
10
|
import eslintBase from "!!raw-loader!@site/static/templates/eslint/base/eslint.config.mjs";
|
|
11
11
|
import prettier from "!!raw-loader!@site/static/templates/prettier.config.mjs";
|
|
12
|
+
import prettierIgnore from "!!raw-loader!@site/static/templates/.prettierignore";
|
|
12
13
|
import stylelintCss from "!!raw-loader!@site/static/templates/stylelint/css/stylelint.config.mjs";
|
|
13
14
|
import stylelintScss from "!!raw-loader!@site/static/templates/stylelint/scss/stylelint.config.mjs";
|
|
14
15
|
import globalsCss from "!!raw-loader!@site/static/templates/globals.css";
|
|
@@ -50,6 +51,7 @@ Each file is also served as a plain file, so a person or an AI agent can fetch i
|
|
|
50
51
|
| [ESLint — Next.js](#eslintnextjs) | `eslint.config.mjs` in the project root | [`/templates/eslint/nextjs/eslint.config.mjs`](pathname:///templates/eslint/nextjs/eslint.config.mjs) |
|
|
51
52
|
| [ESLint — JavaScript / Node.js](#eslintbase) | `eslint.config.mjs` in the project root | [`/templates/eslint/base/eslint.config.mjs`](pathname:///templates/eslint/base/eslint.config.mjs) |
|
|
52
53
|
| [Prettier](#prettier) | `prettier.config.mjs` in the project root | [`/templates/prettier.config.mjs`](pathname:///templates/prettier.config.mjs) |
|
|
54
|
+
| [Prettier ignore](#prettierignore) | `.prettierignore` in the project root | [`/templates/.prettierignore`](pathname:///templates/.prettierignore) |
|
|
53
55
|
| [Stylelint — CSS and CSS Modules](#stylelintcss) | `stylelint.config.mjs` in the project root | [`/templates/stylelint/css/stylelint.config.mjs`](pathname:///templates/stylelint/css/stylelint.config.mjs) |
|
|
54
56
|
| [Stylelint — SCSS](#stylelintscss) | `stylelint.config.mjs` in the project root | [`/templates/stylelint/scss/stylelint.config.mjs`](pathname:///templates/stylelint/scss/stylelint.config.mjs) |
|
|
55
57
|
| [Global styles and colour palette](#globalscss) | `app/globals.css` | [`/templates/globals.css`](pathname:///templates/globals.css) |
|
|
@@ -135,6 +137,18 @@ See the [Prettier page](/docs/Standards/prettier).
|
|
|
135
137
|
|
|
136
138
|
---
|
|
137
139
|
|
|
140
|
+
## Prettier ignore {#prettierignore}
|
|
141
|
+
|
|
142
|
+
**Copy to:** `.prettierignore` in the project root, or add its lines to the project's own
|
|
143
|
+
|
|
144
|
+
See [What Prettier skips](/docs/Standards/prettier#what-prettier-skips).
|
|
145
|
+
|
|
146
|
+
<CodeBlock language="text" title=".prettierignore">
|
|
147
|
+
{prettierIgnore}
|
|
148
|
+
</CodeBlock>
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
138
152
|
## Stylelint — CSS and CSS Modules {#stylelintcss}
|
|
139
153
|
|
|
140
154
|
**Copy to:** `stylelint.config.mjs` in the project root
|