Unverified Commit 88916fba authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Fix runLintCheck during build (#39883)

Follow-up to https://github.com/vercel/next.js/pull/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`
parent 1c61eff6
...@@ -324,15 +324,14 @@ export async function runLintCheck( ...@@ -324,15 +324,14 @@ export async function runLintCheck(
// Display warning if no ESLint configuration is present inside // Display warning if no ESLint configuration is present inside
// config file during "next build", no warning is shown when // config file during "next build", no warning is shown when
// no eslintrc file is present // no eslintrc file is present
if ( if (lintDuringBuild) {
lintDuringBuild && if (config.emptyPkgJsonConfig || config.emptyEslintrc) {
(config.emptyPkgJsonConfig || config.emptyEslintrc) Log.warn(
) { `No ESLint configuration detected. Run ${chalk.bold.cyan(
Log.warn( 'next lint'
`No ESLint configuration detected. Run ${chalk.bold.cyan( )} to begin setup`
'next lint' )
)} to begin setup` }
)
return null return null
} else { } else {
// Ask user what config they would like to start with for first time "next lint" setup // Ask user what config they would like to start with for first time "next lint" setup
......
...@@ -20,6 +20,12 @@ describe('TypeScript basic', () => { ...@@ -20,6 +20,12 @@ describe('TypeScript basic', () => {
}) })
afterAll(() => next.destroy()) 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 () => { it('have built and started correctly', async () => {
const html = await renderViaHTTP(next.url, '/') const html = await renderViaHTTP(next.url, '/')
expect(html).toContain('hello world') expect(html).toContain('hello world')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment