This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
@naverpay/code-style is a pnpm + Turborepo monorepo that publishes NaverPay's shared
linting/formatting tooling to npm. Each package under packages/* is independently versioned
and published. There are two kinds of packages:
- Built packages (
eslint-config,eslint-plugin) — real source compiled by Vite into dual CJS/ESM bundles underdist/. Theirpackage.jsonexportspoint at./dist/cjs/...and./dist/esm/..., so the package must be built before its exports resolve. - Config-only packages (
prettier-config,stylelint-config,biome-config,oxlint-config,oxfmt-config,editorconfig,markdown-lint,code-style-cli) — ship raw config files (.json/.js) referenced directly bymain/exports/bin. No build step, nodist/.
The repo dogfoods its own packages: the root eslint.config.mjs consumes
@naverpay/eslint-config + @naverpay/eslint-plugin (via workspace:*), and .prettierrc /
.stylelintrc extend the published configs.
Each package has its own CLAUDE.md with precise structure, build/test, and extension notes —
read the relevant one before working inside a package.
| Package | Kind | Guide |
|---|---|---|
@naverpay/eslint-config |
built (Vite) | packages/eslint-config/CLAUDE.md |
@naverpay/eslint-plugin |
built (Vite) | packages/eslint-plugin/CLAUDE.md |
@naverpay/code-style-cli |
CLI, no build | packages/code-style-cli/CLAUDE.md |
@naverpay/markdown-lint |
CLI + config | packages/markdown-lint/CLAUDE.md |
@naverpay/stylelint-config |
config (rule modules) | packages/stylelint-config/CLAUDE.md |
@naverpay/prettier-config |
config-only | packages/prettier-config/CLAUDE.md |
@naverpay/biome-config |
config-only | packages/biome-config/CLAUDE.md |
@naverpay/oxfmt-config |
config-only | packages/oxfmt-config/CLAUDE.md |
@naverpay/oxlint-config |
config-only | packages/oxlint-config/CLAUDE.md |
@naverpay/editorconfig |
config-only (copied) | packages/editorconfig/CLAUDE.md |
Requires Node >=20.13.1 and pnpm >=9.1.3 (pinned to pnpm@9.1.3). Always use pnpm.
pnpm install # also runs `lefthook install` via postinstall
pnpm build # turbo build — builds eslint-config & eslint-plugin only
pnpm test # turbo test (vitest); test depends on build, so build runs first
pnpm lint # eslint; `prelint` builds the workspace first
pnpm lint:fix
pnpm prettier # check; `prettier:fix` to write
pnpm markdownlint # `markdownlint:fix` to writeBuild ordering matters. Turbo's build has dependsOn: ["^build"] and eslint-config
depends on eslint-plugin, so plugin builds first. test, test:watch, and prelint all
depend on build — a stale or missing dist/ will produce confusing failures in lint/test.
Tests use vitest ("test": "vitest run" in each buildable package). Scope with Turbo:
pnpm turbo test --filter=@naverpay/eslint-plugin # one package
pnpm --filter @naverpay/eslint-plugin test # bypass turbo (no auto-build)
cd packages/eslint-plugin && pnpm vitest run lib/rules/sort-exports.test.js # one file
cd packages/eslint-plugin && pnpm vitest watchNote: eslint-config still contains a legacy jest.config.js, but the active runner is vitest
(see its test script). markdown-lint has its own vitest.config.js.
Flat-config (ESLint 9) presets. Root index.js exposes configs.{node,react,typescript,strict,packageJson};
each lives in its own directory (node/, react/, typescript/, strict/, packageJson/, yaml/)
as index.js + configs.js (+ rules/). A separate ./custom export
(custom/index.js) provides composable rule factories (e.g. importOrder,
typescriptNamingConvention) that consumers call with options. Built via Vite with two entries
(./index.js, ./custom/index.js). Tests in tests/.
Custom ESLint rules in lib/rules/*.js, registered in lib/index.js, each documented in
docs/<rule>.md with a colocated *.test.js. Current rules: cognitive-complexity,
import-server-only, memo-react-components, optimize-svg-components,
peer-deps-in-dev-deps, prevent-default-import, sort-exports, svg-unique-id. Built via
Vite from ./lib/index.js. When adding a rule: add to lib/rules/, register in
lib/index.js, add docs/<rule>.md + tests.
cli.js (bin: code-style) — interactive installer using @inquirer/prompts. Detects the
package manager from lockfiles, then installs/updates selected configs and writes their config
files. The catalog of tools (package names + config file scaffolds) lives in configs.js; add
new installable tools there.
The Vite builds use @naverpay/pite's createViteConfig wrapper (see each package's
vite.config.mjs), which emits the dual CJS/ESM dist/ layout.
Versioning/publishing is driven by Changesets (baseBranch: main, access: public).
- Any change to a publishable package needs a changeset:
pnpm changeset(or use thenaverpay-changeset:changesetskill). A CI workflow (changesets-detect-add.yml) nudges PRs that are missing one. - The publish workflow (
release.yml) runs on push tomain: it builds, then publishes viapnpm release(changeset publish --directory dist). Canary/RC releases are triggered by commentingcanary-publish/rc-publish(or/canary-publish//rc-publish) on a PR.
- Git hooks via lefthook (
lefthook.yml):pre-commitruns eslint + prettier --check + markdownlint on staged files (parallel);commit-msgruns@naverpay/commit-helperto validate the message. pnpm.overridesin the rootpackage.jsonreplaces@changesets/assemble-release-planwith NaverPay's fork — do not remove.- The root ESLint config enforces
@naverpay/peer-deps-in-dev-depson everypackage.json: peer dependencies must also appear in devDependencies.