Rocketseat / eslint-config-rocketseat

ESLint configuration used by Rocketseat
https://www.npmjs.com/@rocketseat/eslint-config
733 stars 108 forks source link

NextJS lint not working #16

Closed vitorwlima closed 1 year ago

vitorwlima commented 1 year ago

I installed the package and followed README instructions for Next.js and eslint did not work. I realized it was because I didn't have eslint-config-next installed. The next linting package should be included by default as all others are.

image

teosoares10 commented 1 year ago

When you create a next project it will install automatically eslint then you need to initialize it using the follow command pnpm dlx eslint --init will bring a few questions to set a initial configuration in your .eslintrc.json.

After you initialized eslint now you will install pnpm i @rocketseat/eslint-config -D.

Inside .eslintrc.json

{
  "extends": [
    "@rocketseat/eslint-config/next", 
    "next/core-web-vitals"
  ]
}

I hope this is helpful

vitorwlima commented 1 year ago

@teosoares10 makes sense I guess. I had skipped eslint installation in Next because I wanted to use this setup, but apparently, you have to accept the default one to have the correct packages, and then you can move on. I just found it confusing, especially considering that in the Node and React packages you can install directly out of the box with no issues.

Closing as it was just a misunderstanding from me.