Change Request: Merging Flat Configs in Mono Repo #18353
Replies: 3 comments 11 replies
-
Moving to a discussion as this is the intended way for flat config to work. There is no automatic merging of flat config files. If you want to override settings for a particular directory in flat config, the easiest thing to do is to add those overrides directly into your top-level Optionally, you could add logic to your top-level |
Beta Was this translation helpful? Give feedback.
-
@jakebailey feature requests are better filed through issues. |
Beta Was this translation helpful? Give feedback.
-
I came up with next code: import {safeAlign} from 'eslint-plugin-putout/config';
import {mergeESLintConfigs} from '@putout/eslint-flat';
const config = await mergeESlintConfigs(['./packages', './rules', './codemods']);
export default [
...safeAlign,
...config,
]; What it does is:
Also would be great if FlatConfigs call import {createESLintConfig} from '@putout/eslint-flat';
export default createESLintConfig([
safeAlign,
config,
]); To make code a bit simpler. About searching nearest |
Beta Was this translation helpful? Give feedback.
-
ESLint version
v9.0.0
What problem do you want to solve?
I have a mono repo full of
npm
-packages and I want to migrate to FlatConfig.Right now it has
.eslintrc.json
on root directory with project specific details, it is used when I run lint over all the repository, so each package has it's own.eslintrc.json
with overrides related to package (some rules disabled, some new added, depends on needs of package).What do you think is the correct solution?
As I understand in https://eslint.org/docs/latest/use/configure/configuration-files:
Configuration files not merged anymore, so if I run ESLint from the root, it uses
eslint.config.js
from the root only, and not looks up toeslint.config.js
in the packages directory.So the question: is how to merge it correctly, so I don't need to write all packages overrides in the root file, and import each file with overrides to the root
eslint.config.js
, is it possible?Or I should write one very big
.eslint.config.js
and updated it (add new import to npm packageeslint.config.js
and fillfiles
filed, and don't forget to remove it or rename when I change packages inside mono repo) every time I have to change rules for some of my packages? Maybe be I misunderstood how FlatConfig works, or incorrectly configured ESLint.Could you please help me with this?
Participation
Additional comments
No response
Beta Was this translation helpful? Give feedback.
All reactions