Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"lint": "next lint" never start #55094

Closed
1 task done
FrancescoSaverioZuppichini opened this issue Sep 7, 2023 · 10 comments · Fixed by #55104
Closed
1 task done

"lint": "next lint" never start #55094

FrancescoSaverioZuppichini opened this issue Sep 7, 2023 · 10 comments · Fixed by #55104
Labels
bug Issue was opened via the bug report template. locked

Comments

@FrancescoSaverioZuppichini
Copy link

FrancescoSaverioZuppichini commented Sep 7, 2023

Link to the code that reproduces this issue or a replay of the bug

https://github.com/vercel/next.js

To Reproduce

So I have this script in package.json from the default nextjs installation (using create-next-app)

  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },

if I do pnpm lint it does everysingle time and it never run the lint

 info Loaded env from /Users/FRANCESCO.ZUPPICHINI/Documents/ai-callcenter/.env.local
? How would you like to configure ESLint? https://nextjs.org/docs/basic-features/eslint
- ready ESLint has successfully been configured. Run next lint again to view warnings and errors.

Current vs. Expected behavior

should actually run the linting

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.5.0: Thu Jun  8 22:21:34 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T8112
    Binaries:
      Node: 20.3.0
      npm: 9.6.7
      Yarn: N/A
      pnpm: 8.6.2
    Relevant Packages:
      next: 13.4.19
      eslint-config-next: 13.4.19
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.2.2
    Next.js Config:
      output: N/A

Which area(s) are affected? (Select all that apply)

Not sure

Additional context

No response

@FrancescoSaverioZuppichini FrancescoSaverioZuppichini added the bug Issue was opened via the bug report template. label Sep 7, 2023
@IsabellaRey
Copy link

IsabellaRey commented Sep 7, 2023

I'm having the same problem just now

@IsabellaRey
Copy link

Note there is no .eslintrc.json file generated in the root folder - is that what the problem is?

If I add one manually, running npm run lint again seems to be running the actual linting

@devjiwonchoi
Copy link
Member

@FrancescoSaverioZuppichini @IsabellaRey Please provide a repro so as to investigate.

@devjiwonchoi
Copy link
Member

@IsabellaRey If that is the case, add .eslintrc.json as:

{
  "extends": "next/core-web-vitals"
}

@IsabellaRey
Copy link

Repro steps are as described by @FrancescoSaverioZuppichini:

  1. create bare-bone web app with create-next-app
  2. ensure package.json has scripts.lint = "next lint"
  3. run npm run lint

Expected:
the first run of npm run lint generates the appropriate .eslintrc.json file in the root folder. Subsequent runs do the actual linting

Actual:
the first run of npm run lint does not generate a config file. Subsequent runs keep asking the user which configuration they want to set up, only to tell them it's already set up (which it isn't)

@devjiwonchoi thanks - I'll be adding a config file manually as a temporary workaround, but please note that this is not in line with the docs: https://nextjs.org/docs/app/building-your-application/configuring/eslint
Half of the point of prompting the user seems to be auto-generating that config file

@devjiwonchoi
Copy link
Member

devjiwonchoi commented Sep 7, 2023

I've checked that create-next-app does create the default .eslintrc.json.
I'll investigate the issue for not creating the file though, thanks.

@IsabellaRey
Copy link

@devjiwonchoi thanks for looking into this.

I should add in my case I actually started with a Nextjs template which does not include eslint to start with:
it's the recommended template with Redux:

https://github.com/vercel/next.js/tree/canary/examples/with-redux

npx create-next-app --example with-redux with-redux-app

@devjiwonchoi
Copy link
Member

Fixing this issue will resolve that also, appreciate you for sharing.

@devjiwonchoi
Copy link
Member

In order to make this issue clear, I'll port this issue.

ijjk added a commit that referenced this issue Feb 5, 2024
…n App Router (#55104)

This PR fixes `.eslintrc.json` not being created after the user runs
`next lint` and selects an option of `Strict` or `Base`.
The reason is that the lint check was looking for `pages` and
`src/pages` only. Added `app` and `src/app` to be checked also.

Fixes: #55094
Fixes: #55102

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. locked
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants