Active Foundation

Search documentation

Search all pages, headings and text, in the current package or topic or in all documentation.

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#

  1. 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/** -text

    Keep the applier (rps-apply.mjs and rps-contract.mjs) under tools/rps/. Every bundle carries a reference copy of both under tooling/; see Receiving packages.

  2. Receive the package#

    Ask the maintainer of Foundation for a bundle. eslint-config can be requested on its own, as an owner:

    Terminal
    # In Foundation, by its maintainerpnpm rps:transfer bundle --owners eslint-config --channel development --out <bundle-folder>

    Then, in your repository:

    Terminal
    node tools/rps/rps-apply.mjs plan --bundle <bundle-folder> --developmentnode tools/rps/rps-apply.mjs apply --bundle <bundle-folder> --expect-plan <digest> --development

    The package now sits in packages/eslint-config. Do not edit it there.

  3. Declare and install#

    Declare the package once, in the root package.json. Every workspace below the root resolves it from there:

    JSON
    {  "devDependencies": {    "@workspace/eslint-config": "workspace:*"  }}

    Each package or app that runs lint declares its own eslint and typescript:

    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:

    Terminal
    pnpm installnode tools/rps/rps-apply.mjs verify-install --from .

    The output must list @workspace/eslint-config as current. Run it from the folder that declares the package: from an app that does not declare it, it lists nothing and checks nothing.

  4. Choose a preset#

    In the eslint.config.mjs of each package or app, spread the preset that fits its own source files (Presets) and add your ignores after it:

    JavaScript
    // eslint.config.mjsimport {config} from '@workspace/eslint-config/base';
    /** @type {import("eslint").Linter.Config[]} */export default [  ...config,  {    ignores: ['node_modules/**', 'dist/**'],  },];
  5. Add the lint script#

    The threshold sits in the script, in every package and app that lints:

    JSON
    {  "scripts": {    "lint": "eslint . --max-warnings 100"  }}
  6. Run it and read the count#

    Terminal
    pnpm --filter <package> lint

    No 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 repositoryWhat to do
has no managed packages and no packages/eslint-configthe steps above
has its own copy at packages/eslint-config, not managedsee Replacing your own copy below
already receives packages from Foundation by managed transferadd --owners eslint-config to the request of your whole set, so the update keeps every package you have (see Updating)
receives managed packages from another source repositoryyour repository has one provenance record from one source, so it cannot take eslint-config from Foundation separately. Ask the maintainer how your whole set moves to Foundation
has its own ESLint configuration, without this packagereceive 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:

Text
1 conflict(s); no operation is planned and nothing will change:  RPS-E5 UNMANAGED_TARGET packages/eslint-config: exists and is not managed
  1. See how your copy differs from the bundle, without changing anything:

    Terminal
    node tools/rps/rps-apply.mjs reconcile --bundle <bundle-folder>
  2. Move your copy out of packages/, to a place outside the workspace, and keep it until the new copy works.

  3. Plan and apply the bundle, then install and verify, as in steps 2 and 3 above.

  4. 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.

This page as Markdown