Share an ESLint config across packages
Share one ESLint 9 flat config across workspace packages by exporting an array from a package and spreading it into each package's eslint.config.js.
A flat config is a plain array of objects, so sharing it is a normal import. Put the shared rules in their own workspace package and spread them where you need them.
import js from '@eslint/js';
export const base = [
js.configs.recommended,
{ rules: { eqeqeq: 'error', 'no-var': 'error' } },
];import { base } from '@acme/eslint-config';
export default [
...base,
{ files: ['src/**/*.js'], rules: { 'no-console': 'warn' } },
];{
"name": "@acme/eslint-config",
"version": "1.0.0",
"type": "module",
"exports": "./index.js"
}Each package still owns an eslint.config.js, because ESLint looks for the config next to the file it lints, starting from where you run it. Later objects override earlier ones, so a package adds its own object after the spread. Flat config is covered in the ESLint configuration docs.
Do not export a single merged object from the shared package. Export the array, so each consumer can spread it and keep control of the order.