@kirill.konshin/lint
v0.8.10
Published
Vite+ (Oxlint + Oxfmt), ESLint + Prettier + lint-staged configs and AI agent rules/skills for monorepos
Readme
@kirill.konshin/lint
Vite+ configuration (Oxlint, Oxfmt, staged checks) — or ESLint + Prettier + lint-staged + Husky without Vite+ — plus AI agent rules & skills for monorepos, in one package.
Upgrading from an older version: use the lint-migrate skill (shipped in skills/, installed by lint-prepare).
Installation
Recommended, with Vite+:
$ yarn add -D vite-plus @kirill.konshin/lint @yarnpkg/typesWithout Vite+, see ESLint + Prettier. vite-plus is a required peer either way: the vitePlus key of lint.config.ts is typed with its config.
Every project whose packageManager is Yarn must directly install @yarnpkg/types; Yarn PnP does not allow yarn.config.cjs to require a transitive dependency (Vite+ does not support PnP anyway).
PNPM
https://eslint.org/docs/latest/use/getting-started#manual-set-up
auto-install-peers=true
node-linker=hoistedYarn constraints
yarn.config.cjs:
/** @type {import('@yarnpkg/types')} */
const { defineConfig } = require('@yarnpkg/types');
const { defineYarnConfig } = require('@kirill.konshin/lint/yarn');
module.exports = defineConfig(defineYarnConfig());defineYarnConfig reads the root overrides and resolutions. Each named non-peer dependency in a leaf package must use the root override reference or resolution range; overrides wins when both fields name the same package. Nested npm overrides and $dependency references are supported.
When the root has no overrides field, @types/node, @types/react, @types/react-dom, next, eslint, typescript, and vite must each use one range across the workspace. The root declaration wins; otherwise the first leaf path supplies the range. Run yarn constraints --fix to apply unambiguous changes.
With Vite+, vite is an alias of the Vite+ core and vitest is the version Vite+ bundles — pin both at the root:
{
"devDependencies": { "vite": "npm:@voidzero-dev/vite-plus-core@^1.3.0", "vite-plus": "^1.3.0" },
"resolutions": { "vite": "npm:@voidzero-dev/vite-plus-core@^1.3.0", "vitest": "5.0.5" }
}@vitest/* packages (coverage-v8, web-worker, …) must match the bundled Vitest exactly (5.0.5), or vp test refuses to run coverage.
.gitignore
.DS_Store
*.tsbuildinfo
.tscache
.turbo
.nx
.next
build
coverage
dist
dist-*
next-env.d.ts
node_modules
npm-debug*
out
*storybook.log
vite-env.d.ts
yarn-error*
.yarnrc.local.yml
# https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versionsList need to be verified, especially build, coverage, dist must be verified not to exclude legit folders. With Vite+ add .vite-hooks/_ (the generated hook dispatcher).
lint.config.ts
Every project that installs this package has one lint.config.ts, in the workspace root (a monorepo has exactly one; packages are never searched). Every entry point reads it: vitePlusConfig, eslintConfig and lint-prepare (which warns while it is missing; the defaults apply until then). Write it by hand (or let an agent write it per the lint-repo skill); no tool generates it. The smallest one:
import { defineLintConfig } from '@kirill.konshin/lint/config';
export default defineLintConfig({});Import from @kirill.konshin/lint/config — it loads no ESLint plugin. Node loads the file natively (type stripping, Node ≥ 22.18), so use erasable TypeScript only, and set "type": "module" in the root package.json (otherwise Node warns on every load).
Toggle notation, the same for every key:
undefined(default) — auto-detect, see Detectiontrue— force ON (use when detection misses a tool, can be useful to see the error why tool is missing)false— force OFF, same as{ enabled: false }{ /* options */ }— impliesenabled: trueeven if omitted;enabled: falseturns OFF keeping the other options
import { defineLintConfig, tsExts } from '@kirill.konshin/lint/config'; // tsExts, scanWorkspace: for globs and file lists
export default defineLintConfig({
// enabled (default true) = tools are ON unless said otherwise;
// strict (default false) = probes from cwd only, no workspace evidence scans
detection: { enabled: true, strict: false }, // default
// ON by default; app roots auto-detected (next.config.*, package.json depending on next, src/{app,pages}/);
// several apps auto-detect as array; pass the package root, not src
next: { rootDir: 'apps/web' }, // string or array
storybook: true, // force ON if detection failed
turbo: false, // force OFF
nx: true,
jest: false,
vitest: { enabled: true },
// ON by default; auto-detected single entry CSS; explicit path always wins over the scan
tailwind: { cssConfigPath: 'apps/web/src/app/index.css' },
// ESLint only
eslint: {
defaultIgnore: { importMetaUrl: import.meta.url }, // OFF by default; .gitignore + .prettierignore as ESLint ignores
typeAware: true, // OFF by default (slow) - see "Type-aware rules"
},
// Vite+ only: settings, plus the project's own Vite+ blocks (merged over the defaults, see "Vite+")
vitePlus: {
typeAware: false, // ON by default: `vp check` is the type check
lint: { rules: {}, overrides: [], ignorePatterns: ['generated'] }, // added to the defaults
fmt: { ignorePatterns: ['generated'] }, // added to the defaults (.idea, .husky, .yarn, OpenSpec files)
test: { projects: ['packages/*'] }, // any other Vite+ / Vite block passes through
},
// skills lint-prepare installs, keyed by source, merged over the defaults (see "AI Agent Rules")
skills: {
'expo/skills': false, // a default source, turned off
'vercel-labs/agent-skills': { skills: { 'vercel-react-native-skills': false } }, // a default source, one skill left out
'mattpocock/skills': { skills: { tdd: true } }, // an extra source, only this skill
'@kirill.konshin/lint': { skills: { 'lint-electron': false } }, // this package's own skills
'GoogleChrome/modern-web-guidance': { skills: { 'chrome-extensions': true } }, // an opt-in skill of a default source
},
// graphify code graph, see "graphify"; left out: used when `graphify` is on PATH
graphify: { version: '0.9.102' }, // true or options: installed into .venv with uv; false: off
// package rules by name: false leaves a rule out
rules: { redux: false },
});Entry points take the same shape as their last argument, merged deep over the file (objects merge, arrays and values are replaced): use it only for per-package differences in a monorepo (e.g. a nested ESLint config).
Vite+ (recommended)
vite.config.ts at the workspace root is always the same — every setting and every project block lives in the vitePlus key of lint.config.ts:
import { vitePlusConfig } from '@kirill.konshin/lint/vite-plus';
import { defineConfig } from 'vite-plus';
export default defineConfig(vitePlusConfig());vitePlusConfig returns the lint (Oxlint), fmt (Oxfmt) and staged blocks plus the project blocks as a Promise; defineConfig from vite-plus awaits it. Its optional arguments (vitePlusConfig(config, overrides): Vite+ blocks, then lint.config.ts overrides) are for exceptions only.
- Merging: lists add up (
plugins,jsPlugins,overrides,ignorePatterns), maps merge by key (rules,settings,env), astagedblock replaces the default - Building blocks are exported:
lintConfig(config)(synchronous, takes a resolved config),fmtConfig(),stagedConfig() - Rolldown module-directive warnings (
'use server','use client') default off for builds and dependency optimization; setbuild.rolldownOptions.checks.moduleLevelDirectiveoroptimizeDeps.rolldownOptions.checks.moduleLevelDirectivetotrueto re-enable. This changes logging only, not directive handling. - Lint and format settings live in the root config only: Vite+ ignores nested
lint/fmtblocks, uselint.overrides/fmt.overrideswith workspace paths .gitignoreand.prettierignoreare honoured by Oxfmt; the recommended.prettierignoreentries are defaultfmt.ignorePatterns, add others there
What maps where:
Not carried over: @nx/dependency-checks (Oxlint does not lint JSON), @typescript-eslint/naming-convention (type-aware only, off by default). @nx/eslint-plugin and the Tailwind plugin need the eslint package installed (as a library; ESLint itself does not run; Tailwind: a known gap, see Issues). Oxlint type-aware linting and type checking (tsgolint, the TypeScript 7 engine) are on by default — vp check is the type check, vp pack does not type-check; vitePlus: { typeAware: false } turns them off. tsgolint rejects tsconfig options TypeScript 7 removed (target: es5, moduleResolution: node, downlevelIteration).
package.json:
{
"scripts": {
"postinstall": "lint-prepare init && vp config", // this order: vp config fills the Vite+ section lint-prepare writes; `prepare` for published roots, see npm-yarn rule
"lint": "vp check --fix",
"lint:staged": "vp staged",
"build": "vp run -r build", // every workspace package, in dependency order
"start": "vp run -r --parallel start",
},
}WebStorm: the Oxc plugin (.idea/externalDependencies.xml, OxcSettings.xml, OxfmtSettings.xml) with Prettier disabled — templates in the lint-webstorm skill.
.vite-hooks/pre-commit:
vp stagedvp config installs the hook dispatcher and fills the Vite+ agent instructions into the <!--VITE PLUS START--> section lint-prepare writes into AGENTS.md — so it runs after lint-prepare (vp config never creates the section itself; vp migrate --agent would, but also rewrites dependencies). A core.hooksPath left by Husky blocks it: git config --unset core.hooksPath once. CI runs vp check (no --fix).
Library packages build with vp pack from a pack block (tsdown) in their own vite.config.ts, and test with vp test; tests import from vite-plus/test.
Editor Config .editorconfig
Oxfmt reads it too; fmtConfig() sets the Prettier behaviors that differ from it.
root = true
[*]
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = false
max_line_length = 120
[*.md]
max_line_length = 99999
[*.{js,jsx,ts,tsx,cjs,cts,mjs,mts,md,mdx,htm,html,vue}]
indent_size = 4
[*.{css,scss,sass,less,yml,yaml,json,json5,graphql,graphqls,xml}]
indent_size = 2
[Makefile]
indent_style = tabESLint + Prettier (without Vite+, legacy, not recommended)
$ yarn add -D eslint prettier vite-plus @kirill.konshin/lint @yarnpkg/types husky lint-staged.prettierignore
Create .prettierignore file:
.idea
.husky
.yarn
# OpenSpec writes these; they stay exactly as `openspec update` leaves them
.agents/skills/openspec-*
.claude/skills/openspec-*
.claude/commands/opsxhttps://prettier.io/docs/ignore:
Prettier will also follow rules specified in the ".gitignore" file if it exists in the same directory from which it is run.
ESLint
eslint.config.mjs:
Every tool integration — Next.js, Nx, Turborepo, Storybook, Jest, Vitest, Tailwind — is auto-detected (the package probes are exported for debugging as has* functions - hasNext(), hasNx(), ...; they run when a gate needs them, never on import). Settings come from lint.config.ts; eslintConfig(overrides) merges its argument over them:
import { defineConfig } from 'eslint/config';
import { eslintConfig } from '@kirill.konshin/lint';
// every tool integration auto-detected, settings from lint.config.ts
export default defineConfig(await eslintConfig());eslintConfig returns a Promise (natively awaited by ESLint), to compose with your own blocks, await it:
import { defineConfig } from 'eslint/config';
import { eslintConfig, includeIgnoreFile } from '@kirill.konshin/lint';
export default defineConfig([
...(await eslintConfig({ eslint: { defaultIgnore: { importMetaUrl: import.meta.url } } })),
{
name: 'Custom rules',
rules: {
// overrides
},
},
includeIgnoreFile(import.meta.url, '.customignore'), // extra ignore files beyond defaultIgnore
]);Type-aware file list
eslint.typeAware takes the typescript-eslint project service options:
import { defineLintConfig, scanWorkspace } from '@kirill.konshin/lint/config';
export default defineLintConfig({
eslint: {
// OFF by default (slow) - see "Type-aware rules"
typeAware: {
allowDefaultProject: scanWorkspace('{vite,vitest}.config.ts'), // no default; absolute paths are relativized; ** globs are not supported
maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING: 50, // defaults to the list length, (default 8), set it explicitly only when supplying multi-match globs
tsconfigRootDir: process.cwd(), // defaults to the detected workspace root
},
},
});Per-package configs (monorepo)
ESLint 10 resolves the config per linted file: the nearest eslint.config.mjs up the tree wins entirely (no cascading/inheritance of rules). For full per-app Next/Tailwind linting in a multi-app monorepo, give each app its own config — either inherit the root and add overrides, apps/web/eslint.config.mjs:
import { defineConfig } from 'eslint/config';
import rootConfig from '../../eslint.config.mjs';
export default defineConfig([...(await rootConfig), { rules: { 'tailwindcss/no-custom-classname': 'off' } }]);…or call eslintConfig again with the overrides this app needs, apps/web/eslint.config.mjs:
import { fileURLToPath } from 'node:url';
import { defineConfig } from 'eslint/config';
import { eslintConfig } from '@kirill.konshin/lint';
export default defineConfig(
await eslintConfig({
detection: { enabled: false, strict: true }, // fully explicit: this config only sees its own scope
// do not use workspace-wide auto-scan, provide exactly ONE from THIS leaf package
tailwind: { cssConfigPath: fileURLToPath(new URL('src/app/index.css', import.meta.url)) },
}),
);⚠️ Nearest-wins means root-only blocks (e.g. custom rules) do NOT apply to the subtree unless inherited or re-declared.
Detection runs against the workspace root even from a nested config, so per-app tool settings (cssConfigPath) should be explicit absolute paths — relative ones depend on the lint cwd.
The Tailwind block auto-scopes to the workspace package owning the entry CSS (emitted as the block's basePath), so a single root config doesn't flag class-like strings in non-Tailwind packages; pass tailwind: { scoped: false } to apply it workspace-wide (no-op when the entry is owned by the workspace root itself).
Prettier .prettierrc.mjs
import { prettier } from '@kirill.konshin/lint/prettier';
export default prettier;or
import { prettier } from '@kirill.konshin/lint/prettier';
export default {
...prettier,
// overrides
};Import from /prettier, not the package root: the root loads every ESLint plugin, which would slow down each Prettier run.
package.json (legacy for ESLint / Husky / Lint Staged)
{
"scripts": {
"eslint": "eslint --fix --concurrency=auto --cache --cache-location node_modules/.cache/eslint", // to see files use --debug
"prettier": "prettier --write --log-level=warn --ignore-path .gitignore --ignore-path .prettierignore", // to see files use --log-level=log
"lint": "yarn eslint . && yarn prettier .",
"lint:staged": "lint-staged",
},
}IDEA settings
- Eslint:
**/*.{js,jsx,ts,tsx,cjs,cts,mjs,mts,md,mdx,htm,html,vue} - Prettier:
{**/*,*}.{js,jsx,ts,tsx,cjs,cts,mjs,mts,md,mdx,htm,html,vue,css,scss,sass,less,yml,yaml,json,json5,graphql,graphqls,xml}
Lint Staged (legacy, see VitePlus)
.lintstagedrc.mjs
import { listStaged } from '@kirill.konshin/lint/lint-staged';
export default listStaged;Import from /lint-staged, not the package root, for the same reason as /prettier. Tasks run the eslint / prettier scripts above through node --run (Node ≥ 22, node_modules linker), not yarn, which loads the whole project state before every script.
Husky
By default, always use the prepare script, as Husky recommends — it never runs on consumers' installs of a published package, so it needs no guards. The bare husky command (v9+; husky install is the deprecated v8 form) installs the git hooks:
package.json:
{
"scripts": {
"prepare": "lint-prepare init && husky && next types"
}
}⚠️
next typesis optional and should only be added if project uses Next.js typed routes, as additional measure, types will be generated anyway
⚠️ Yarn 2+ (Berry) skips top-level
prepareon install (lifecycle scripts) — runyarn prepareyourself / in CI. For a private root, preferpostinstall: Yarn does run it on install, so hooks land automatically (incl. CI) with no manual step and no pinst guard. Keeppreparefor published packages — an unguardedpostinstallwould run on consumers' installs.
.husky/pre-commit:
#!/bin/zsh
node --run lint:stagedRun scripts with node --run and tools directly (Husky puts node_modules/.bin on PATH): a yarn hop costs seconds.
Note source ~/.zshrc # for VSCode terminal may be added for VSCode terminal that is not aware of ZSH. Do not add unless specifically asked, and remove if present.
AI Agent Rules
The package also ships a standardized set of coding conventions (rules/*.md) and skills for AI coding assistants, wired into a repo by the lint-prepare CLI.
Manual Setup (lint-prepare CLI) w/o prepare or postinstall
# Initialize (skips if AGENTS.md exists and wasn't generated by this tool)
lint-prepare init
# Force update AGENTS.md
lint-prepare updateCustomization
The generated AGENTS.md has a # Custom Rules section at the bottom — add project-specific rules there; they're preserved across updates.
How it works
In the project root, lint-prepare:
- Creates real
rules/andskills/directories in.agents/(canonical, cross-tool — Codex reads it) and.claude/(Claude Code). - Links every
rules/*.mdfile into both, except the ones therulesmap oflint.config.tsturns off (rules: { redux: false }). Links point straight at the installed package's real location (node_modules/@kirill.konshin/lint, or the workspace package). A rule of yours with the same name in.agents/wins, the package one is not installed. - Installs the skills of the
skillsmap oflint.config.ts, merged over the defaults, with theskillsCLI, into.agents/skills/and from there into.claude/skills/. The map is keyed by source, each value uses the toggle notation;skills: { name: true | false | 'package' }picks skills of a source — with notrueor package entry every skill except thefalseones; with one, only the skills that are on. A package name gates a skill: it is on when the root or a workspace package declares that package independenciesordevDependencies('vercel-cli': 'vercel'), off withdetection: false;true/falseinlint.config.tsoverrides the gate:- npm packages (
@scope/name, or a name without/) are dependencies that ship skills:skills experimental_sync -y -r -a codex claude-codelinks everyskills/<name>/folder of the dependencies of the root and of every workspace package; the map only leaves some out (--exclude). Default: this package's own skills ('@kirill.konshin/lint': true) — e.g.lint-repo, which sets up the tooling above and audits the repo against the rules. - Git sources (
owner/repo) are installed withskills add, atrefwhen set (pin a full 40-character commit SHA). A source whose skillsskills-lock.jsonalready has at the same ref is not fetched again.lint.config.tsowns the remote skills ofskills-lock.json: a remote skill it no longer lists is removed (skills remove). - Defaults — every project gets them, turn off what it does not need: the Core Pack (
vercel-labs/agent-skillsincl.web-design-guidelines,vercel/ai,shadcn-ui/ui,heroui-inc/heroui,mui/material-uiwithoutmaterial-ui-tailwind,neondatabase/agent-skills) and the official skills of the libraries the rules cover (vercel/next.js,reduxjs/redux-toolkit,vercel/turborepo,nrwl/nx-ai-agents-config,expo/skills,microsoft/playwright-cli), and Modern Web Guidance (GoogleChrome/modern-web-guidance:modern-web-guidance;chrome-extensionsis opt-in). The Modern Web Guidance skill runs its CLI withnpx: no dependency to add. Gated by theverceldependency (projects that install the Vercel CLI):vercel/vercel(vercel-cli) anddeploy-to-vercelofvercel-labs/agent-skills. Each source lists its skills and pins a commit:DEFAULT_LINT_CONFIGinsrc/config.ts. - A skill folder of yours with the same name in
.agents/skills/wins. - A failed CLI run is a warning, the install goes on: run
lint-prepareagain. - On CI (
CIset) nothing remote is fetched (--no-remote, noskills add): no network needed. - Telemetry is off (
DISABLE_TELEMETRY=1) unless you set it. - It writes
skills-lock.json: add it to.gitignore,lint-preparecreates it again on every install. - A personal skill (
~/.claude/skills) overrides a project skill with the same name in Claude Code.
- npm packages (
- Mirrors your own top-level entries from
.agents/{rules,skills}/into.claude/. Commands are not synced: make them skills. - Removes dead links (e.g. after renaming a file) and the links it placed before but no longer needs, including what older versions placed (skill links,
commands/). Each directory gets a generated.gitignorelisting its links and the skills theskillsCLI installed, so your own entries stay tracked. - Writes an empty marker pair for each section another tool owns into the generated
AGENTS.md— currently Vite+ (<!--VITE PLUS START-->). The tool fills it, so run it afterlint-preparein the same install script (lint-prepare init && vp config): tools write their own agent content, nothing is copied by hand. - Generates
AGENTS.mdfor other assistants (Codex, Cursor, Copilot, …) with a# Rulessection — one entry per rule (the package's and yours): its title, frontmatterdescription, thepathsit is scoped to and a plain link to its.agents/rules/<file>entry — and symlinksCLAUDE.mdto it. The links are never@imports: Claude Code loads.claude/rulesitself and honours each rule'spaths, while an import would load every rule into every session. - Sets up graphify when
lint.config.tsasks for it or finds it.
graphify
graphify builds a code knowledge graph (graphify-out/) that agents query instead of grepping. It is a Python tool (PyPI graphifyy), so it is not a dependency: lint-prepare sets it up by the graphify key of lint.config.ts:
| graphify | Executable | Skill | AGENTS.md section, Claude Code hooks | Root .gitignore |
| ------------------------------ | ------------------------------------------------------------- | ----- | ------------------------------------ | ------------------------- |
| left out | graphify on PATH (any install); none: skipped with a note | yes | no | /graphify-out |
| true, { version: '0.9.x' } | project .venv, created with uv (required) | yes | yes | /graphify-out, /.venv |
| false | none | no | removed | none |
- The skills: graphify installs them where skills live (
graphify install --project): the generic flavor into.agents/skills/graphify(Codex), the Claude Code flavor into.claude/skills/graphify, which also registers it in.claude/CLAUDE.md. Both are git-ignored like the skills theskillsCLI installs (lint-prepareknows them by graphify's.graphify_versionstamp);falseremoves them and the registration. - The graph:
graphify update .(code only, no LLM, no API key) after everything else. Commit nothing ofgraphify-out/. trueonly, committed, so every clone gets the same:lint-preparewrites a## graphifyheading into the generatedAGENTS.md, followed by its own## graphify virtualenvheading with how to reach.venv; thengraphify claude installfills the## graphifysection (it replaces up to the next##heading) and writes its hooks into.claude/settings.json, whichlint-preparepoints at"$CLAUDE_PROJECT_DIR"/.venv/bin/graphify. The next generation keeps the section.graphifyyversion for.venv:GRAPHIFY_VERSIONof@kirill.konshin/lint/config, orversion.- Nothing on CI; a failed graphify run is a warning, except a missing
uvfortrue.engines.uvof this package documents theuvversion. - The root
.gitignoregets a marked block (# @kirill.konshin/lint: graphify); it followslint.config.tsonly, never what a machine has. Vite+ ignoresgraphify-outtoo.
OpenSpec
For a repository specified with OpenSpec the package ships one bin, spec-tools — a single self-contained file, skills/spec-tools/scripts/cli.js — four skills:
spec-tools stewardand thespec-stewardskill — the corpus gate (citations, binding, the scenario ratchet), the edit hook, corpus-quality audits and review rounds.spec-toolsand its skill — the change gates, the workflow-evidence gate, the requirement-level specification diff, the code-conformance audit, and the glue a CI pipeline runs around a headless AI review (verdict gate, merge-request comment, HTML reports).spec-verify— the skill every audit worker loads.spec-author— the skill that writes or edits a specification in place, the default direct-edit path (/spec-author).
Which to reach for:
Where each runs:
Specifications change only by hand, or when the steward skill applies the owner's accepted review answers; spec-tools steward check --fix makes the only mechanical repairs. No audit edits code or specifications.
The audits share one set of judging rules, skills/spec-tools/references/rules/: each finding gets a severity and a confidence (0–100) from its reader and, when it is severe and sure enough, from a judge; the merge fuses the two readings and its thresholds give the tier. An ERROR is a demonstrated defect with a production effect (a broken flow, a contract or invariant violation, a sensitive-data leak, a performance problem): severity 70 or more at a confidence above 70%, by default. The thresholds and the judge gate are AUDIT_SEVERITY_*, AUDIT_CONFIDENCE_* and AUDIT_JUDGE_* variables; the affected set of a merge request or a push is tuned by AUDIT_AFFECTED_* (the spec-tools contract). spec-verify's checks 2–5 are spec-steward's items 10, 9, 11 and 5, worded identically — steward asks whether the rule should change, spec-verify whether the code or the rule has diverged. Every file the tools write is under .spec-audit/, as YAML; Markdown only as the final report.
Setup and the GitLab pipeline are in the spec-tools skill.
Safety checks
Only the files lint-prepare knows (package files and mirrors of yours) and dead links are touched: real files are never overwritten (e.g. your own .claude/rules/*.md) and nothing is written through a symlinked directory. .codex/ is not touched: Codex reads .agents/skills and AGENTS.md, and the links earlier versions placed in .codex/ stay until you delete them. init/update refuse to run if CLAUDE.md isn't a symlink. If AGENTS.md exists and wasn't generated by this tool, init skips it; use update to force regeneration.
Migration
Upgrading between minor versions: the lint-migrate skill, one section per version step. 0.7 → 0.8 in short:
- One
lint.config.tsin the workspace root holds every setting,"type": "module"in the rootpackage.json; the entry points take overrides only - ESLint:
defineLintConfig(options)→eslintConfig(overrides);typeAwareanddefaultIgnore→ theeslintkey - Vite+:
vite.config.tsbecomesdefineConfig(vitePlusConfig()); its blocks (lint,fmt,test, …) and toggles move intolint.config.ts,typeAwareand the blocks under thevitePluskey;vitePlusConfigis now async - Skills: the root
package.jsonskillsfield → theskillsmap oflint.config.ts; package rules can be turned off with therulesmap vite-plusis a required peer, also without Vite+ (it typeslint.config.ts)
Development
Build
vp pack (tsdown, the pack block of vite.config.ts) builds two things: the library — ESM and declarations from src/*.ts, one file per module, plus the CommonJS Yarn entry from src/yarn.cts — into dist, and the spec-tools CLI — spec-steward included — into one self-contained file, skills/spec-tools/scripts/cli.js, which the skills and CI jobs name. The root vp check checks types (type-aware Oxlint, the TypeScript 7 engine); the build does not. Consumers load dist, and this monorepo builds lint first in its root postinstall before running lint-prepare.
ESLint and Vite+ configs
src/config.ts is the lint.config.ts schema, its defaults and its loader (the ./config entry, no ESLint plugin). src/gates.ts holds every tool gate once; the ESLint blocks and src/vitePlus.ts both call it. src/vitePlus.ts reuses the conventions (src/conventions.ts) of the ESLint blocks and imports no ESLint plugin: it references the JS plugins by resolved path. src/oxlintPlugin.ts is the Oxlint JS plugin with the custom rules.
Declarations are generated from the TypeScript source and retain the underlying package types — Linter.Config, Tailwind plugin settings, Prettier Config, and lint-staged Configuration.
Every block lives in a themed src/configs/*.ts file and is exported as a standalone function for manual composition (and easy testing/mocking), in the order eslintConfig applies them: baseConfig (JS recommended + global ignores + globals + core-rule overrides), defaultIgnoreConfig, reactConfig (the whole React family, see below), prettierConfig, storybookConfig, typeAwareConfig (off by default; ordered before the import blocks so its naming-convention rule loses to the default-export relaxation), importXConfig (includes the default-export relaxation for conventional files), importSortConfig, unusedImportsConfig, promiseConfig, unicornConfig, turboConfig, tailwindConfig, nxConfig, jestConfig, vitestConfig, testConfig.
Tool-gated functions take the same value as their lint.config.ts key and gate themselves (tailwindConfig(true), nxConfig(false) → [], tailwindConfig({ cssConfigPath })). reactConfig(nextFlag, strict) is the whole family in its load-bearing order — Next is just a shortcut to an opinionated React/TypeScript setup, so the TS wiring, overrides and settings apply no matter whether Next or plain React won: nextConfig (chooser: nextBaseConfig when Next is enabled, reactBaseConfig fallback otherwise) → typescriptOverridesConfig → nextOverridesConfig → reactSettingsConfig — all exported individually too.
Detection
Due to limitations package visibility between leaf and root this package has to be creative to support config-free detection.
- Package probe —
local-pkg'sisPackageExistsanchored at the workspace root, the same scope the plugins resolve from at lint time (has<Pkg>exported for debugging). - Evidence scan — tool config files across the workspace: the root directory plus every workspace package (the real
workspaces/pnpm-workspace.yamlglobs via@manypkg/get-packages, not a depth heuristic), skipping dot dirs, build outputs, and.gitignored files; exported asscanWorkspace. All scans of a process share one filesystem cache, so each directory is read once. Catches tools installed only in leaf packages, invisible to the probe (1). The workspace root itself comes from env (PROJECT_CWD/npm_config_local_prefix) with@manypkg/find-rootas the fallback (workspace manifest walk, nearestpackage.jsonfor single-package repos; exported asfindWorkspaceRoot), so linting from inside a package still sees the whole repo. - Hoisting, not bridging — the plugins need the tool's package resolvable from the workspace root; a tool that is evidently in use (2) but not resolvable there (1) is a hard error with hoisting guidance (keep default hoisting, pnpm
public-hoist-pattern, or a root devDependency — see the error text) instead of a silent skip or a cryptic plugin crash. Fix it once in the package manager config; nothing is symlinked at lint time. - Yarn Berry PnP — there is no hoisting to configure; declare the tools at the workspace root as well, keeping versions in sync with the leaves (e.g. the
"vitest": "$vitest"version-alias hack);nextdocuments its own monorepo ESLint setup.
¹ the plugins need the tool's package resolvable at lint time (tailwindcss for the theme-loading workers, next for eslint-config-next's internal requires, storybook for its plugin's static import, jest for version sniffing) — resolvable from the workspace root, or the hard error of step 3 fires. Exception: jest is only needed for the version of jest/no-deprecated-functions, so a leaf-only install passes its version in settings.jest.version, and with none anywhere that one rule is off.
vitePlusConfig runs the same gates (src/gates.ts, shared with the ESLint blocks), with three differences: Oxlint JS plugins load from this package, so only storybook (its plugin imports storybook), nx (needs eslint) and tailwind (needs eslint, a known gap, see Issues, besides tailwindcss) demand a resolvable package; vitest is ON unless set to false or Jest is detected (Vite+ bundles Vitest; set both to lint a repo that runs both); next needs no package (Oxlint's nextjs plugin is native). typeAware differs by backend: eslint.typeAware is OFF by default (slow), vitePlus.typeAware ON.
The machinery is controlled by the detection key of lint.config.ts (same toggle notation as the tools):
detection: false— tools are OFF unless explicitly enabled; enabled tools still auto-detect their settings (step 2)detection: { strict: true }— only step 1 runs, from cwd instead of the workspace root: each tool's package resolvable from cwd,nx.jsonat cwd — no workspace evidence scans (2). Mandatory settings (cssConfigPath) must then be explicitdetection: { enabled: false, strict: true }— fully explicit: tools on only when set, probes only
Set LINT_DEBUG=1 to trace the machinery: has* probe results, every workspace scan (glob, root, files found) and each tool's gate verdict (supplied options, absolutized & scanned evidence files, effective enabled status + reason).
basePath: 'packages/xxx'(ESLint ≥ 9.30) can scope a config object to a directory within a single root config, but it won't help with detection —eslintConfigdetects once, workspace-wide (e.g. Tailwind still demands exactly one entry CSS), so per-app settings would still have to be spelled out block by block; nested configs are the cleaner tool for this.
Type-aware rules (optional, disabled by default for performance)
Config files living outside any tsconfig include (vite.config.ts, .storybook/main.ts, …) need typescript-eslint's allowDefaultProject — it has no default here, and upstream forbids ** in its patterns, so either spell out each directory level or generate the exact file list with the exported scanWorkspace (workspace-root-anchored, .gitignore- and build-output-aware; its absolute paths are relativized against tsconfigRootDir automatically):
AI Rule file format
---
type: always_apply # or agent_requested
description: Set of rules for projects which use Xxx # Required for agent_requested
paths:
- '**/*.xxx'
---Issues
- Package managers
- [ ] TODO verify the package end-to-end (workspace-root detection, Tailwind /
next.config.*scans,has*capability probes, plugin resolution,eslintConfigunder a real lint run) with each manager:- [x] Yarn Berry, node-modules linker — this repo, fully covered
- [ ] Yarn Berry PnP — root-declared
tailwindcssverified working (see "Detection" step 4); full config run (plugin loading, capability probes) unverified since the switch to@manypkg/find-root/local-pkg - [ ] Yarn 1 (classic) — root detection now delegates to
@manypkg/find-root(workspace-manifest walk); unverified since the switch - [ ] pnpm — root detection via
@manypkg/find-root(pnpm-workspace.yaml);public-hoist-patternguidance unverified in a real pnpm workspace - [ ] npm — env fast-path (
npm_config_local_prefix) verified previously;@manypkg/find-rootfallback unverified since the switch
- [x] Yarn constraints helper enforces root overrides/resolutions or default dependency consistency
- [ ] TODO verify the package end-to-end (workspace-root detection, Tailwind /
- Vite+
- [ ]
eslint-plugin-tailwindcssas an Oxlint JS plugin needs theeslintpackage (a required peer, loaded through@typescript-eslint/utils): without itvp checkstops before linting withCannot find module 'eslint'. Workaround until fixed:eslintin the rootdevDependencies, as a library only (thelint-tailwindskill)
- [ ]
- ESLint 9
- [x] https://github.com/microsoft/rushstack/issues/4635 Failed to patch ESLint because the calling module was not recognized
- [x] https://github.com/microsoft/rushstack/issues/4965 Failed to patch ESLint because the calling module was not recognized
- ESLint 10
- [ ] https://github.com/vercel/next.js/issues/89764 TypeError: Error while loading rule 'react/display-name': contextOrFilename.getFilename is not a function
- [x]
import/no-default-export([email protected]) crashes every lint run under ESLint 10's flat config - itssourceType()helper readscontext.parserOptions, which isundefined(not{}) there. Worked around by registeringeslint-plugin-import-x(a drop-in replacement) under its ownimport-xkey - see theeslint-plugin-import-xblock inindex.js- since ESLint 10 hard-errors ("Cannot redefine plugin") if you try to reuse theimportkeyeslint-config-nextalready registers. The enforced rule is thereforeimport-x/no-default-export, notimport/*.
License
MIT
