mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
> [!WARNING]
> v16 will not support backwards compatibility of legacy config. The
users can either migrate to flat config via `@next/codemod
next-lint-to-eslint-cli` or stay at v15.
### Why?
`eslint-config-next` is the recommended way to use the ESLint
configuration for Next.js, but it hasn't correctly supported the Flat
config. This PR makes `eslint-config-next` a Flat config by default, and
the users can use it by:
```js
import coreWebVitals from "eslint-config-next/core-web-vitals";
import typescript from "eslint-config-next/typescript";
const eslintConfig = [
...coreWebVitals,
...typescript,
{ ignores: [/* ...ignores to override default ignores */] },
];
export default eslintConfig;
```
Double-checked the usage at
https://github.com/vercel/next.js/tree/ba0db6f1c0256ac7a2941abaadc41f8e47c654a6/examples/with-supabase
### How?
- Converted to Flat config format
- Removed `@rushstack/eslint-patch` hack for peerDeps
- Replaced `@typescript-eslint/` packages to `typescript-eslint`
- https://github.com/vercel/next.js/pull/84874#discussion_r2432032100
- Replaced `env` property with `languageOptions.globals`
- https://github.com/vercel/next.js/pull/84874#discussion_r2432061040
### Follow up
- Update Codemod
- Update CNA templates
- Update Docs https://github.com/vercel/next.js/pull/84781
7 lines
165 B
JavaScript
7 lines
165 B
JavaScript
import { defineConfig } from 'eslint/config'
|
|
import eslintNext from 'eslint-config-next'
|
|
|
|
const eslintConfig = defineConfig(eslintNext)
|
|
|
|
export default eslintConfig
|