Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/01-app/01-getting-started/01-installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ npx @next/codemod@canary next-lint-to-eslint-cli .

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.

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

See the [ESLint Plugin](/docs/app/api-reference/config/next-config-js/eslint) page for more information.

Expand Down
16 changes: 0 additions & 16 deletions packages/next/src/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,6 @@ export default async function build(
reactProductionProfiling = false,
debugOutput = false,
debugPrerender = false,
runLint = true,
noMangling = false,
appDirOnly = false,
isTurbopack = false,
Expand Down Expand Up @@ -1084,16 +1083,10 @@ export default async function build(
experimentalFeatures,
})

const ignoreESLint = Boolean(config.eslint.ignoreDuringBuilds)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This option still exists in the config and docs (https://nextjs.org/docs/app/api-reference/config/eslint#disabling-linting-during-production-builds).

We can remove it entirely now, right?

const shouldLint = !ignoreESLint && runLint

const typeCheckingOptions: Parameters<typeof startTypeChecking>[0] = {
dir,
appDir,
pagesDir,
runLint,
shouldLint,
ignoreESLint,
telemetry,
nextBuildSpan,
config,
Expand Down Expand Up @@ -1132,15 +1125,6 @@ export default async function build(
process.exit(1)
}

const buildLintEvent: EventBuildFeatureUsage = {
featureName: 'build-lint',
invocationCount: shouldLint ? 1 : 0,
}
telemetry.record({
eventName: EVENT_BUILD_FEATURE_USAGE,
payload: buildLintEvent,
})

const validFileMatcher = createValidFileMatcher(
config.pageExtensions,
appDir
Expand Down
51 changes: 9 additions & 42 deletions packages/next/src/build/type-check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ import type { NextConfigComplete } from '../server/config-shared'
import type { Telemetry } from '../telemetry/storage'
import type { Span } from '../trace'

import path from 'path'
import * as Log from './output/log'
import { Worker } from '../lib/worker'
import { verifyAndLint } from '../lib/verifyAndLint'
import createSpinner from './spinner'
import { eventTypeCheckCompleted } from '../telemetry/events'
import isError from '../lib/is-error'
Expand Down Expand Up @@ -71,57 +69,36 @@ export async function startTypeChecking({
cacheDir,
config,
dir,
ignoreESLint,
nextBuildSpan,
pagesDir,
runLint,
shouldLint,
telemetry,
appDir,
}: {
cacheDir: string
config: NextConfigComplete
dir: string
ignoreESLint: boolean
nextBuildSpan: Span
pagesDir?: string
runLint: boolean
shouldLint: boolean
telemetry: Telemetry
appDir?: string
}) {
const ignoreTypeScriptErrors = Boolean(config.typescript.ignoreBuildErrors)

const eslintCacheDir = path.join(cacheDir, 'eslint/')

if (ignoreTypeScriptErrors) {
Log.info('Skipping validation of types')
}
if (runLint && ignoreESLint) {
// only print log when build require lint while ignoreESLint is enabled
Log.info('Skipping linting')
}

let typeCheckingAndLintingSpinnerPrefixText: string | undefined
let typeCheckingAndLintingSpinner:
| ReturnType<typeof createSpinner>
| undefined
let typeCheckingSpinnerPrefixText: string | undefined
let typeCheckingSpinner: ReturnType<typeof createSpinner> | undefined

if (!ignoreTypeScriptErrors && shouldLint) {
typeCheckingAndLintingSpinnerPrefixText =
'Linting and checking validity of types'
} else if (!ignoreTypeScriptErrors) {
typeCheckingAndLintingSpinnerPrefixText = 'Checking validity of types'
} else if (shouldLint) {
typeCheckingAndLintingSpinnerPrefixText = 'Linting'
if (!ignoreTypeScriptErrors) {
typeCheckingSpinnerPrefixText = 'Checking validity of types'
}

// we will not create a spinner if both ignoreTypeScriptErrors and ignoreESLint are
// enabled, but we will still verifying project's tsconfig and dependencies.
if (typeCheckingAndLintingSpinnerPrefixText) {
typeCheckingAndLintingSpinner = createSpinner(
typeCheckingAndLintingSpinnerPrefixText
)
// we will not create a spinner if ignoreTypeScriptErrors is enabled,
// but we will still verify project's tsconfig and dependencies.
if (typeCheckingSpinnerPrefixText) {
typeCheckingSpinner = createSpinner(typeCheckingSpinnerPrefixText)
}

const typeCheckStart = process.hrtime()
Expand All @@ -145,18 +122,8 @@ export async function startTypeChecking({
return [resolved, checkEnd] as const
})
),
shouldLint &&
nextBuildSpan.traceChild('verify-and-lint').traceAsyncFn(async () => {
await verifyAndLint(
dir,
eslintCacheDir,
config.eslint?.dirs,
config.experimental.workerThreads,
telemetry
)
}),
])
typeCheckingAndLintingSpinner?.stopAndPersist()
typeCheckingSpinner?.stopAndPersist()

if (!ignoreTypeScriptErrors && verifyResult) {
telemetry.record(
Expand Down
1 change: 0 additions & 1 deletion packages/next/src/cli/next-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ const nextBuild = (options: NextBuildOptions, directory?: string) => {
profile,
debug || Boolean(process.env.NEXT_DEBUG_BUILD),
debugPrerender,
lint,
!mangling,
experimentalAppOnly,
isTurbopack,
Expand Down
89 changes: 0 additions & 89 deletions packages/next/src/lib/verifyAndLint.ts

This file was deleted.

Loading