@activatus/code-standards 3.3.4 → 3.3.6
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/docs/Guides/setup.md +1 -1
- package/docs/Standards/eslint.md +5 -5
- package/docs/Standards/stylelint.md +21 -3
- package/docs/version-history.md +27 -2
- package/package.json +5 -1
- package/scripts/verifyStandards/checkConfigFiles.mjs +34 -4
- package/scripts/verifyStandards/runChecks.mjs +5 -1
- package/static/templates/docs/design/design-system.md +2 -2
- package/static/templates/docs/product/ontology.md +8 -8
- package/static/templates/docsSite/src/pages/index.tsx +3 -3
- package/static/templates/eslint/base/eslint.config.mjs +1 -1
- package/static/templates/eslint/nextjs/eslint.config.mjs +2 -2
- package/static/templates/eslint/react/eslint.config.mjs +1 -1
- package/static/templates/eslint/typescript/eslint.config.mjs +1 -1
- package/static/templates/stylelint/css/stylelint.config.mjs +10 -1
- package/static/templates/stylelint/scss/stylelint.config.mjs +10 -1
- package/static/templates/tests/visual/pageLayout.visual.ts +5 -2
package/docs/Guides/setup.md
CHANGED
|
@@ -179,7 +179,7 @@ Do only the standards the person agreed to. Copy every file from `node_modules/@
|
|
|
179
179
|
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
180
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
181
|
| 7. Prettier | `pnpm add -D prettier @ianvs/prettier-plugin-sort-imports 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 |
|
|
182
|
+
| 8. Stylelint | Every project with hand-written CSS or SCSS, and a Tailwind `globals.css` counts. Install the packages and copy the config from `static/templates/stylelint/css/` or `scss/`. See [Stylelint](/docs/Standards/stylelint) |
|
|
183
183
|
| 9. EditorConfig | Copy `static/templates/.editorconfig` |
|
|
184
184
|
| 10. Node version | Copy `static/templates/.nvmrc` and `static/templates/.envrc`. See [direnv + nvm](/docs/Standards/direnv) |
|
|
185
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 |
|
package/docs/Standards/eslint.md
CHANGED
|
@@ -73,8 +73,8 @@ Create `eslint.config.mjs` in your project root. Each config passes its own rule
|
|
|
73
73
|
### Base (JavaScript / Node.js)
|
|
74
74
|
|
|
75
75
|
```js title="eslint.config.mjs"
|
|
76
|
-
import js from "@eslint/js";
|
|
77
76
|
import { recommended as eslintCommentsRecommended } from "@eslint-community/eslint-plugin-eslint-comments/configs";
|
|
77
|
+
import js from "@eslint/js";
|
|
78
78
|
import prettier from "eslint-config-prettier";
|
|
79
79
|
import { flatConfigs as importX } from "eslint-plugin-import-x";
|
|
80
80
|
import unicorn from "eslint-plugin-unicorn";
|
|
@@ -215,8 +215,8 @@ export default config;
|
|
|
215
215
|
### TypeScript
|
|
216
216
|
|
|
217
217
|
```js title="eslint.config.mjs"
|
|
218
|
-
import js from "@eslint/js";
|
|
219
218
|
import { recommended as eslintCommentsRecommended } from "@eslint-community/eslint-plugin-eslint-comments/configs";
|
|
219
|
+
import js from "@eslint/js";
|
|
220
220
|
import prettier from "eslint-config-prettier";
|
|
221
221
|
import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
|
|
222
222
|
import { flatConfigs as importX } from "eslint-plugin-import-x";
|
|
@@ -440,8 +440,8 @@ TypeScript files are checked by the compiler, so `no-undef` is off for them. The
|
|
|
440
440
|
Start from the [TypeScript](#typescript) config and make five changes:
|
|
441
441
|
|
|
442
442
|
```js title="eslint.config.mjs"
|
|
443
|
-
import js from "@eslint/js";
|
|
444
443
|
import { recommended as eslintCommentsRecommended } from "@eslint-community/eslint-plugin-eslint-comments/configs";
|
|
444
|
+
import js from "@eslint/js";
|
|
445
445
|
import prettier from "eslint-config-prettier";
|
|
446
446
|
import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
|
|
447
447
|
import { flatConfigs as importX } from "eslint-plugin-import-x";
|
|
@@ -690,10 +690,10 @@ Keep `settings.react.version` set rather than `"detect"`; change the number in `
|
|
|
690
690
|
|
|
691
691
|
```js title="eslint.config.mjs"
|
|
692
692
|
import { recommended as eslintCommentsRecommended } from "@eslint-community/eslint-plugin-eslint-comments/configs";
|
|
693
|
-
import prettier from "eslint-config-prettier";
|
|
694
|
-
import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
|
|
695
693
|
import nextVitals from "eslint-config-next/core-web-vitals";
|
|
696
694
|
import nextTypescript from "eslint-config-next/typescript";
|
|
695
|
+
import prettier from "eslint-config-prettier";
|
|
696
|
+
import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
|
|
697
697
|
import { flatConfigs as importX } from "eslint-plugin-import-x";
|
|
698
698
|
import unicorn from "eslint-plugin-unicorn";
|
|
699
699
|
import globals from "globals";
|
|
@@ -5,7 +5,7 @@ sidebar_label: "Stylelint"
|
|
|
5
5
|
|
|
6
6
|
# Stylelint Configuration
|
|
7
7
|
|
|
8
|
-
Components are styled with [Tailwind CSS](/docs/Standards/styling), and Stylelint lints the CSS that is still written by hand — `globals.css` and any CSS Modules. Start from the config below that matches the project:
|
|
8
|
+
Components are styled with [Tailwind CSS](/docs/Standards/styling), and Stylelint lints the CSS that is still written by hand — `globals.css` and any CSS Modules. **Every project with a `.css` or `.scss` file has Stylelint**, so a Tailwind project with only `globals.css` has it too. `pnpm standards:check` reports a missing `stylelint.config.mjs`. CSS in `vendor/` and `docsSite/` does not count. Start from the config below that matches the project:
|
|
9
9
|
|
|
10
10
|
| Config | Use when |
|
|
11
11
|
| --------------------------------------- | ----------------------------------------- |
|
|
@@ -35,7 +35,16 @@ Create `stylelint.config.mjs` in your project root:
|
|
|
35
35
|
@type {import("stylelint").Config}
|
|
36
36
|
*/
|
|
37
37
|
const config = {
|
|
38
|
-
|
|
38
|
+
// Generated CSS, and the docs viewer, which is the standard template
|
|
39
|
+
// with its own build. Only the project's hand-written CSS is linted.
|
|
40
|
+
ignoreFiles: [
|
|
41
|
+
".next/**",
|
|
42
|
+
"out/**",
|
|
43
|
+
"build/**",
|
|
44
|
+
"coverage/**",
|
|
45
|
+
"docsSite/**",
|
|
46
|
+
"**/vendor/**",
|
|
47
|
+
],
|
|
39
48
|
extends: [
|
|
40
49
|
"stylelint-config-standard",
|
|
41
50
|
"stylelint-config-recess-order",
|
|
@@ -84,7 +93,16 @@ export default config;
|
|
|
84
93
|
@type {import("stylelint").Config}
|
|
85
94
|
*/
|
|
86
95
|
const config = {
|
|
87
|
-
|
|
96
|
+
// Generated CSS, and the docs viewer, which is the standard template
|
|
97
|
+
// with its own build. Only the project's hand-written CSS is linted.
|
|
98
|
+
ignoreFiles: [
|
|
99
|
+
".next/**",
|
|
100
|
+
"out/**",
|
|
101
|
+
"build/**",
|
|
102
|
+
"coverage/**",
|
|
103
|
+
"docsSite/**",
|
|
104
|
+
"**/vendor/**",
|
|
105
|
+
],
|
|
88
106
|
extends: [
|
|
89
107
|
"stylelint-config-standard-scss",
|
|
90
108
|
"stylelint-config-recess-order",
|
package/docs/version-history.md
CHANGED
|
@@ -61,7 +61,7 @@ Anyone changing the standards adds a version, alongside the change:
|
|
|
61
61
|
- **Every entry is headed `**Fixes in 3.2.3.**`**, with its number, followed by "If the project already applied 3.2.2, check these:".
|
|
62
62
|
- **A middle-number entry adds `**Structural changes in 3.3.0.**` straight under its heading**, listing each change that moves or renames files in a project, with a rough size, such as "one move per file", so a project can plan the work and take a [regression check](/docs/Guides/regression-checks) baseline first. A last-number entry never moves files.
|
|
63
63
|
- **Anything a version can change in the `AGENTS.md` template lives between the `code-standards` markers.** A project copies only that section on an update, and `pnpm standards:check` compares only that section, so a rule outside the markers never reaches a project that is already set up.
|
|
64
|
-
- **`pnpm devtest` must pass before publishing.** Run it, then `pnpm publish`. It checks the lint packages are the latest a project would install, then runs the tests, lints every template the way a project does, and checks formatting, types and the site build.
|
|
64
|
+
- **`pnpm devtest` must pass before publishing.** Run it, then `pnpm publish`. It checks the lint packages are the latest a project would install, then runs the tests, lints and formats every template the way a project does, and checks formatting, types and the site build.
|
|
65
65
|
- **Every release commit is titled `docs: version N.N.N — <what changed>`**, such as `docs: version 3.2.2 — full version numbers`, so releases are easy to find in the git log.
|
|
66
66
|
- **Every number is published.** Publish each one to npm as soon as its entry is written. A Fixes entry for a version that was never published sends a project to install something that does not exist.
|
|
67
67
|
- **Judgement calls after release are fixes, not workarounds.** When a project's update needed a call the steps did not cover, add it under the version's Fixes so every other project gets it too. A project should never keep a private workaround for an unclear step.
|
|
@@ -70,10 +70,35 @@ Anyone changing the standards adds a version, alongside the change:
|
|
|
70
70
|
|
|
71
71
|
## Version 3
|
|
72
72
|
|
|
73
|
-
**Released:** 2026-10-17 · **Updates from:** version 2 · **Latest:** 3.3.
|
|
73
|
+
**Released:** 2026-10-17 · **Updates from:** version 2 · **Latest:** 3.3.6
|
|
74
74
|
|
|
75
75
|
Install it with `pnpm add -D @activatus/code-standards@latest`. Do change 1 first: it says which parts of the project's `AGENTS.md` are now the project's own to write.
|
|
76
76
|
|
|
77
|
+
**Fixes in 3.3.6.** If the project already applied 3.3.5, check these:
|
|
78
|
+
|
|
79
|
+
- **The templates are now formatted with the template Prettier config.** The import sorting added in 3.3.3 reordered the imports in the four `eslint.config.mjs` templates, so after `pnpm format` a project's copy no longer matched the template, and `pnpm standards:check` failed standard 6. `pageLayout.visual.ts`, the docs site's `index.tsx`, and the tables in the `ontology.md` and `design-system.md` templates changed the same way. Every template is now already formatted, and the code standards check this before each release, so `pnpm format` leaves a copied template as it is.
|
|
80
|
+
|
|
81
|
+
**What to do:** copy the project's ESLint template over `eslint.config.mjs` again, and, if the project has a regression check, `tests/visual/pageLayout.visual.ts`. Run `pnpm format`: neither should change. If the project recorded a standard 6 exception or an unfinished change only because the copied ESLint config was reformatted, remove it.
|
|
82
|
+
|
|
83
|
+
- **The Stylelint templates ignore generated CSS.** They only ignored `vendor/`, so `pnpm lint:css` also linted `.next/`, `out/`, `build/`, `coverage/` and `docsSite/`, and reported errors in CSS nobody wrote. They now ignore the same folders as the ESLint templates.
|
|
84
|
+
|
|
85
|
+
**What to do:** copy the Stylelint template over `stylelint.config.mjs` again. If the project added a `.stylelintignore` for those folders, delete it, and remove its line from "Unfinished changes" in `docs/development/coding-standards.md`.
|
|
86
|
+
|
|
87
|
+
**How to check:** `pnpm format` changes no copied template; `pnpm standards:check` passes, or lists only recorded exceptions; `pnpm lint:css` passes with no `.stylelintignore`.
|
|
88
|
+
|
|
89
|
+
**Fixes in 3.3.5.** If the project already applied 3.3.4, check these:
|
|
90
|
+
|
|
91
|
+
- **`pnpm standards:check` now reports a missing Stylelint config.** Standard 8 covers all hand-written CSS, and a Tailwind `globals.css` is hand-written CSS, but the check only looked at `stylelint.config.mjs` when there was one. A project with a `.css` or `.scss` file outside `vendor/` and `docsSite/`, and no `stylelint.config.mjs`, now fails standard 8. See [Stylelint](/docs/Standards/stylelint).
|
|
92
|
+
|
|
93
|
+
**What to do:** if the project has no `stylelint.config.mjs`:
|
|
94
|
+
|
|
95
|
+
1. Install the packages from the [Stylelint page](/docs/Standards/stylelint#installation).
|
|
96
|
+
2. Copy `static/templates/stylelint/css/stylelint.config.mjs`, or the `scss` one for SCSS.
|
|
97
|
+
3. Add the `lint:css` and `lint:css:fix` scripts from the [Stylelint page](/docs/Standards/stylelint), run `pnpm lint:css`, and fix what it finds.
|
|
98
|
+
4. If `docs/development/coding-standards.md` says Stylelint was set up, check that it really was.
|
|
99
|
+
|
|
100
|
+
**How to check:** `pnpm standards:check` passes, or lists only recorded exceptions; `pnpm lint:css` passes.
|
|
101
|
+
|
|
77
102
|
**Fixes in 3.3.4.** If the project already applied 3.3.3, check these:
|
|
78
103
|
|
|
79
104
|
- **The config templates now pass the template ESLint config.** `prettier.config.mjs`, `next.config.mjs`, both `stylelint.config.mjs` templates and the regression check's `playwright.config.mjs` started with a one-line `/** @type … */` comment, which `unicorn/single-line-block-comment-style` rejects. They now use a JSDoc comment over three lines, with no `*` at the start of each line, which TypeScript reads the same way. The regression check's `playwright.config.mjs` and `pageLayout.visual.ts` had three more lint errors, now fixed. The code standards now lint every template the way a project does, with the latest lint packages, before every release, so this cannot ship again.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activatus/code-standards",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.6",
|
|
4
4
|
"description": "The Activatus code standards: the rules as Markdown, and the config files to copy. Install it so an AI agent can read the standards from node_modules.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"@eslint/js": "^10.0.1",
|
|
32
32
|
"@getcanary/docusaurus-theme-search-pagefind": "1.0.2",
|
|
33
33
|
"@getcanary/web": "^1.0.0",
|
|
34
|
+
"@ianvs/prettier-plugin-sort-imports": "^4.7.1",
|
|
34
35
|
"@mdx-js/react": "^3.0.0",
|
|
35
36
|
"clsx": "^2.0.0",
|
|
36
37
|
"eslint": "^10.13.0",
|
|
@@ -45,10 +46,12 @@
|
|
|
45
46
|
"next": "^16.4.2",
|
|
46
47
|
"pagefind": "^1.3.0",
|
|
47
48
|
"prettier": "^3.9.10",
|
|
49
|
+
"prettier-plugin-tailwindcss": "^0.8.1",
|
|
48
50
|
"prism-react-renderer": "^2.3.0",
|
|
49
51
|
"raw-loader": "^4.0.2",
|
|
50
52
|
"react": "^18.3.1",
|
|
51
53
|
"react-dom": "^18.3.1",
|
|
54
|
+
"tailwindcss": "^4.3.3",
|
|
52
55
|
"typescript": "~5.6.2",
|
|
53
56
|
"typescript-eslint": "^8.72.1"
|
|
54
57
|
},
|
|
@@ -77,6 +80,7 @@
|
|
|
77
80
|
"format": "prettier --write .",
|
|
78
81
|
"format:check": "prettier --check .",
|
|
79
82
|
"check:eslint-templates": "node scripts/checkEslintTemplates.mjs",
|
|
83
|
+
"check:template-formatting": "node scripts/checkTemplateFormatting.mjs",
|
|
80
84
|
"devtest": "node scripts/developmentTest.mjs",
|
|
81
85
|
"test": "node --test \"scripts/verifyStandards/*.test.mjs\""
|
|
82
86
|
}
|
|
@@ -10,6 +10,10 @@ const ESLINT_TEMPLATE_NAMES = [
|
|
|
10
10
|
"nextjs",
|
|
11
11
|
];
|
|
12
12
|
const STYLELINT_TEMPLATE_NAMES = ["css", "scss"];
|
|
13
|
+
// Hand-written CSS. vendor/ is someone else's, and docsSite/ is the
|
|
14
|
+
// standard template, ignored like it is by ESLint.
|
|
15
|
+
const STYLESHEET_PATTERN = /\.(?:css|scss)$/;
|
|
16
|
+
const NOT_HAND_WRITTEN_PATTERN = /(?:^|\/)(?:vendor|docsSite)\//;
|
|
13
17
|
const FORMAT_SCRIPTS = {
|
|
14
18
|
format:
|
|
15
19
|
"git ls-files -z --cached --others --exclude-standard | xargs -0 prettier --write --ignore-unknown --no-error-on-unmatched-pattern",
|
|
@@ -163,14 +167,35 @@ const checkExactCopy = ({
|
|
|
163
167
|
];
|
|
164
168
|
};
|
|
165
169
|
|
|
166
|
-
const
|
|
170
|
+
const hasHandWrittenCss = (projectFiles) =>
|
|
171
|
+
projectFiles.some(
|
|
172
|
+
(filePath) =>
|
|
173
|
+
STYLESHEET_PATTERN.test(filePath) &&
|
|
174
|
+
!NOT_HAND_WRITTEN_PATTERN.test(filePath),
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
const checkStylelint = ({
|
|
178
|
+
projectDirectory,
|
|
179
|
+
templatesDirectory,
|
|
180
|
+
projectFiles,
|
|
181
|
+
}) => {
|
|
167
182
|
const config = readTextFile({
|
|
168
183
|
projectDirectory,
|
|
169
184
|
filePath: "stylelint.config.mjs",
|
|
170
185
|
});
|
|
171
|
-
// Stylelint is
|
|
186
|
+
// Stylelint is for projects with hand-written CSS, such as
|
|
187
|
+
// globals.css.
|
|
172
188
|
if (config === undefined) {
|
|
173
|
-
return
|
|
189
|
+
return hasHandWrittenCss(projectFiles)
|
|
190
|
+
? [
|
|
191
|
+
{
|
|
192
|
+
standard: "8",
|
|
193
|
+
message:
|
|
194
|
+
"stylelint.config.mjs is missing. The project has hand-written CSS, such as globals.css, so it needs Stylelint",
|
|
195
|
+
page: "docs/Standards/stylelint.md",
|
|
196
|
+
},
|
|
197
|
+
]
|
|
198
|
+
: [];
|
|
174
199
|
}
|
|
175
200
|
const isCopy = matchesAnyTemplate({
|
|
176
201
|
projectText: config,
|
|
@@ -193,6 +218,7 @@ const checkStylelint = ({ projectDirectory, templatesDirectory }) => {
|
|
|
193
218
|
export const checkConfigFiles = ({
|
|
194
219
|
projectDirectory,
|
|
195
220
|
templatesDirectory,
|
|
221
|
+
projectFiles,
|
|
196
222
|
}) => {
|
|
197
223
|
const nodeVersion = readTextFile({
|
|
198
224
|
projectDirectory,
|
|
@@ -201,7 +227,11 @@ export const checkConfigFiles = ({
|
|
|
201
227
|
return [
|
|
202
228
|
...checkEslint({ projectDirectory, templatesDirectory }),
|
|
203
229
|
...checkPrettier({ projectDirectory, templatesDirectory }),
|
|
204
|
-
...checkStylelint({
|
|
230
|
+
...checkStylelint({
|
|
231
|
+
projectDirectory,
|
|
232
|
+
templatesDirectory,
|
|
233
|
+
projectFiles,
|
|
234
|
+
}),
|
|
205
235
|
...checkExactCopy({
|
|
206
236
|
projectDirectory,
|
|
207
237
|
templatesDirectory,
|
|
@@ -44,7 +44,11 @@ export const runChecks = ({ projectDirectory }) => {
|
|
|
44
44
|
templatesDirectory,
|
|
45
45
|
packageVersion: readPackageVersion(),
|
|
46
46
|
}),
|
|
47
|
-
...checkConfigFiles({
|
|
47
|
+
...checkConfigFiles({
|
|
48
|
+
projectDirectory,
|
|
49
|
+
templatesDirectory,
|
|
50
|
+
projectFiles,
|
|
51
|
+
}),
|
|
48
52
|
...checkRequiredFiles({ templatesDirectory, projectFiles }),
|
|
49
53
|
...checkConstants({ projectFiles }),
|
|
50
54
|
...checkStructure({ projectFiles }),
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
## Colour palette
|
|
12
12
|
|
|
13
|
-
| Colour
|
|
14
|
-
|
|
|
13
|
+
| Colour | Value | Class names | Use for |
|
|
14
|
+
| --------------- | ----------------------------------------------------- | ------------------------------------------ | ------------------- |
|
|
15
15
|
| [Brand primary] | [`#3b82f6`, or a Tailwind colour such as `slate-900`] | [`bg-brand-primary`, `text-brand-primary`] | [Buttons and links] |
|
|
16
16
|
|
|
17
17
|
## Why
|
|
@@ -10,18 +10,18 @@ These are this product's words. Code, docs, tickets and copy all use them exactl
|
|
|
10
10
|
|
|
11
11
|
## Product words
|
|
12
12
|
|
|
13
|
-
| Word
|
|
14
|
-
|
|
|
13
|
+
| Word | What it means | Not to be confused with |
|
|
14
|
+
| ------ | ------------------------------- | --------------------------------------------------- |
|
|
15
15
|
| [Word] | [What it means in this product] | [A word that sounds close but means something else] |
|
|
16
16
|
|
|
17
17
|
## How we speak
|
|
18
18
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
21
|
-
| **Tone**
|
|
22
|
-
| **Words we use**
|
|
23
|
-
| **Words we avoid** | [Words that do not fit, and what to say instead]
|
|
24
|
-
| **Audience**
|
|
19
|
+
| | |
|
|
20
|
+
| ------------------ | ---------------------------------------------------------- |
|
|
21
|
+
| **Tone** | [How the product sounds, such as "plain, warm and direct"] |
|
|
22
|
+
| **Words we use** | [Words that fit, such as "start" rather than "commence"] |
|
|
23
|
+
| **Words we avoid** | [Words that do not fit, and what to say instead] |
|
|
24
|
+
| **Audience** | [Who reads the copy, and what they already know] |
|
|
25
25
|
|
|
26
26
|
## Why
|
|
27
27
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {Redirect} from
|
|
2
|
-
import useBaseUrl from
|
|
1
|
+
import { Redirect } from "@docusaurus/router";
|
|
2
|
+
import useBaseUrl from "@docusaurus/useBaseUrl";
|
|
3
3
|
|
|
4
4
|
// The docs have no home page of their own: /docs opens the first Overview doc.
|
|
5
5
|
const Home = () => {
|
|
6
|
-
|
|
6
|
+
return <Redirect to={useBaseUrl("/overview/what-is-it")} />;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
export default Home;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import js from "@eslint/js";
|
|
2
1
|
import { recommended as eslintCommentsRecommended } from "@eslint-community/eslint-plugin-eslint-comments/configs";
|
|
2
|
+
import js from "@eslint/js";
|
|
3
3
|
import prettier from "eslint-config-prettier";
|
|
4
4
|
import { flatConfigs as importX } from "eslint-plugin-import-x";
|
|
5
5
|
import unicorn from "eslint-plugin-unicorn";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { recommended as eslintCommentsRecommended } from "@eslint-community/eslint-plugin-eslint-comments/configs";
|
|
2
|
-
import prettier from "eslint-config-prettier";
|
|
3
|
-
import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
|
|
4
2
|
import nextVitals from "eslint-config-next/core-web-vitals";
|
|
5
3
|
import nextTypescript from "eslint-config-next/typescript";
|
|
4
|
+
import prettier from "eslint-config-prettier";
|
|
5
|
+
import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
|
|
6
6
|
import { flatConfigs as importX } from "eslint-plugin-import-x";
|
|
7
7
|
import unicorn from "eslint-plugin-unicorn";
|
|
8
8
|
import globals from "globals";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import js from "@eslint/js";
|
|
2
1
|
import { recommended as eslintCommentsRecommended } from "@eslint-community/eslint-plugin-eslint-comments/configs";
|
|
2
|
+
import js from "@eslint/js";
|
|
3
3
|
import prettier from "eslint-config-prettier";
|
|
4
4
|
import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
|
|
5
5
|
import { flatConfigs as importX } from "eslint-plugin-import-x";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import js from "@eslint/js";
|
|
2
1
|
import { recommended as eslintCommentsRecommended } from "@eslint-community/eslint-plugin-eslint-comments/configs";
|
|
2
|
+
import js from "@eslint/js";
|
|
3
3
|
import prettier from "eslint-config-prettier";
|
|
4
4
|
import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
|
|
5
5
|
import { flatConfigs as importX } from "eslint-plugin-import-x";
|
|
@@ -2,7 +2,16 @@
|
|
|
2
2
|
@type {import("stylelint").Config}
|
|
3
3
|
*/
|
|
4
4
|
const config = {
|
|
5
|
-
|
|
5
|
+
// Generated CSS, and the docs viewer, which is the standard template
|
|
6
|
+
// with its own build. Only the project's hand-written CSS is linted.
|
|
7
|
+
ignoreFiles: [
|
|
8
|
+
".next/**",
|
|
9
|
+
"out/**",
|
|
10
|
+
"build/**",
|
|
11
|
+
"coverage/**",
|
|
12
|
+
"docsSite/**",
|
|
13
|
+
"**/vendor/**",
|
|
14
|
+
],
|
|
6
15
|
extends: [
|
|
7
16
|
"stylelint-config-standard",
|
|
8
17
|
"stylelint-config-recess-order",
|
|
@@ -2,7 +2,16 @@
|
|
|
2
2
|
@type {import("stylelint").Config}
|
|
3
3
|
*/
|
|
4
4
|
const config = {
|
|
5
|
-
|
|
5
|
+
// Generated CSS, and the docs viewer, which is the standard template
|
|
6
|
+
// with its own build. Only the project's hand-written CSS is linted.
|
|
7
|
+
ignoreFiles: [
|
|
8
|
+
".next/**",
|
|
9
|
+
"out/**",
|
|
10
|
+
"build/**",
|
|
11
|
+
"coverage/**",
|
|
12
|
+
"docsSite/**",
|
|
13
|
+
"**/vendor/**",
|
|
14
|
+
],
|
|
6
15
|
extends: [
|
|
7
16
|
"stylelint-config-standard-scss",
|
|
8
17
|
"stylelint-config-recess-order",
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
// Measures every page at every half-screen scroll stop: each element's
|
|
2
2
|
// box and opacity, the element count, the page height and a screenshot.
|
|
3
3
|
// A refactor passes only when every measurement matches the baseline.
|
|
4
|
-
import { expect, type Page, test } from "@playwright/test";
|
|
5
4
|
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
6
5
|
import path from "node:path";
|
|
7
6
|
|
|
7
|
+
import { expect, test, type Page } from "@playwright/test";
|
|
8
|
+
|
|
8
9
|
import { VISUAL_PAGES } from "./visualPages.mjs";
|
|
9
10
|
|
|
10
11
|
const BOX_TOLERANCE_PIXELS = 1;
|
|
@@ -138,7 +139,9 @@ const describeDifferences = ({
|
|
|
138
139
|
};
|
|
139
140
|
|
|
140
141
|
const toFileName = (pagePath: string) =>
|
|
141
|
-
pagePath === "/"
|
|
142
|
+
pagePath === "/"
|
|
143
|
+
? "home"
|
|
144
|
+
: pagePath.replaceAll(/[^a-z0-9]+/gi, "-");
|
|
142
145
|
|
|
143
146
|
for (const pagePath of VISUAL_PAGES) {
|
|
144
147
|
test(`${pagePath} looks exactly as before`, async ({
|