Skip to content

How to use new "flat config" approach in Eslint? #49337

Discussion options

You must be logged in to vote

Hmm, it worked for me for TS and TSX files. Might be that it's missing the matcher?

We could maybe put the React and Next stuff into one object and add files: ['**/*.ts', '**/*.tsx'], to it.

Something like this:

export default [
  {
    files: ['**/*.ts', '**/*.tsx'],
    plugins: {
      react: reactPlugin,
      'react-hooks': hooksPlugin,
      '@next/next': nextPlugin,
    },
    rules: {
      ...reactPlugin.configs['jsx-runtime'].rules,
      ...hooksPlugin.configs.recommended.rules,
      ...nextPlugin.configs.recommended.rules,
      ...nextPlugin.configs['core-web-vitals'].rules,
      '@next/next/no-img-element': 'error',
    },
  },
  ... rest of your config
]

And yes, sorry, …

Replies: 6 comments 18 replies

Comment options

You must be logged in to vote
9 replies
@ryancwalsh
Comment options

@milos-sikic-nimbus-tech
Comment options

Answer selected by ryancwalsh
@ryancwalsh
Comment options

@milos-sikic-nimbus-tech
Comment options

@ryancwalsh
Comment options

@nyxb
Comment options

Comment options

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

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
8 replies
@jkaleshi14
Comment options

@dir
Comment options

@jkaleshi14
Comment options

@r34son
Comment options

@dir
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet