Skip to content

Commit 41e3942

Browse files
authored
Remove automatic linting from build (#83136)
### What? This PR removes the automatic ESLint linting that previously ran during `next build`. The documentation has been updated to reflect this change. ### Why? As part of Next.js 16, we're removing the automatic build-time linting that was previously included in the build process. This gives developers more control over when linting runs by explicitly invoking their linter via npm scripts. ### How? - Updated documentation to clarify that automatic build-time linting has been removed in Next.js 16 - Removed the `runLint` parameter and related linting code from the build process - Removed the `verifyAndLint.ts` file which is no longer needed - Simplified type checking code by removing lint-related functionality - Removed ESLint telemetry during builds
1 parent 5bb25f9 commit 41e3942

File tree

133 files changed

+44
-4447
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+44
-4447
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ npx @next/codemod@canary next-lint-to-eslint-cli .
346346

347347
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.
348348

349-
> **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.
349+
> **Good to know**: Prior to Next.js 16, `next build` ran linting automatically. Now, this automatic build-time linting has been removed. Control when linting runs by invoking your linter via npm scripts.
350350
351351
See the [ESLint Plugin](/docs/app/api-reference/config/next-config-js/eslint) page for more information.
352352

docs/01-app/02-guides/memory-usage.mdx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,13 @@ export default nextConfig
9494

9595
## Disable static analysis
9696

97-
Typechecking and linting may require a lot of memory, especially in large projects.
97+
Typechecking may require a lot of memory, especially in large projects.
9898
However, most projects have a dedicated CI runner that already handles these tasks.
99-
When the build produces out-of-memory issues during the "Linting and checking validity of types" step, you can disable these task during builds:
99+
When the build produces out-of-memory issues during the "Running TypeScript" step, you can disable this task during builds:
100100

101101
```js filename="next.config.mjs"
102102
/** @type {import('next').NextConfig} */
103103
const nextConfig = {
104-
eslint: {
105-
// Warning: This allows production builds to successfully complete even if
106-
// your project has ESLint errors.
107-
ignoreDuringBuilds: true,
108-
},
109104
typescript: {
110105
// !! WARN !!
111106
// Dangerously allow production builds to successfully complete even if
@@ -119,9 +114,8 @@ export default nextConfig
119114
```
120115

121116
- [Ignoring TypeScript Errors](/docs/app/api-reference/config/typescript#disabling-typescript-errors-in-production)
122-
- [ESLint in Next.js config](/docs/pages/api-reference/config/next-config-js/eslint)
123117

124-
Keep in mind that this may produce faulty deploys due to type errors or linting issues.
118+
Keep in mind that this may produce faulty deploys due to type errors.
125119
We strongly recommend only promoting builds to production after static analysis has completed.
126120
If you deploy to Vercel, you can check out the [guide for staging deployments](https://vercel.com/docs/deployments/managing-deployments#staging-and-promoting-a-production-deployment) to learn how to promote builds to production after custom tasks have succeeded.
127121

docs/01-app/03-api-reference/05-config/03-eslint.mdx

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -230,36 +230,6 @@ module.exports = {
230230
}
231231
```
232232

233-
## Disabling linting during production builds
234-
235-
If you do not want ESLint to run during `next build`, you can set the `eslint.ignoreDuringBuilds` option in `next.config.js` to `true`:
236-
237-
```ts filename="next.config.ts" switcher
238-
import type { NextConfig } from 'next'
239-
240-
const nextConfig: NextConfig = {
241-
eslint: {
242-
// Warning: This allows production builds to successfully complete even if
243-
// your project has ESLint errors.
244-
ignoreDuringBuilds: true,
245-
},
246-
}
247-
248-
export default nextConfig
249-
```
250-
251-
```js filename="next.config.js" switcher
252-
const nextConfig = {
253-
eslint: {
254-
// Warning: This allows production builds to successfully complete even if
255-
// your project has ESLint errors.
256-
ignoreDuringBuilds: true,
257-
},
258-
}
259-
260-
export default nextConfig
261-
```
262-
263233
### Migrating existing config
264234

265235
If you already have ESLint configured in your application, we recommend extending from this plugin directly instead of including `eslint-config-next` unless a few conditions are met.

examples/active-class-name/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"dev": "next dev",
55
"build": "next build",
66
"start": "next start",
7-
"lint": "next lint"
7+
"lint": "eslint ."
88
},
99
"dependencies": {
1010
"next": "latest",

examples/cms-buttercms/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"dev": "next dev",
55
"build": "next build",
66
"start": "next start",
7-
"lint": "next lint"
7+
"lint": "eslint ."
88
},
99
"dependencies": {
1010
"@popperjs/core": "^2.10.2",

examples/cms-sanity/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"prebuild": "npm run typegen",
77
"build": "next build",
88
"start": "next start",
9-
"lint": "next lint",
9+
"lint": "eslint .",
1010
"presetup": "echo 'about to setup env variables, follow the guide here: https://github.com/vercel/next.js/tree/canary/examples/cms-sanity#using-the-sanity-cli'",
1111
"setup": "npx sanity@latest init --env .env.local",
1212
"postsetup": "echo 'create the read token by following the rest of the guide: https://github.com/vercel/next.js/tree/canary/examples/cms-sanity#creating-a-read-token'",

examples/cms-wordpress/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"dev": "graphql-codegen --config codegen.ts && node ./add-ts-nocheck.js && next dev",
55
"build": "graphql-codegen --config codegen.ts && node ./add-ts-nocheck.js && next build",
66
"start": "next start",
7-
"lint": "next lint",
7+
"lint": "eslint .",
88
"codegen": "graphql-codegen --config codegen.ts && node ./add-ts-nocheck.js"
99
},
1010
"dependencies": {

examples/panda-css/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"dev": "next dev",
66
"build": "next build",
77
"start": "next start",
8-
"lint": "next lint"
8+
"lint": "eslint ."
99
},
1010
"dependencies": {
1111
"next": "latest",

examples/prisma-postgres/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"dev": "next dev --turbopack",
55
"build": "next build",
66
"start": "next start",
7-
"lint": "next lint",
7+
"lint": "eslint .",
88
"postinstall": "prisma generate --no-engine"
99
},
1010
"prisma": {

examples/with-apollo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"dev": "next dev",
55
"build": "next build",
66
"start": "next start",
7-
"lint": "next lint"
7+
"lint": "eslint ."
88
},
99
"dependencies": {
1010
"@apollo/client": "^3.10.1",

0 commit comments

Comments
 (0)