@erclx/canon 5.37.0 → 5.38.0
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/claude/.claude-plugin/plugin.json +1 -1
- package/claude/skills/auto-ship/SKILL.md +1 -1
- package/claude/skills/backlog-triage/SKILL.md +1 -1
- package/claude/skills/build-in-slices/SKILL.md +1 -1
- package/claude/skills/git-issue/references/issue.md +11 -10
- package/claude/skills/markdown-craft/references/markdown.md +3 -2
- package/claude/skills/plan-groundwork/references/groundwork.md +53 -24
- package/claude/skills/review-pr/references/post.md +1 -1
- package/claude/skills/role-orchestrator/SKILL.md +1 -1
- package/claude/skills/role-orchestrator/references/orchestrator-parked.md +1 -1
- package/claude/skills/role-planner/SKILL.md +1 -1
- package/claude/skills/role-worker/SKILL.md +1 -1
- package/claude/skills/target-setup/SKILL.md +3 -4
- package/claude/skills/target-setup/references/verify.md +6 -5
- package/claude/skills/task-board/references/tasks.md +3 -1
- package/docs/target/projects.md +1 -1
- package/docs/target/scenarios.md +1 -1
- package/governance/detect.toml +6 -1
- package/package.json +6 -3
- package/scripts/core/install-check.sh +1 -1
- package/src/commands/claude.ts +0 -1
- package/src/commands/pr.ts +1 -1
- package/src/commands/records.ts +0 -1
- package/src/docs/read.ts +15 -21
- package/src/gate/stages.ts +14 -0
- package/src/markdown/structure.ts +1 -1
- package/src/sandbox/equivalence.ts +7 -9
- package/src/teach/browser/head.ts +2 -2
- package/src/teach/browser/sidebar.ts +3 -3
- package/src/teach/browser/theme.ts +2 -2
- package/src/tooling/inject.ts +2 -2
- package/src/tooling/package.ts +15 -18
- package/src/tooling/verify-stack.ts +6 -3
- package/tooling/astro/configs/.oxfmtrc.json +8 -0
- package/tooling/astro/configs/.prettierrc +13 -0
- package/tooling/astro/manifest.toml +13 -0
- package/tooling/astro/reference.md +15 -5
- package/tooling/base/configs/.oxfmtrc.json +7 -0
- package/tooling/base/configs/scripts/verify.ts +1 -1
- package/tooling/base/manifest.toml +6 -6
- package/tooling/base/reference.md +12 -9
- package/tooling/base/seeds/.lintstagedrc +1 -3
- package/tooling/base/seeds/canon/context/ci.md +3 -3
- package/tooling/base/seeds/canon/context/development.md +2 -2
- package/tooling/claude/manifest.toml +5 -1
- package/tooling/go/reference.md +2 -2
- package/tooling/nextjs/configs/.oxlintrc.json +223 -0
- package/tooling/nextjs/manifest.toml +2 -5
- package/tooling/nextjs/reference.md +4 -4
- package/tooling/php/manifest.toml +6 -1
- package/tooling/php/reference.md +2 -2
- package/tooling/python/manifest.toml +6 -1
- package/tooling/python/reference.md +4 -4
- package/tooling/vite-react/manifest.toml +1 -4
- package/tooling/vite-react/reference.md +3 -3
- package/tooling/web/configs/.oxlintrc.json +213 -0
- package/tooling/web/manifest.toml +9 -13
- package/tooling/web/reference.md +14 -14
- package/tooling/base/configs/.prettierrc +0 -12
- package/tooling/base/seeds/.prettierignore +0 -0
- package/tooling/nextjs/configs/eslint.config.js +0 -91
- package/tooling/web/configs/eslint.config.js +0 -82
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
|
+
"plugins": ["typescript", "unicorn"],
|
|
4
|
+
"categories": {
|
|
5
|
+
"correctness": "off"
|
|
6
|
+
},
|
|
7
|
+
"env": {
|
|
8
|
+
"builtin": true
|
|
9
|
+
},
|
|
10
|
+
"ignorePatterns": [
|
|
11
|
+
".next",
|
|
12
|
+
"next-env.d.ts",
|
|
13
|
+
"dist",
|
|
14
|
+
"dist-ssr",
|
|
15
|
+
"coverage",
|
|
16
|
+
"release",
|
|
17
|
+
".claude",
|
|
18
|
+
".vscode",
|
|
19
|
+
".husky",
|
|
20
|
+
"test-results",
|
|
21
|
+
"playwright-report",
|
|
22
|
+
"blob-report",
|
|
23
|
+
"playwright/.cache"
|
|
24
|
+
],
|
|
25
|
+
"rules": {
|
|
26
|
+
"constructor-super": "error",
|
|
27
|
+
"for-direction": "error",
|
|
28
|
+
"getter-return": "error",
|
|
29
|
+
"no-async-promise-executor": "error",
|
|
30
|
+
"no-case-declarations": "error",
|
|
31
|
+
"no-class-assign": "error",
|
|
32
|
+
"no-compare-neg-zero": "error",
|
|
33
|
+
"no-cond-assign": "error",
|
|
34
|
+
"no-const-assign": "error",
|
|
35
|
+
"no-constant-binary-expression": "error",
|
|
36
|
+
"no-constant-condition": "error",
|
|
37
|
+
"no-control-regex": "error",
|
|
38
|
+
"no-debugger": "error",
|
|
39
|
+
"no-delete-var": "error",
|
|
40
|
+
"no-dupe-class-members": "error",
|
|
41
|
+
"no-dupe-else-if": "error",
|
|
42
|
+
"no-dupe-keys": "error",
|
|
43
|
+
"no-duplicate-case": "error",
|
|
44
|
+
"no-empty": "error",
|
|
45
|
+
"no-empty-character-class": "error",
|
|
46
|
+
"no-empty-pattern": "error",
|
|
47
|
+
"no-empty-static-block": "error",
|
|
48
|
+
"no-ex-assign": "error",
|
|
49
|
+
"no-extra-boolean-cast": "error",
|
|
50
|
+
"no-fallthrough": "error",
|
|
51
|
+
"no-func-assign": "error",
|
|
52
|
+
"no-global-assign": "error",
|
|
53
|
+
"no-import-assign": "error",
|
|
54
|
+
"no-invalid-regexp": "error",
|
|
55
|
+
"no-irregular-whitespace": "error",
|
|
56
|
+
"no-loss-of-precision": "error",
|
|
57
|
+
"no-misleading-character-class": "error",
|
|
58
|
+
"no-new-native-nonconstructor": "error",
|
|
59
|
+
"no-nonoctal-decimal-escape": "error",
|
|
60
|
+
"no-obj-calls": "error",
|
|
61
|
+
"no-prototype-builtins": "error",
|
|
62
|
+
"no-redeclare": "error",
|
|
63
|
+
"no-regex-spaces": "error",
|
|
64
|
+
"no-self-assign": "error",
|
|
65
|
+
"no-setter-return": "error",
|
|
66
|
+
"no-shadow-restricted-names": "error",
|
|
67
|
+
"no-sparse-arrays": "error",
|
|
68
|
+
"no-this-before-super": "error",
|
|
69
|
+
"no-unassigned-vars": "error",
|
|
70
|
+
"no-unreachable": "error",
|
|
71
|
+
"no-unsafe-finally": "error",
|
|
72
|
+
"no-unsafe-negation": "error",
|
|
73
|
+
"no-unsafe-optional-chaining": "error",
|
|
74
|
+
"no-unused-labels": "error",
|
|
75
|
+
"no-unused-private-class-members": "error",
|
|
76
|
+
"no-unused-vars": "error",
|
|
77
|
+
"no-useless-backreference": "error",
|
|
78
|
+
"no-useless-catch": "error",
|
|
79
|
+
"no-useless-escape": "error",
|
|
80
|
+
"no-with": "error",
|
|
81
|
+
"preserve-caught-error": "error",
|
|
82
|
+
"require-yield": "error",
|
|
83
|
+
"use-isnan": "error",
|
|
84
|
+
"valid-typeof": "error",
|
|
85
|
+
"no-array-constructor": "error",
|
|
86
|
+
"no-unused-expressions": "error",
|
|
87
|
+
"typescript/ban-ts-comment": "error",
|
|
88
|
+
"typescript/no-duplicate-enum-values": "error",
|
|
89
|
+
"typescript/no-empty-object-type": "error",
|
|
90
|
+
"typescript/no-explicit-any": "error",
|
|
91
|
+
"typescript/no-extra-non-null-assertion": "error",
|
|
92
|
+
"typescript/no-misused-new": "error",
|
|
93
|
+
"typescript/no-namespace": "error",
|
|
94
|
+
"typescript/no-non-null-asserted-optional-chain": "error",
|
|
95
|
+
"typescript/no-require-imports": "error",
|
|
96
|
+
"typescript/no-this-alias": "error",
|
|
97
|
+
"typescript/no-unnecessary-type-constraint": "error",
|
|
98
|
+
"typescript/no-unsafe-declaration-merging": "error",
|
|
99
|
+
"typescript/no-unsafe-function-type": "error",
|
|
100
|
+
"typescript/no-wrapper-object-types": "error",
|
|
101
|
+
"typescript/prefer-as-const": "error",
|
|
102
|
+
"typescript/prefer-namespace-keyword": "error",
|
|
103
|
+
"typescript/triple-slash-reference": "error"
|
|
104
|
+
},
|
|
105
|
+
"overrides": [
|
|
106
|
+
{
|
|
107
|
+
"files": ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
|
|
108
|
+
"rules": {
|
|
109
|
+
"constructor-super": "off",
|
|
110
|
+
"getter-return": "off",
|
|
111
|
+
"no-class-assign": "off",
|
|
112
|
+
"no-const-assign": "off",
|
|
113
|
+
"no-dupe-class-members": "off",
|
|
114
|
+
"no-dupe-keys": "off",
|
|
115
|
+
"no-func-assign": "off",
|
|
116
|
+
"no-import-assign": "off",
|
|
117
|
+
"no-new-native-nonconstructor": "off",
|
|
118
|
+
"no-obj-calls": "off",
|
|
119
|
+
"no-redeclare": "off",
|
|
120
|
+
"no-setter-return": "off",
|
|
121
|
+
"no-this-before-super": "off",
|
|
122
|
+
"no-unreachable": "off",
|
|
123
|
+
"no-unsafe-negation": "off",
|
|
124
|
+
"no-var": "error",
|
|
125
|
+
"no-with": "off",
|
|
126
|
+
"prefer-const": "error",
|
|
127
|
+
"prefer-rest-params": "error",
|
|
128
|
+
"prefer-spread": "error"
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"files": ["**/*.{ts,tsx,js,jsx}"],
|
|
133
|
+
"rules": {
|
|
134
|
+
"simple-import-sort/imports": "error",
|
|
135
|
+
"simple-import-sort/exports": "error",
|
|
136
|
+
"check-file/filename-naming-convention": [
|
|
137
|
+
"error",
|
|
138
|
+
{
|
|
139
|
+
"**/*.{ts,tsx}": "KEBAB_CASE"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"ignoreMiddleExtensions": true
|
|
143
|
+
}
|
|
144
|
+
],
|
|
145
|
+
"check-file/folder-naming-convention": [
|
|
146
|
+
"error",
|
|
147
|
+
{
|
|
148
|
+
"src/**/!(__tests__)/": "KEBAB_CASE"
|
|
149
|
+
}
|
|
150
|
+
],
|
|
151
|
+
"no-unused-vars": [
|
|
152
|
+
"error",
|
|
153
|
+
{
|
|
154
|
+
"varsIgnorePattern": "^_",
|
|
155
|
+
"argsIgnorePattern": "^_"
|
|
156
|
+
}
|
|
157
|
+
],
|
|
158
|
+
"react/rules-of-hooks": "error",
|
|
159
|
+
"react/exhaustive-deps": "warn",
|
|
160
|
+
"react/static-components": "error",
|
|
161
|
+
"react/use-memo": "error",
|
|
162
|
+
"react/preserve-manual-memoization": "error",
|
|
163
|
+
"react/incompatible-library": "warn",
|
|
164
|
+
"react/immutability": "error",
|
|
165
|
+
"react/globals": "error",
|
|
166
|
+
"react/refs": "error",
|
|
167
|
+
"react/set-state-in-effect": "error",
|
|
168
|
+
"react/error-boundaries": "error",
|
|
169
|
+
"react/purity": "error",
|
|
170
|
+
"react/set-state-in-render": "error",
|
|
171
|
+
"react/unsupported-syntax": "warn",
|
|
172
|
+
"react/only-export-components": [
|
|
173
|
+
"warn",
|
|
174
|
+
{
|
|
175
|
+
"allowConstantExport": true
|
|
176
|
+
}
|
|
177
|
+
]
|
|
178
|
+
},
|
|
179
|
+
"jsPlugins": [
|
|
180
|
+
"eslint-plugin-simple-import-sort",
|
|
181
|
+
"eslint-plugin-check-file"
|
|
182
|
+
],
|
|
183
|
+
"plugins": ["react"],
|
|
184
|
+
"env": {
|
|
185
|
+
"browser": true
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"files": ["src/app/**/*.{ts,tsx}"],
|
|
190
|
+
"rules": {
|
|
191
|
+
"check-file/folder-naming-convention": "off",
|
|
192
|
+
"react/only-export-components": "off"
|
|
193
|
+
},
|
|
194
|
+
"jsPlugins": ["eslint-plugin-check-file"],
|
|
195
|
+
"plugins": ["react"]
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"files": ["**/*.test.{ts,tsx}", "**/*.spec.{ts,tsx}"],
|
|
199
|
+
"rules": {
|
|
200
|
+
"vitest/expect-expect": "error",
|
|
201
|
+
"vitest/no-identical-title": "error",
|
|
202
|
+
"vitest/no-commented-out-tests": "error",
|
|
203
|
+
"vitest/valid-title": "error",
|
|
204
|
+
"vitest/valid-expect": "error",
|
|
205
|
+
"vitest/valid-describe-callback": "error",
|
|
206
|
+
"vitest/require-local-test-context-for-concurrent-snapshots": "error",
|
|
207
|
+
"vitest/no-import-node-test": "error",
|
|
208
|
+
"vitest/no-focused-tests": "error"
|
|
209
|
+
},
|
|
210
|
+
"plugins": ["vitest"]
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"files": [
|
|
214
|
+
"*.config.{js,mjs,cjs,ts}",
|
|
215
|
+
"vitest.config.ts",
|
|
216
|
+
"playwright.config.ts"
|
|
217
|
+
],
|
|
218
|
+
"env": {
|
|
219
|
+
"node": true
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
]
|
|
223
|
+
}
|
|
@@ -2,13 +2,10 @@
|
|
|
2
2
|
name = "nextjs"
|
|
3
3
|
extends = "web"
|
|
4
4
|
runtime = "bun"
|
|
5
|
-
scaffold = "bunx create-next-app@latest {{name}} --typescript --tailwind --
|
|
5
|
+
scaffold = "bunx create-next-app@latest {{name}} --typescript --tailwind --no-linter --app --src-dir --import-alias \"@/*\" --use-bun --skip-install --disable-git --no-agents-md --yes"
|
|
6
6
|
|
|
7
7
|
[dependencies.dev]
|
|
8
|
-
packages = [
|
|
9
|
-
"next",
|
|
10
|
-
"@tailwindcss/postcss",
|
|
11
|
-
]
|
|
8
|
+
packages = ["next", "@tailwindcss/postcss"]
|
|
12
9
|
|
|
13
10
|
[scripts]
|
|
14
11
|
"preview" = "WORKTREE_PORT_OFFSET=$(bash scripts/worktree-port.sh) && export WORKTREE_PORT_OFFSET && next start --port $((3000 + WORKTREE_PORT_OFFSET))"
|
|
@@ -4,22 +4,22 @@
|
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
The nextjs stack covers Next.js + TypeScript projects using the App Router. It ships golden configs for `next.config.ts`, `vitest.config.ts` (plain `defineConfig`, no bundler merge), `playwright.config.ts` (build-then-preview), and an
|
|
7
|
+
The nextjs stack covers Next.js + TypeScript projects using the App Router. It ships golden configs for `next.config.ts`, `vitest.config.ts` (plain `defineConfig`, no bundler merge), `playwright.config.ts` (build-then-preview), and an `.oxlintrc.json` that replaces the web layer's with `.next` ignores and an App Router override. Shared web tooling (oxlint base, screenshot template, VS Code, CI, verify script) comes from the `web` layer.
|
|
8
8
|
|
|
9
9
|
## Scaffold checklist
|
|
10
10
|
|
|
11
|
-
1. Scaffold with `bunx create-next-app@latest <name> --typescript --tailwind --
|
|
11
|
+
1. Scaffold with `bunx create-next-app@latest <name> --typescript --tailwind --no-linter --app --src-dir --import-alias "@/*" --use-bun --skip-install --disable-git --no-agents-md --yes`. `--no-agents-md` skips the scaffold-time `AGENTS.md`/`CLAUDE.md` write, which otherwise duplicates the root `CLAUDE.md`. `--no-linter` skips the scaffold's `eslint.config.mjs` and `lint` script, and is accepted though `--help` lists only `--eslint` and `--biome`.
|
|
12
12
|
2. Install web tooling: `canon tooling sync web . --write`
|
|
13
13
|
3. Install nextjs configs: `canon tooling sync nextjs . --write`
|
|
14
14
|
4. Extend the `ci` and `development` context entries under `canon/context/` per the web reference's extend sections plus the nextjs rows below.
|
|
15
|
-
5. Run `bun run lint:fix` then `bun run check`.
|
|
15
|
+
5. Run `bun run lint:fix`, then `bun run format`, then `bun run check`.
|
|
16
16
|
|
|
17
17
|
## What ships as golden configs
|
|
18
18
|
|
|
19
19
|
- `next.config.ts`: `agentRules: false` stops Next from regenerating `AGENTS.md`/`CLAUDE.md` on every run, which would otherwise compete with the root `CLAUDE.md`. `turbopack.root: import.meta.dirname` pins the workspace root, silencing Next's multi-lockfile inference warning in any checkout carrying more than one lockfile above the project, a worktree included.
|
|
20
20
|
- `vitest.config.ts`: plain `defineConfig`, no `mergeConfig` or `getViteConfig` since Next has no Vite config to merge from. jsdom, globals, setup file, `passWithNoTests: true`, v8 coverage, `.next/**` in test excludes.
|
|
21
21
|
- `playwright.config.ts`: all browsers, `webServer` runs `bun run build && bun run preview` on port `3000` plus `WORKTREE_PORT_OFFSET`, `reuseExistingServer: false`. `DIST_PREBUILT` drops the `build` half, matching the astro stack's flag.
|
|
22
|
-
-
|
|
22
|
+
- `.oxlintrc.json`: replaces the web layer's whole file, since oxlint reads one config, with `.next` and `next-env.d.ts` added to `ignorePatterns`. `react/only-export-components` is `off` for `src/app/**`, since route and layout files export non-component values the rule would otherwise flag. `check-file/folder-naming-convention` is `off` for the same subtree, since App Router's bracket, paren, and at-sign folder syntax (dynamic segments, route groups, parallel slots) fails `KEBAB_CASE`.
|
|
23
23
|
|
|
24
24
|
## Port
|
|
25
25
|
|
|
@@ -12,7 +12,12 @@ scaffold = "mkdir {{name}} && cd {{name}} && composer init -n --name example/{{n
|
|
|
12
12
|
"test:run" = "vendor/bin/phpunit --testdox"
|
|
13
13
|
|
|
14
14
|
[gitignore]
|
|
15
|
-
"# PHP" = [
|
|
15
|
+
"# PHP" = [
|
|
16
|
+
"vendor/",
|
|
17
|
+
".php-cs-fixer.cache",
|
|
18
|
+
".phpunit.cache/",
|
|
19
|
+
".phpunit.result.cache",
|
|
20
|
+
]
|
|
16
21
|
|
|
17
22
|
[verify]
|
|
18
23
|
prepare = "bun init -y && composer require --dev friendsofphp/php-cs-fixer phpstan/phpstan phpunit/phpunit"
|
package/tooling/php/reference.md
CHANGED
|
@@ -9,11 +9,11 @@ The php stack covers Composer projects on PHP 8.3 or later, formatted by PHP CS
|
|
|
9
9
|
## Scaffold checklist
|
|
10
10
|
|
|
11
11
|
1. Scaffold with `composer init -n --name <vendor>/<name> --autoload src/`. The package name and namespace are the project's own identity, so this stack never ships a `composer.json`.
|
|
12
|
-
2. Seed `package.json` so the base layer's bun-side tools (husky,
|
|
12
|
+
2. Seed `package.json` so the base layer's bun-side tools (husky, oxfmt, commitlint) have a target to install into: `bun init -y`.
|
|
13
13
|
3. Install base tooling: `canon tooling sync base . --write`
|
|
14
14
|
4. Install php tooling: `canon tooling sync php . --write`
|
|
15
15
|
5. Install the dev tools: `composer require --dev friendsofphp/php-cs-fixer phpstan/phpstan phpunit/phpunit`. The manifest declares no `[dependencies.dev]`, because manifest injection runs `bun add -D`, which cannot install a Composer package. This step stays manual.
|
|
16
|
-
6. Run `bun run lint:fix` then `bun run check`.
|
|
16
|
+
6. Run `bun run lint:fix`, then `bun run format`, then `bun run check`.
|
|
17
17
|
|
|
18
18
|
Use PHP 8.3 or later, since PHPUnit 12 requires it.
|
|
19
19
|
|
|
@@ -13,7 +13,12 @@ scaffold = "uv init --package {{name}}"
|
|
|
13
13
|
"test:cov" = "uv run pytest --cov --cov-report=term-missing --cov-report=html"
|
|
14
14
|
|
|
15
15
|
[gitignore]
|
|
16
|
-
"# Python" = [
|
|
16
|
+
"# Python" = [
|
|
17
|
+
".pytest_cache/",
|
|
18
|
+
".mypy_cache/",
|
|
19
|
+
".ruff_cache/",
|
|
20
|
+
".coverage_cache/",
|
|
21
|
+
]
|
|
17
22
|
|
|
18
23
|
[verify]
|
|
19
24
|
prepare = "bun init -y && uv add --dev ruff mypy pytest pytest-cov && uv sync"
|
|
@@ -11,12 +11,12 @@ Configs ship as sidecar files (`ruff.toml`, `mypy.ini`, `pytest.ini`, `.coverage
|
|
|
11
11
|
## Scaffold checklist
|
|
12
12
|
|
|
13
13
|
1. Scaffold with `uv init --package <name>`. This creates `pyproject.toml` with a `uv_build` backend, `.python-version` pinned to 3.14, and `src/<name with underscores>/__init__.py` holding an annotated `def main() -> None:`, so source lands under `src/` where `mypy.ini`, `pytest.ini`, and `.coveragerc` look for it. `uv init` defaults `requires-python` to `>=3.14`, which matches the `.python-version` pin this stack ships.
|
|
14
|
-
2. Seed `package.json` so the base layer's bun-side tools (husky,
|
|
14
|
+
2. Seed `package.json` so the base layer's bun-side tools (husky, oxfmt, commitlint) have a target to install into: `bun init -y`. Without this the sync drops base configs but skips the dep install, since `resolve_missing_deps` short-circuits when `package.json` is absent.
|
|
15
15
|
3. Install base tooling: `canon tooling sync base . --write`
|
|
16
16
|
4. Install python tooling: `canon tooling sync python . --write`
|
|
17
17
|
5. Install Python tooling deps: `uv add --dev ruff mypy pytest pytest-cov`. v1 of this stack does not declare these in `[dependencies.dev]` because manifest injection hardcodes `bun add -D`, which can not install Python packages. Until the injector branches on `runtime`, this step is manual.
|
|
18
18
|
6. Sync the lockfile and create the venv: `uv sync`.
|
|
19
|
-
7. Run `bun run lint:fix` then `bun run check`.
|
|
19
|
+
7. Run `bun run lint:fix`, then `bun run format`, then `bun run check`.
|
|
20
20
|
|
|
21
21
|
The python stack also ships `tests/test_smoke.py` as a copy-once seed. `pytest` collects at least one test on first run, so `bun run test:run` exits 0 instead of the empty-collection exit code 5. Delete or replace the smoke test with real tests.
|
|
22
22
|
|
|
@@ -31,7 +31,7 @@ The python stack also ships `tests/test_smoke.py` as a copy-once seed. `pytest`
|
|
|
31
31
|
|
|
32
32
|
## Hybrid project shape
|
|
33
33
|
|
|
34
|
-
A python project synced with this stack ends up with both `package.json` from base and `pyproject.toml` from `uv init`. The base layer brings
|
|
34
|
+
A python project synced with this stack ends up with both `package.json` from base and `pyproject.toml` from `uv init`. The base layer brings oxfmt, commitlint, and husky for non-Python files. Both `node_modules/` and `.venv/` coexist at the project root. The hybrid shape gives Python projects access to the toolkit's cross-cutting tools without forking the base stack.
|
|
35
35
|
|
|
36
36
|
## Dependencies
|
|
37
37
|
|
|
@@ -39,7 +39,7 @@ The manifest declares no `[dependencies.dev]`. Manifest injection currently call
|
|
|
39
39
|
|
|
40
40
|
## Verify command
|
|
41
41
|
|
|
42
|
-
`canon tooling verify python` runs the manifest's `[verify] prepare` before Sync, which is checklist steps 2, 5, and 6: `bun init -y`, `uv add --dev ruff mypy pytest pytest-cov`, and `uv sync`. `uv init` writes no `package.json`, and a verify that reaches its end with none fails, so the prepare is what lets `bun run lint:fix` and `bun run check` run at all. Python's `verify.json` requires the `lint`, `typecheck`, and `test:run` scripts that delegate to `uv run`, so the run needs `uv` on the machine and a network for the installs. The end-to-end test and screenshot phases are gated on `package.json` script keys that python does not declare, so they skip.
|
|
42
|
+
`canon tooling verify python` runs the manifest's `[verify] prepare` before Sync, which is checklist steps 2, 5, and 6: `bun init -y`, `uv add --dev ruff mypy pytest pytest-cov`, and `uv sync`. `uv init` writes no `package.json`, and a verify that reaches its end with none fails, so the prepare is what lets `bun run lint:fix`, `bun run format`, and `bun run check` run at all. Python's `verify.json` requires the `lint`, `typecheck`, and `test:run` scripts that delegate to `uv run`, so the run needs `uv` on the machine and a network for the installs. The end-to-end test and screenshot phases are gated on `package.json` script keys that python does not declare, so they skip.
|
|
43
43
|
|
|
44
44
|
## Anti-patterns
|
|
45
45
|
|
|
@@ -5,10 +5,7 @@ runtime = "bun"
|
|
|
5
5
|
scaffold = "bun create vite@latest {{name}} --template react-ts"
|
|
6
6
|
|
|
7
7
|
[dependencies.dev]
|
|
8
|
-
packages = [
|
|
9
|
-
"vite",
|
|
10
|
-
"@vitejs/plugin-react",
|
|
11
|
-
]
|
|
8
|
+
packages = ["vite", "@vitejs/plugin-react"]
|
|
12
9
|
|
|
13
10
|
[scripts]
|
|
14
11
|
"dev" = "WORKTREE_PORT_OFFSET=$(bash scripts/worktree-port.sh) && export WORKTREE_PORT_OFFSET && vite"
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
The vite-react stack covers Vite + React + TypeScript projects: web apps and Chrome extensions. It ships golden configs for `vite.config.ts`, `vitest.config.ts` (merging from vite config), `playwright.config.ts`, and a unified `tsconfig.json` with `@/` path alias. Shared web tooling (
|
|
7
|
+
The vite-react stack covers Vite + React + TypeScript projects: web apps and Chrome extensions. It ships golden configs for `vite.config.ts`, `vitest.config.ts` (merging from vite config), `playwright.config.ts`, and a unified `tsconfig.json` with `@/` path alias. Shared web tooling (oxlint, screenshot template, VS Code, CI, verify script) comes from the `web` layer.
|
|
8
8
|
|
|
9
9
|
## Scaffold checklist
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@ The vite-react stack covers Vite + React + TypeScript projects: web apps and Chr
|
|
|
12
12
|
2. Install base and web tooling: `canon tooling sync web . --write`
|
|
13
13
|
3. Install vite-react deps and configs: `canon tooling sync vite-react . --write`
|
|
14
14
|
4. Extend the `ci` and `development` context entries under `canon/context/` per the web reference's extend sections plus the vite-react rows below.
|
|
15
|
-
5. Run `bun run lint:fix` then `bun run check`.
|
|
15
|
+
5. Run `bun run lint:fix`, then `bun run format`, then `bun run check`.
|
|
16
16
|
|
|
17
17
|
## What ships as golden configs
|
|
18
18
|
|
|
@@ -28,7 +28,7 @@ When scaffolding a Chrome extension, override the installed golden configs:
|
|
|
28
28
|
- `vite.config.ts`: use `crx({ manifest })` and `zip()` from `@crxjs/vite-plugin` instead of `react()` alone. Keep the derived `server.port` and `server.strictPort: true`, set `server.hmr.clientPort` to the same derived value, and add `chrome-extension://` to CORS origins. Drop `VITE_BASE_URL`.
|
|
29
29
|
- `vitest.config.ts`: use a standalone `defineConfig` (no `mergeConfig`). crxjs plugin breaks Vitest. Declare `@vitejs/plugin-react` and `@tailwindcss/vite` directly. Add `**/release/**` to excludes and `manifest.config.ts`, `**/*.d.ts` to coverage excludes.
|
|
30
30
|
- `playwright.config.ts`: chromium-only (Firefox and WebKit cannot run extensions). Bundled `chromium` channel. No `baseURL` or `webServer`. Tests load the built extension directly from `dist/`.
|
|
31
|
-
- `e2e/fixtures.ts`: extend Playwright base `test` with `context` (persistent context loading the extension from `dist/`) and `extensionId` (extracted from service worker URL). Rename `use` to `apply` to avoid
|
|
31
|
+
- `e2e/fixtures.ts`: extend Playwright base `test` with `context` (persistent context loading the extension from `dist/`) and `extensionId` (extracted from service worker URL). Rename `use` to `apply` to avoid oxlint's `react/rules-of-hooks`. `waitForEvent('serviceworker')` blocks until the MV3 service worker registers.
|
|
32
32
|
- `manifest.config.ts`: use `defineManifest` from `@crxjs/vite-plugin`. Read `name` and `version` from `package.json`. Entry points `src/popup/index.html`, `src/sidepanel/index.html`, `src/background/index.ts`, `src/content/main.tsx`. Permissions `sidePanel`, `contentSettings`, `storage`. Icon `public/logo.png` at size 48.
|
|
33
33
|
- `screenshot` script: `bun run build && bun e2e/screenshot.ts` (no preview server).
|
|
34
34
|
- Additional gitignore entries: `*.crx`, `*.pem`, `release/`.
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
|
+
"plugins": ["typescript", "unicorn"],
|
|
4
|
+
"categories": {
|
|
5
|
+
"correctness": "off"
|
|
6
|
+
},
|
|
7
|
+
"env": {
|
|
8
|
+
"builtin": true
|
|
9
|
+
},
|
|
10
|
+
"ignorePatterns": [
|
|
11
|
+
"dist",
|
|
12
|
+
"dist-ssr",
|
|
13
|
+
"coverage",
|
|
14
|
+
"release",
|
|
15
|
+
".claude",
|
|
16
|
+
".vscode",
|
|
17
|
+
".husky",
|
|
18
|
+
"test-results",
|
|
19
|
+
"playwright-report",
|
|
20
|
+
"blob-report",
|
|
21
|
+
"playwright/.cache"
|
|
22
|
+
],
|
|
23
|
+
"rules": {
|
|
24
|
+
"constructor-super": "error",
|
|
25
|
+
"for-direction": "error",
|
|
26
|
+
"getter-return": "error",
|
|
27
|
+
"no-async-promise-executor": "error",
|
|
28
|
+
"no-case-declarations": "error",
|
|
29
|
+
"no-class-assign": "error",
|
|
30
|
+
"no-compare-neg-zero": "error",
|
|
31
|
+
"no-cond-assign": "error",
|
|
32
|
+
"no-const-assign": "error",
|
|
33
|
+
"no-constant-binary-expression": "error",
|
|
34
|
+
"no-constant-condition": "error",
|
|
35
|
+
"no-control-regex": "error",
|
|
36
|
+
"no-debugger": "error",
|
|
37
|
+
"no-delete-var": "error",
|
|
38
|
+
"no-dupe-class-members": "error",
|
|
39
|
+
"no-dupe-else-if": "error",
|
|
40
|
+
"no-dupe-keys": "error",
|
|
41
|
+
"no-duplicate-case": "error",
|
|
42
|
+
"no-empty": "error",
|
|
43
|
+
"no-empty-character-class": "error",
|
|
44
|
+
"no-empty-pattern": "error",
|
|
45
|
+
"no-empty-static-block": "error",
|
|
46
|
+
"no-ex-assign": "error",
|
|
47
|
+
"no-extra-boolean-cast": "error",
|
|
48
|
+
"no-fallthrough": "error",
|
|
49
|
+
"no-func-assign": "error",
|
|
50
|
+
"no-global-assign": "error",
|
|
51
|
+
"no-import-assign": "error",
|
|
52
|
+
"no-invalid-regexp": "error",
|
|
53
|
+
"no-irregular-whitespace": "error",
|
|
54
|
+
"no-loss-of-precision": "error",
|
|
55
|
+
"no-misleading-character-class": "error",
|
|
56
|
+
"no-new-native-nonconstructor": "error",
|
|
57
|
+
"no-nonoctal-decimal-escape": "error",
|
|
58
|
+
"no-obj-calls": "error",
|
|
59
|
+
"no-prototype-builtins": "error",
|
|
60
|
+
"no-redeclare": "error",
|
|
61
|
+
"no-regex-spaces": "error",
|
|
62
|
+
"no-self-assign": "error",
|
|
63
|
+
"no-setter-return": "error",
|
|
64
|
+
"no-shadow-restricted-names": "error",
|
|
65
|
+
"no-sparse-arrays": "error",
|
|
66
|
+
"no-this-before-super": "error",
|
|
67
|
+
"no-unassigned-vars": "error",
|
|
68
|
+
"no-unreachable": "error",
|
|
69
|
+
"no-unsafe-finally": "error",
|
|
70
|
+
"no-unsafe-negation": "error",
|
|
71
|
+
"no-unsafe-optional-chaining": "error",
|
|
72
|
+
"no-unused-labels": "error",
|
|
73
|
+
"no-unused-private-class-members": "error",
|
|
74
|
+
"no-unused-vars": "error",
|
|
75
|
+
"no-useless-backreference": "error",
|
|
76
|
+
"no-useless-catch": "error",
|
|
77
|
+
"no-useless-escape": "error",
|
|
78
|
+
"no-with": "error",
|
|
79
|
+
"preserve-caught-error": "error",
|
|
80
|
+
"require-yield": "error",
|
|
81
|
+
"use-isnan": "error",
|
|
82
|
+
"valid-typeof": "error",
|
|
83
|
+
"no-array-constructor": "error",
|
|
84
|
+
"no-unused-expressions": "error",
|
|
85
|
+
"typescript/ban-ts-comment": "error",
|
|
86
|
+
"typescript/no-duplicate-enum-values": "error",
|
|
87
|
+
"typescript/no-empty-object-type": "error",
|
|
88
|
+
"typescript/no-explicit-any": "error",
|
|
89
|
+
"typescript/no-extra-non-null-assertion": "error",
|
|
90
|
+
"typescript/no-misused-new": "error",
|
|
91
|
+
"typescript/no-namespace": "error",
|
|
92
|
+
"typescript/no-non-null-asserted-optional-chain": "error",
|
|
93
|
+
"typescript/no-require-imports": "error",
|
|
94
|
+
"typescript/no-this-alias": "error",
|
|
95
|
+
"typescript/no-unnecessary-type-constraint": "error",
|
|
96
|
+
"typescript/no-unsafe-declaration-merging": "error",
|
|
97
|
+
"typescript/no-unsafe-function-type": "error",
|
|
98
|
+
"typescript/no-wrapper-object-types": "error",
|
|
99
|
+
"typescript/prefer-as-const": "error",
|
|
100
|
+
"typescript/prefer-namespace-keyword": "error",
|
|
101
|
+
"typescript/triple-slash-reference": "error"
|
|
102
|
+
},
|
|
103
|
+
"overrides": [
|
|
104
|
+
{
|
|
105
|
+
"files": ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
|
|
106
|
+
"rules": {
|
|
107
|
+
"constructor-super": "off",
|
|
108
|
+
"getter-return": "off",
|
|
109
|
+
"no-class-assign": "off",
|
|
110
|
+
"no-const-assign": "off",
|
|
111
|
+
"no-dupe-class-members": "off",
|
|
112
|
+
"no-dupe-keys": "off",
|
|
113
|
+
"no-func-assign": "off",
|
|
114
|
+
"no-import-assign": "off",
|
|
115
|
+
"no-new-native-nonconstructor": "off",
|
|
116
|
+
"no-obj-calls": "off",
|
|
117
|
+
"no-redeclare": "off",
|
|
118
|
+
"no-setter-return": "off",
|
|
119
|
+
"no-this-before-super": "off",
|
|
120
|
+
"no-unreachable": "off",
|
|
121
|
+
"no-unsafe-negation": "off",
|
|
122
|
+
"no-var": "error",
|
|
123
|
+
"no-with": "off",
|
|
124
|
+
"prefer-const": "error",
|
|
125
|
+
"prefer-rest-params": "error",
|
|
126
|
+
"prefer-spread": "error"
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"files": ["**/*.{ts,tsx,js,jsx}"],
|
|
131
|
+
"rules": {
|
|
132
|
+
"simple-import-sort/imports": "error",
|
|
133
|
+
"simple-import-sort/exports": "error",
|
|
134
|
+
"check-file/filename-naming-convention": [
|
|
135
|
+
"error",
|
|
136
|
+
{
|
|
137
|
+
"**/!(App).{ts,tsx}": "KEBAB_CASE"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"ignoreMiddleExtensions": true
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
"check-file/folder-naming-convention": [
|
|
144
|
+
"error",
|
|
145
|
+
{
|
|
146
|
+
"src/**/!(__tests__)/": "KEBAB_CASE"
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
"no-unused-vars": [
|
|
150
|
+
"error",
|
|
151
|
+
{
|
|
152
|
+
"varsIgnorePattern": "^_",
|
|
153
|
+
"argsIgnorePattern": "^_"
|
|
154
|
+
}
|
|
155
|
+
],
|
|
156
|
+
"react/rules-of-hooks": "error",
|
|
157
|
+
"react/exhaustive-deps": "warn",
|
|
158
|
+
"react/static-components": "error",
|
|
159
|
+
"react/use-memo": "error",
|
|
160
|
+
"react/preserve-manual-memoization": "error",
|
|
161
|
+
"react/incompatible-library": "warn",
|
|
162
|
+
"react/immutability": "error",
|
|
163
|
+
"react/globals": "error",
|
|
164
|
+
"react/refs": "error",
|
|
165
|
+
"react/set-state-in-effect": "error",
|
|
166
|
+
"react/error-boundaries": "error",
|
|
167
|
+
"react/purity": "error",
|
|
168
|
+
"react/set-state-in-render": "error",
|
|
169
|
+
"react/unsupported-syntax": "warn",
|
|
170
|
+
"react/only-export-components": [
|
|
171
|
+
"warn",
|
|
172
|
+
{
|
|
173
|
+
"allowConstantExport": true
|
|
174
|
+
}
|
|
175
|
+
]
|
|
176
|
+
},
|
|
177
|
+
"jsPlugins": [
|
|
178
|
+
"eslint-plugin-simple-import-sort",
|
|
179
|
+
"eslint-plugin-check-file"
|
|
180
|
+
],
|
|
181
|
+
"plugins": ["react"],
|
|
182
|
+
"env": {
|
|
183
|
+
"browser": true
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"files": ["**/*.test.{ts,tsx}", "**/*.spec.{ts,tsx}"],
|
|
188
|
+
"rules": {
|
|
189
|
+
"vitest/expect-expect": "error",
|
|
190
|
+
"vitest/no-identical-title": "error",
|
|
191
|
+
"vitest/no-commented-out-tests": "error",
|
|
192
|
+
"vitest/valid-title": "error",
|
|
193
|
+
"vitest/valid-expect": "error",
|
|
194
|
+
"vitest/valid-describe-callback": "error",
|
|
195
|
+
"vitest/require-local-test-context-for-concurrent-snapshots": "error",
|
|
196
|
+
"vitest/no-import-node-test": "error",
|
|
197
|
+
"vitest/no-focused-tests": "error"
|
|
198
|
+
},
|
|
199
|
+
"plugins": ["vitest"]
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"files": [
|
|
203
|
+
"*.config.{js,mjs,cjs,ts}",
|
|
204
|
+
"vite.config.ts",
|
|
205
|
+
"vitest.config.ts",
|
|
206
|
+
"playwright.config.ts"
|
|
207
|
+
],
|
|
208
|
+
"env": {
|
|
209
|
+
"node": true
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
]
|
|
213
|
+
}
|
|
@@ -6,16 +6,9 @@ scaffold = ""
|
|
|
6
6
|
|
|
7
7
|
[dependencies.dev]
|
|
8
8
|
packages = [
|
|
9
|
-
"
|
|
10
|
-
"eslint-config-prettier",
|
|
9
|
+
"oxlint@1.87.0",
|
|
11
10
|
"eslint-plugin-check-file",
|
|
12
|
-
"eslint-plugin-react-hooks",
|
|
13
|
-
"eslint-plugin-react-refresh",
|
|
14
11
|
"eslint-plugin-simple-import-sort",
|
|
15
|
-
"eslint-plugin-vitest",
|
|
16
|
-
"globals",
|
|
17
|
-
"typescript-eslint",
|
|
18
|
-
"@eslint/js",
|
|
19
12
|
"typescript@^6",
|
|
20
13
|
"react",
|
|
21
14
|
"react-dom",
|
|
@@ -32,12 +25,9 @@ packages = [
|
|
|
32
25
|
"@playwright/test",
|
|
33
26
|
"tailwindcss",
|
|
34
27
|
"@tailwindcss/vite",
|
|
35
|
-
"prettier-plugin-tailwindcss",
|
|
36
28
|
]
|
|
37
29
|
|
|
38
30
|
[scripts]
|
|
39
|
-
"lint" = "eslint . --max-warnings 0"
|
|
40
|
-
"lint:fix" = "eslint . --fix --max-warnings 0"
|
|
41
31
|
"test" = "vitest"
|
|
42
32
|
"test:run" = "vitest run --reporter=verbose"
|
|
43
33
|
"test:ui" = "vitest --ui"
|
|
@@ -50,12 +40,18 @@ packages = [
|
|
|
50
40
|
"smoke:prod" = "bun e2e/screenshot.ts --check-console-clean --require-base-url"
|
|
51
41
|
|
|
52
42
|
[scripts.override]
|
|
53
|
-
"lint" = "
|
|
43
|
+
"lint" = "oxlint --max-warnings 0"
|
|
44
|
+
"lint:fix" = "oxlint --fix --max-warnings 0"
|
|
54
45
|
"screenshot" = "PREVIEW_PORT=$(bash scripts/worktree-port.sh 4173) && export PREVIEW_PORT && bash scripts/screenshot.sh"
|
|
55
46
|
"readme-screenshot" = "PREVIEW_PORT=$(bash scripts/worktree-port.sh 4173) && export PREVIEW_PORT && bash scripts/readme-screenshot.sh"
|
|
56
47
|
|
|
57
48
|
[gitignore]
|
|
58
49
|
"# Build" = ["dist/"]
|
|
59
50
|
"# Coverage" = ["coverage/"]
|
|
60
|
-
"# Playwright" = [
|
|
51
|
+
"# Playwright" = [
|
|
52
|
+
"test-results/",
|
|
53
|
+
"playwright-report/",
|
|
54
|
+
"blob-report/",
|
|
55
|
+
"playwright/.cache/",
|
|
56
|
+
]
|
|
61
57
|
"# Screenshots" = ["screenshots/"]
|