You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: next lint post 15.5 release adjustments (#82933)
Update installation guide, now we have Biome as an option to
create-next-app, and next lint is deprecated.
Also addresses: #82916
---------
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Co-authored-by: Ben Gubler <[email protected]>
Copy file name to clipboardExpand all lines: docs/01-app/01-getting-started/01-installation.mdx
+22-25Lines changed: 22 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,7 +63,7 @@ On installation, you'll see the following prompts:
63
63
```txt filename="Terminal"
64
64
What is your project named? my-app
65
65
Would you like to use TypeScript? No / Yes
66
-
Would you like to use ESLint? No / Yes
66
+
Which linter would you like to use? ESLint / Biome / None
67
67
Would you like to use Tailwind CSS? No / Yes
68
68
Would you like your code inside a `src/` directory? No / Yes
69
69
Would you like to use App Router? (recommended) No / Yes
@@ -104,7 +104,8 @@ Then, add the following scripts to your `package.json` file:
104
104
"dev": "next dev",
105
105
"build": "next build",
106
106
"start": "next start",
107
-
"lint": "eslint"
107
+
"lint": "eslint",
108
+
"lint:fix": "eslint --fix"
108
109
}
109
110
}
110
111
```
@@ -309,45 +310,41 @@ You can enable the plugin in VS Code by:
309
310
310
311
See the [TypeScript reference](/docs/app/api-reference/config/next-config-js/typescript) page for more information.
311
312
312
-
## Set up ESLint
313
+
## Set up linting
313
314
314
-
Next.js comes with built-in ESLint. It automatically installs the necessary packages and configures the proper settings when you create a new project with `create-next-app`.
315
+
Next.js supports linting with either ESLint or Biome. Choose a linter and run it directly via `package.json` scripts.
315
316
316
-
To manually add ESLint to an existing project, add `next lint` as a script to `package.json`:
317
+
- Use **ESLint** (comprehensive rules):
317
318
318
319
```json filename="package.json"
319
320
{
320
321
"scripts": {
321
-
"lint": "next lint"
322
+
"lint": "eslint",
323
+
"lint:fix": "eslint --fix"
322
324
}
323
325
}
324
326
```
325
327
326
-
Then, run `npm run lint` and you will be guided through the installation and configuration process.
328
+
- Or use **Biome** (fast linter + formatter):
327
329
328
-
```bash filename="Terminal"
329
-
npm run lint
330
+
```json filename="package.json"
331
+
{
332
+
"scripts": {
333
+
"lint": "biome check",
334
+
"format": "biome format --write"
335
+
}
336
+
}
330
337
```
331
338
332
-
You'll see a prompt like this:
339
+
If your project previously used `next lint`, migrate your scripts to the ESLint CLI with the codemod:
333
340
334
-
> ? How would you like to configure ESLint?
335
-
>
336
-
> ❯ Strict (recommended)
337
-
> Base
338
-
> Cancel
339
-
340
-
-**Strict**: Includes Next.js' base ESLint configuration along with a stricter Core Web Vitals rule-set. This is the recommended configuration for developers setting up ESLint for the first time.
341
-
-**Base**: Includes Next.js' base ESLint configuration.
342
-
-**Cancel**: Skip configuration. Select this option if you plan on setting up your own custom ESLint configuration.
343
-
344
-
If `Strict` or `Base` are selected, Next.js will automatically install `eslint` and `eslint-config-next` as dependencies in your application and create a configuration file in the root of your project.
345
-
346
-
The ESLint config generated by `next lint` uses the older `.eslintrc.json` format. ESLint supports both [the legacy `.eslintrc.json` and the newer `eslint.config.mjs` format](https://eslint.org/docs/latest/use/configure/configuration-files#configuring-eslint).
You can manually replace `.eslintrc.json` with an `eslint.config.mjs`file using the setup recommended in our [ESLint API reference](/docs/app/api-reference/config/eslint#with-core-web-vitals), and installing the [`@eslint/eslintrc`](https://www.npmjs.com/package/@eslint/eslintrc) package. This more closely matches the ESLint setup used by `create-next-app`.
345
+
If you use ESLint, create an explicit config (recommended `eslint.config.mjs`). ESLint supports both [the legacy `.eslintrc.*` and the newer `eslint.config.mjs`formats](https://eslint.org/docs/latest/use/configure/configuration-files#configuring-eslint). See the [ESLint API reference](/docs/app/api-reference/config/eslint#with-core-web-vitals) for a recommended setup.
349
346
350
-
You can now run `next lint` every time you want to run ESLint to catch errors. Once ESLint has been set up, it will also automatically run during every build (`next build`). Errors will fail the build, while warnings will not.
347
+
> **Good to know**: If an ESLint config is present, `next build` will still run linting in Next.js 15, but this automatic build-time linting will be removed in Next.js 16. Control when linting runs by invoking your linter via npm scripts.
351
348
352
349
See the [ESLint Plugin](/docs/app/api-reference/config/next-config-js/eslint) page for more information.
Copy file name to clipboardExpand all lines: docs/01-app/03-api-reference/06-cli/next.mdx
+9-1Lines changed: 9 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -139,7 +139,15 @@ The following options are available for the `next info` command:
139
139
140
140
### `next lint` options
141
141
142
-
> **Warning**: This option is deprecated and will be removed in Next 16. A [codemod](/blog/next-15-5#next-lint-deprecation) is available to migrate to ESLint CLI.
142
+
> **Warning**: This command is deprecated and will be removed in Next.js 16.
143
+
>
144
+
> We recommend migrating to invoking ESLint directly (or using Biome). A [codemod](https://nextjs.org/blog/next-15-5#next-lint-deprecation) is available to migrate scripts to the ESLint CLI.
145
+
>
146
+
> `next lint` generates a `next-env.d.ts` file, which is often needed during type-check. To ensure `next-env.d.ts` is present run [`next typegen`](#next-typegen-options) before type-checking. `next dev` and `next build` also generate the `next-env.d.ts` file, but it is often undesirable to run these just to type-check.
147
+
>
148
+
> ```bash filename="Terminal"
149
+
> next typegen && tsc --noEmit
150
+
>```
143
151
144
152
`next lint` runs ESLint forall filesin the `pages/`, `app/`, `components/`, `lib/`, and `src/` directories. It also provides a guided setup to install any required dependencies if ESLint is not already configured in your application.
0 commit comments