@activatus/code-standards 3.3.4 → 3.3.5

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.
@@ -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 | 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) |
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 |
@@ -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
  | --------------------------------------- | ----------------------------------------- |
@@ -70,10 +70,23 @@ 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.4
73
+ **Released:** 2026-10-17 · **Updates from:** version 2 · **Latest:** 3.3.5
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.5.** If the project already applied 3.3.4, check these:
78
+
79
+ - **`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).
80
+
81
+ **What to do:** if the project has no `stylelint.config.mjs`:
82
+
83
+ 1. Install the packages from the [Stylelint page](/docs/Standards/stylelint#installation).
84
+ 2. Copy `static/templates/stylelint/css/stylelint.config.mjs`, or the `scss` one for SCSS.
85
+ 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.
86
+ 4. If `docs/development/coding-standards.md` says Stylelint was set up, check that it really was.
87
+
88
+ **How to check:** `pnpm standards:check` passes, or lists only recorded exceptions; `pnpm lint:css` passes.
89
+
77
90
  **Fixes in 3.3.4.** If the project already applied 3.3.3, check these:
78
91
 
79
92
  - **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.4",
3
+ "version": "3.3.5",
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",
@@ -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 checkStylelint = ({ projectDirectory, templatesDirectory }) => {
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 only for projects with hand-written CSS.
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({ projectDirectory, templatesDirectory }),
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({ projectDirectory, templatesDirectory }),
47
+ ...checkConfigFiles({
48
+ projectDirectory,
49
+ templatesDirectory,
50
+ projectFiles,
51
+ }),
48
52
  ...checkRequiredFiles({ templatesDirectory, projectFiles }),
49
53
  ...checkConstants({ projectFiles }),
50
54
  ...checkStructure({ projectFiles }),