Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
npx lint-staged
npx knip
9 changes: 6 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,18 @@ npm install
npm run build # Build with tsup → dist/
npm test # Run vitest
npm run typecheck # TypeScript type check
npm run lint # ESLint + markdownlint + Prettier check
npm run lint # ESLint + stylelint + markdownlint + Prettier + knip check
npm run lint:fix # Auto-fix all lint and formatting issues
npm run knip # Find unused files, dependencies & exports (knip.jsonc)
npm run dev # Watch mode build
npm run dev:wp # Start a local WordPress on http://127.0.0.1:9400 via wp-playground-cli (ephemeral, Gutenberg latest, collab enabled)
```

## Git Hooks

Pre-commit hook (via husky + lint-staged) auto-formats with Prettier and lints with ESLint + markdownlint on staged files. Hooks are installed automatically by `npm install` (husky's `prepare` script).
Pre-commit hook (via husky + lint-staged) auto-formats and lints staged files — Prettier, ESLint, and markdownlint on JS/TS/Markdown/JSON; stylelint on `wordpress-plugin/src/**/*.scss`; and phpcbf + PHPStan on `wordpress-plugin/**/*.php` — then runs `knip` (a full-project unused files/dependencies/exports check). Hooks are installed automatically by `npm install` (husky's `prepare` script).

`knip` is configured in `knip.jsonc` (root + `wordpress-plugin` as separate workspaces) and runs as the last step of `npm run lint`, so CI covers it too.

## Architecture

Expand Down Expand Up @@ -148,4 +151,4 @@ path (which forks a PHP subprocess via `system()`) is skipped with
`WP_TESTS_SKIP_INSTALL=1` because Playground already provides a fresh SQLite DB
per boot.

Run `npm run lint` from the repo root to lint everything (ESLint + stylelint + markdownlint + Prettier).
Run `npm run lint` from the repo root to lint everything (ESLint + stylelint + markdownlint + Prettier + knip).
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ npm install
npm run build # Build with tsup → dist/
npm test # Run vitest
npm run typecheck # TypeScript type check
npm run lint # ESLint + markdownlint + Prettier check
npm run lint # ESLint + stylelint + markdownlint + Prettier + knip check
npm run dev # Watch mode build
npm run dev:wp # Start a local WordPress via wp-playground-cli (no Docker)
```
Expand All @@ -112,7 +112,7 @@ composer phpcs # PHP CodeSniffer
composer phpstan # PHPStan static analysis
```

Run `npm run lint` from the repo root to lint everything (ESLint + stylelint + markdownlint + Prettier).
Run `npm run lint` from the repo root to lint everything (ESLint + stylelint + markdownlint + Prettier + knip).

## License

Expand Down
29 changes: 29 additions & 0 deletions knip.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"$schema": "./node_modules/knip/schema-jsonc.json",
// System binaries invoked from scripts, not provided by any npm package:
// `composer` (PHP toolchain) and `claude` (the Claude Code CLI).
"ignoreBinaries": ["composer", "claude"],
"workspaces": {
".": {
"project": [
"src/**/*.ts",
"shared/**/*.ts",
"tests/**/*.ts",
"bin/**/*.js"
]
},
"wordpress-plugin": {
// `src/index.ts` registers the Gutenberg plugins (no package.json
// `main`/`exports` to infer it from); the shim is the webpack alias
// target for `@wordpress/interface`; the globs cover Jest tests,
// which live in `test/` folders the Jest plugin doesn't auto-detect.
"entry": [
"src/index.ts",
"src/shims/wordpress-interface.ts",
"src/**/test/**/*.{ts,tsx}",
"src/**/*.test.{ts,tsx}"
],
"project": ["src/**/*.{ts,tsx}"]
}
}
}
Loading
Loading