Skip to content

Commit

Permalink
Fix runLintCheck during build (#39883)
Browse files Browse the repository at this point in the history
Follow-up to #39872 this fixes a check in `runLintCheck` causing setup to start during build and adds a regression test. 

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
  • Loading branch information
ijjk committed Aug 24, 2022
1 parent 1c61eff commit 88916fb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
17 changes: 8 additions & 9 deletions packages/next/lib/eslint/runLintCheck.ts
Expand Up @@ -324,15 +324,14 @@ export async function runLintCheck(
// Display warning if no ESLint configuration is present inside
// config file during "next build", no warning is shown when
// no eslintrc file is present
if (
lintDuringBuild &&
(config.emptyPkgJsonConfig || config.emptyEslintrc)
) {
Log.warn(
`No ESLint configuration detected. Run ${chalk.bold.cyan(
'next lint'
)} to begin setup`
)
if (lintDuringBuild) {
if (config.emptyPkgJsonConfig || config.emptyEslintrc) {
Log.warn(
`No ESLint configuration detected. Run ${chalk.bold.cyan(
'next lint'
)} to begin setup`
)
}
return null
} else {
// Ask user what config they would like to start with for first time "next lint" setup
Expand Down
6 changes: 6 additions & 0 deletions test/production/typescript-basic/index.test.ts
Expand Up @@ -20,6 +20,12 @@ describe('TypeScript basic', () => {
})
afterAll(() => next.destroy())

it('should not have eslint setup started', async () => {
expect(next.cliOutput).not.toContain(
'How would you like to configure ESLint'
)
})

it('have built and started correctly', async () => {
const html = await renderViaHTTP(next.url, '/')
expect(html).toContain('hello world')
Expand Down

0 comments on commit 88916fb

Please sign in to comment.