diff --git a/test/lib/next-test-utils.ts b/test/lib/next-test-utils.ts index 0c934f0e2a5fe0..5b42399d8a9222 100644 --- a/test/lib/next-test-utils.ts +++ b/test/lib/next-test-utils.ts @@ -468,9 +468,7 @@ export function shouldDisableLinting(dir: string) { ) { return false } - } catch {} - try { // If some of these files exist, we should not disable linting. if ( ['.eslintrc.json', '.eslintrc.js', '.eslintrc'].some((file) => @@ -479,9 +477,7 @@ export function shouldDisableLinting(dir: string) { ) { return false } - } catch {} - try { // If the `eslintConfig` field is present in the `package.json` file, we // should not disable linting. if ( @@ -490,9 +486,13 @@ export function shouldDisableLinting(dir: string) { ) { return false } - } catch {} - return true + return true + } catch { + // An error ocurred while checking the directory, so we should not disable + // linting. + return false + } } export function nextBuild(