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

docs: add eslint setup guide #24976

Merged
merged 10 commits into from Jan 16, 2024
Merged

docs: add eslint setup guide #24976

merged 10 commits into from Jan 16, 2024

Conversation

chris-visser
Copy link
Contributor

I found @antfu 's eslint package to be the best approach to enable eslint in a Nuxt project and since imho its not really clear on how to set up eslint etc in Nuxt, I've documented it. So if people agree lets add it to the docs?

I found antfu's eslint package to be the best approach to enable eslint in a nuxt project and since its not really clear, I've documented it. So if people agree lets add it to the official docs?
Copy link

stackblitz bot commented Dec 31, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

nuxt-studio bot commented Dec 31, 2023

Live Preview ready!

Name Edit Preview Latest Commit
Nuxt Docs Edit on Studio ↗︎ View Live Preview d59b49d

@github-actions github-actions bot added the 3.x label Dec 31, 2023
@MuhammadM1998
Copy link
Contributor

There's a WIP https://github.com/nuxt/eslint-plugin-nuxt made by the nuxt team so I think this would be the official way.
P.S: the description says nuxt supports prettier but antfu config uses stylistic instead of prettier.

Copy link
Member

@huang-julien huang-julien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello 👋
we do have a roadmap for nuxt/eslint nuxt/eslint#303
Currently i'm using @nuxtjs/eslint-config-typescript which works quite well i'd say

@antfu
Copy link
Member

antfu commented Dec 31, 2023

Hey, thanks for trying!

I am working on a Nuxt module to generate a project-aware Nuxt configuration to make this easier. As the ESLint flat config is slowly becoming the standard, I believe it would make the best DX for Nuxt project.

(while me, who made my own eslint config, do believe my eslint config works pretty well ofc. It's still quite opininated to my personal taste, and might not work for every Nuxt project. It would be better to maintain a Nuxt-official version and recommend it (which we do, but there could be a lot of improvements to make for sure)).

Co-authored-by: skmedix <3246162+skmedix@users.noreply.github.com>
@chris-visser
Copy link
Contributor Author

There's a WIP https://github.com/nuxt/eslint-plugin-nuxt made by the nuxt team so I think this would be the official way. P.S: the description says nuxt supports prettier but antfu config uses stylistic instead of prettier.

I've noticed, but the last update on that package was done on 2022. I do agree though that an official package would be much better. What I find interesting though is the zero config setup of Antfu's package which is in line with Nuxt's approach to many things like the module system.

I'm fine with anything though. Just trying to help :)

@MuhammadM1998
Copy link
Contributor

@chris-visser I appreciate your help 🙏and I'm just trying to do the same didn't mean to be aggressive or something. FYI I'm using antfu's package in my project and it's indeed zero-config and it's the Nuxt way as you said. I hope that official plugin get stabilized soon!

@chris-visser
Copy link
Contributor Author

@chris-visser I appreciate your help 🙏and I'm just trying to do the same didn't mean to be aggressive or something. FYI I'm using antfu's package in my project and it's indeed zero-config and it's the Nuxt way as you said. I hope that official plugin get stabilized soon!

Appreciate it !

Copy link
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's update this to use @nuxt/eslint-config for the moment. 🙏

@Atinux
Copy link
Member

Atinux commented Jan 8, 2024

Agree with @danielroe

I do use @nuxt/eslint-config in most of my Nuxt projects and it works well (example).

Thank you for pushing this new page in the documentation @chris-visser ❤️

Copy link
Member

@antfu antfu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise LGTM!

And btw, as promised, here I made a project-aware flat config generator module: https://github.com/antfu/nuxt-module-eslint-config, at some point we might make it official and mention it as the experiment support.

For better UX, I am thinking maybe this module could add an optional flag to opt-in ESLint for formatting via ESLint Stylisttc and eslint-plugin-format (use Prettier for HTML and CSS).

docs/2.guide/1.concepts/9.code-style.md Outdated Show resolved Hide resolved
docs/2.guide/1.concepts/9.code-style.md Outdated Show resolved Hide resolved
docs/2.guide/1.concepts/9.code-style.md Outdated Show resolved Hide resolved
danielroe and others added 2 commits January 16, 2024 11:51
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
@danielroe danielroe merged commit 6823b8c into nuxt:main Jan 16, 2024
4 checks passed
This was referenced Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants