Skip to content

Using flat config in monorepo: one config file or multiple? #16960

Answered by Rec0iL99
yf-yang asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @yf-yang, before using the flat config, the common structure developers followed in monorepos was having a root .eslintrc.* and then having individual .eslintrc.*s in different packages of the monorepo extending the root config just like how you described.

With flat config you would need just one eslint.config.js with all configurations at the root of your monorepo.

File structure:

project/
    eslint.config.js
    packages/
        api/
            index.js
        frontend/
            index.js

You can use glob patterns in the files keys to define configs for individual packages of your monorepo:

// eslint.config.js
export default [
    {
        files: ["api/**/*.js"],
        rules: 

Replies: 5 comments 17 replies

Comment options

You must be logged in to vote
7 replies
@nzakas
Comment options

@eakl
Comment options

@MikhailShibaev
Comment options

@kirkobyte
Comment options

@jakebailey
Comment options

Answer selected by yf-yang
Comment options

You must be logged in to vote
1 reply
@Rec0iL99
Comment options

Comment options

You must be logged in to vote
1 reply
@lkraav
Comment options

Comment options

You must be logged in to vote
1 reply
@chyzwar
Comment options

Comment options

You must be logged in to vote
7 replies
@avanderbergh
Comment options

@cfthody
Comment options

@boris-egorov-ziiina
Comment options

@cfthody
Comment options

@thibaultvdb-hexagon
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet