Open gsh1024 opened 3 months ago
I am up to that, if more users agree on that (I personally would always use @antfu/eslint-config
together, so I don't really need it myself, but I do understand it might be useful to have without bind to my personal config).
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 eslint-plugin-vue-scoped-css
is a suitable role.
(This plugin was created by ota-meshi, the author of eslint-plguin-vue)
Therefore, I think the content of the discussion will change depending on whether the target is .css
or style in the vue file.
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:
Additional information
Final checks