Skip to content

Commit 71d1e97

Browse files
icyJosephvercel[bot]bgub
authored
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]>
1 parent 2acaecf commit 71d1e97

File tree

2 files changed

+31
-26
lines changed

2 files changed

+31
-26
lines changed

docs/01-app/01-getting-started/01-installation.mdx

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ On installation, you'll see the following prompts:
6363
```txt filename="Terminal"
6464
What is your project named? my-app
6565
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
6767
Would you like to use Tailwind CSS? No / Yes
6868
Would you like your code inside a `src/` directory? No / Yes
6969
Would you like to use App Router? (recommended) No / Yes
@@ -104,7 +104,8 @@ Then, add the following scripts to your `package.json` file:
104104
"dev": "next dev",
105105
"build": "next build",
106106
"start": "next start",
107-
"lint": "eslint"
107+
"lint": "eslint",
108+
"lint:fix": "eslint --fix"
108109
}
109110
}
110111
```
@@ -309,45 +310,41 @@ You can enable the plugin in VS Code by:
309310

310311
See the [TypeScript reference](/docs/app/api-reference/config/next-config-js/typescript) page for more information.
311312

312-
## Set up ESLint
313+
## Set up linting
313314

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.
315316

316-
To manually add ESLint to an existing project, add `next lint` as a script to `package.json`:
317+
- Use **ESLint** (comprehensive rules):
317318

318319
```json filename="package.json"
319320
{
320321
"scripts": {
321-
"lint": "next lint"
322+
"lint": "eslint",
323+
"lint:fix": "eslint --fix"
322324
}
323325
}
324326
```
325327

326-
Then, run `npm run lint` and you will be guided through the installation and configuration process.
328+
- Or use **Biome** (fast linter + formatter):
327329

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+
}
330337
```
331338

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:
333340

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).
341+
```bash filename="Terminal"
342+
npx @next/codemod@canary next-lint-to-eslint-cli .
343+
```
347344

348-
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.
349346

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.
351348
352349
See the [ESLint Plugin](/docs/app/api-reference/config/next-config-js/eslint) page for more information.
353350

docs/01-app/03-api-reference/06-cli/next.mdx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,15 @@ The following options are available for the `next info` command:
139139

140140
### `next lint` options
141141

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+
> ```
143151
144152
`next lint` runs ESLint for all files in 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.
145153

0 commit comments

Comments
 (0)