Skip to content

Commit f195650

Browse files
authored
fix: allow next lint without eslint-config-next installed (#29823)
1 parent d8028f5 commit f195650

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

packages/next/lib/eslint/runLintCheck.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,13 @@ async function lint(
200200
eslintVersion: eslintVersion,
201201
lintedFilesCount: results.length,
202202
lintFix: !!options.fix,
203-
nextEslintPluginVersion: nextEslintPluginIsEnabled
204-
? require(path.join(
205-
path.dirname(deps.resolved.get('eslint-config-next')!),
206-
'package.json'
207-
)).version
208-
: null,
203+
nextEslintPluginVersion:
204+
nextEslintPluginIsEnabled && deps.resolved.has('eslint-config-next')
205+
? require(path.join(
206+
path.dirname(deps.resolved.get('eslint-config-next')!),
207+
'package.json'
208+
)).version
209+
: null,
209210
nextEslintPluginErrorsCount: formattedResult.totalNextPluginErrorCount,
210211
nextEslintPluginWarningsCount:
211212
formattedResult.totalNextPluginWarningCount,

0 commit comments

Comments
 (0)