-
Notifications
You must be signed in to change notification settings - Fork 68
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
Add a formatter option similar to @antfu/eslint-config. #477
Comments
I am up to that, if more users agree on that (I personally would always use Also, PR welcome if anyone wants to work on that. Thanks! |
Hello @gsh1024 , @antfu , I basically agree with this issue. However, if you check the style in the Vue file, we believe that Therefore, I think the content of the discussion will change depending on whether the target is |
I ended up solving the problem using @antfu/eslint-config. 😭 |
@gsh1024 How did you do it? The best way to use the Eslint module with @antfu/eslint-config Let me give using eslint-plugin-format directly a trial Actually, I found the docs 🎉 https://eslint.nuxt.com/packages/module#custom-config-presets |
Describe the feature
Both @nuxt/eslint and @antfu/eslint-config do not format CSS by default. However, with @antfu/eslint-config, you can format CSS by installing the eslint-plugin-format plugin and then configuring the formatters option:
https://github.com/antfu/eslint-config?tab=readme-ov-file#formatters
@nuxt/eslint does not have this option. I went through the official documentation and only found a stylistic option, but this option only controls the formatting of JS and Vue files; it does not format CSS files:
https://eslint.nuxt.com/packages/module#eslint-stylistic
I had to configure Prettier myself to format CSS files. Wouldn't it be more convenient for developers if there was a formatters option similar to the one in @antfu/eslint-config?
Below is my test code and configuration. I intentionally messed up the formatting to test the formatting functionality of @nuxt/eslint:
<!-- The template will be automatically formatted --> <template> <div> <NuxtRouteAnnouncer /> <NuxtWelcome /> </div> </template> <!-- The script will be automatically formatted --> <script lang="ts" setup> const str= "Hello, World!" console.log(str) </script> <!-- The styles will not be automatically formatted --> <style>body{color:red; } </style>
Additional information
Final checks
The text was updated successfully, but these errors were encountered: