Getting started
Receive eslint-config in a new or an existing repository, wire a preset, and read your first lint run.
@workspace/eslint-config 2.2.0Developmentunreleased, in development in Foundationbaseline ce081dc3
These steps were carried out in a new, empty pnpm workspace outside every source repository, with a bundle composed in Foundation and nothing else: no path to Foundation and no other source.
A new repository#
Prepare your repository#
A pnpm workspace with
packages/, Node.js 26, and byte-exact checkouts for transferred packages and the applier:* yaml# pnpm-workspace.yamlpackages: - packages/* - apps/*Text# .gitattributespackages/** -text.rps/** -texttools/rps/** -textKeep the applier (
rps-andapply. mjs rps-) undercontract. mjs tools/. Every bundle carries a reference copy of both underrps/ tooling/; see Receiving packages.Receive the package#
Ask the maintainer of Foundation for a bundle.
eslint-can be requested on its own, as an owner:config Terminal# In Foundation, by its maintainerpnpm rps:transfer bundle --owners eslint-config --channel development --out <bundle-folder>Then, in your repository:
Terminalnode tools/rps/rps-apply.mjs plan --bundle <bundle-folder> --developmentnode tools/rps/rps-apply.mjs apply --bundle <bundle-folder> --expect-plan <digest> --developmentThe package now sits in
packages/. Do not edit it there.eslint- config Declare and install#
Declare the package once, in the root
package.. Every workspace below the root resolves it from there:json JSON{ "devDependencies": { "@workspace/eslint-config": "workspace:*" }}Each package or app that runs lint declares its own
eslintandtypescript:JSON{ "devDependencies": { "eslint": "^10.12.0", "typescript": "^6.0.3" }}The plugins the presets load come with the package as its own dependencies. Install, then check that the root resolves the managed copy:
Terminalpnpm installnode tools/rps/rps-apply.mjs verify-install --from .The output must list
@workspace/aseslint- config current. Run it from the folder that declares the package: from an app that does not declare it, it lists nothing and checks nothing.Choose a preset#
In the
eslint.of each package or app, spread the preset that fits its own source files (Presets) and add your ignores after it:config. mjs JavaScript// eslint.config.mjsimport {config} from '@workspace/eslint-config/base'; /** @type {import("eslint").Linter.Config[]} */export default [ ...config, { ignores: ['node_modules/**', 'dist/**'], },];Add the lint script#
The threshold sits in the script, in every package and app that lints:
JSON{ "scripts": { "lint": "eslint . --max-warnings 100" }}Run it and read the count#
Terminalpnpm --filter <package> lintNo output means no findings. Otherwise the last line counts them, for example
✖ 5 problems (0 errors, 5 warnings), and the run still passes. See Checks and troubleshooting for what fails a run.
An existing repository#
Start from the situation your repository is in:
| Your repository | What to do |
|---|---|
has no managed packages and no packages/ | the steps above |
has its own copy at packages/, not managed | see Replacing your own copy below |
| already receives packages from Foundation by managed transfer | add --owners eslint- to the request of your whole set, so the update keeps every package you have (see Updating) |
| receives managed packages from another source repository | your repository has one provenance record from one source, so it cannot take eslint- from Foundation separately. Ask the maintainer how your whole set moves to Foundation |
| has its own ESLint configuration, without this package | receive the package, replace your configuration by a preset plus a trailing block for what is truly your own (Local additions) |
Replacing your own copy#
The applier never writes over a folder it does not manage. With your own copy in place, the plan stops:
1 conflict(s); no operation is planned and nothing will change: RPS-E5 UNMANAGED_TARGET packages/eslint-config: exists and is not managedSee how your copy differs from the bundle, without changing anything:
Terminalnode tools/rps/rps-apply.mjs reconcile --bundle <bundle-folder>Move your copy out of
packages/, to a place outside the workspace, and keep it until the new copy works.Plan and apply the bundle, then install and verify, as in steps 2 and 3 above.
A local change your copy carried is not taken over. If it is useful beyond your repository, propose it to the maintainer of Foundation; otherwise it belongs in your own configuration as a local addition.
After switching#
Run lint in every workspace and compare the counts with those before. New warnings that the shared presets raise are work of your repository. Do not raise the threshold to make a run pass.