eslint end-tag-with-attributes
Hello π
Pretty simple (I hope ^^")
I installed eslint automatically this way, with stylistic without prettier :
https://eslint.nuxt.com/packages/module
So far so good π
But then, this is considered an error :
<MyComponent end>
How can I authorize specific attributes, or even better specific attributes for specific components ?
I feel like it should be possible since those work fine :
Thanks π
3 Replies
Hi @Omnislash. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To address your question about authorizing specific attributes for components in ESLint with Nuxt, I'll need to provide some context and then suggest a potential solution.
The error you're encountering is related to the Vue template parsing rules in ESLint. By default, Vue's template parser doesn't allow attributes on end tags, which is why you're seeing the error for
<MyComponent end>
.
Unfortunately, the knowledge sources provided don't contain specific information about customizing this particular rule. However, we can explore a general approach to customizing ESLint rules in a Nuxt project using the @nuxt/eslint
module.
Here's a potential solution:
1. First, make sure you have the latest version of @nuxt/eslint
installed.
2. In your eslint.config.mjs
file, you can override the Vue-specific rules. Here's an example of how you might structure this:
This configuration disables the 'end-tag-with-attributes' check within the 'vue/no-parsing-error' rule. This should allow you to use attributes on end tags without triggering an error.
Please note that this is a general solution and might not be the most ideal approach for all scenarios. It's always best to follow Vue's recommended practices when possible.
For more detailed customization options and the latest information, I recommend checking the @nuxt/eslint module documentation (https://eslint.nuxt.com/packages/module) and the ESLint Vue plugin documentation (https://eslint.vuejs.org/rules/no-parsing-error.html).
If this solution doesn't fully address your needs or if you need more specific customizations, you might need to consult more recent documentation or seek help from the Nuxt community forums.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@305772639438503936> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Fully disabling that specifc rule sounds kind of the opposite of specifying it, since the goal what installing eslting in the first place ^^