Skip to content

This notebook belongs to

Sadat Jubayer

Senior Software Engineer at Premio

If found, please return to hello@jubayer.dev

Vol. 7Seven years of building

Started
January 2020
Everyday tools
TypeScript, Vue, React, Next.js, NestJS, React Native
Education
B.Sc. CSSE, AIUB, 2020
2 min readDev Tool

Move from ESLint 9 to ESLint 10

Find the effective config after ESLint 10 changes file lookup, then remove the old lookup flag and migrate remaining eslintrc files.

You upgrade a monorepo to ESLint 10 and a file that failed yesterday passes today. The closest config to the file can win now, even if you run ESLint from the root. Check which rules the file gets before changing the file.

Print the config for a file you know

In ESLint 9, the default lookup started at the working directory. In ESLint 10 it starts at the directory of each linted file and searches upward. The migration guide describes the lookup change and the flag it replaces.

For a small reproduction, put export default [{ rules: { 'no-console': 'error' } }] in a root eslint.config.mjs. Add another eslint.config.mjs under packages/web/ with the same rule set to 'off'. Give that package a demo.js file containing console.log('demo').

Run this at the root after installing ESLint 10.

npm exec -- eslint --print-config packages/web/demo.js

The printed JSON gives no-console a severity of 0, which means the package config turned it off.

If the package config was intentional, keep it and import the shared rule sets it needs. ESLint does not merge ancestor flat-config files just because they sit above this one in the directory tree. Compare one file per package after the upgrade. An editor and a CI command should agree on the effective rules for the same file.

For CI that needs one root config, select it by name.

npm exec -- eslint --config eslint.config.mjs packages/web/demo.js

The same file now reports Unexpected console statement from the root rule.

Remove the old switches

Delete --flag v10_config_lookup_from_file from your scripts if you used it to try the lookup in ESLint 9. ESLint 10 reports it as unknown. Check ESLINT_FLAGS too, since a CI variable can still supply a flag you removed from the command.

A job that depends on .eslintrc and ESLINT_USE_FLAT_CONFIG=false needs a flat configuration now. Convert and test that config while you are still on ESLint 9, then remove the escape hatch and upgrade. Do the same for editor tooling that still uses a legacy config or an older Node runtime. On the Node 22 line, ESLint 10 requires at least 22.13.0.