-
-
Notifications
You must be signed in to change notification settings - Fork 4
Use custom template tokenizer for vue-eslint-parser #162
base: main
Are you sure you want to change the base?
Conversation
I started with testing |
I will look into this tomorrow |
@rashfael We need to use something like this: import * as vuePlugin from 'eslint-plugin-vue';
const rule = vuePlugin.rules['no-textarea-mustache']; But as I said, |
How do you |
f28907e
to
1362668
Compare
The autogenerated tests are done with this script https://github.com/rashfael/vue-eslint-parser-template-tokenizer-pug/blob/main/scripts/generate-eslint-plugin-vue-tests.js but that's more of a one off since I have to touch up basically every file afterwards. I believe we don't need pug-specific tests for most eslint-plugin-vue rules. |
schema: [], | ||
messages: { | ||
disallow: | ||
"'template' cannot be keyed. Place the key on real elements instead.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we lost the pug-ified version of the message
In eslint-plugin-vue it is <template>
(see https://github.com/vuejs/eslint-plugin-vue/blob/1ce68fa9def2c7d6da7aa5020c731860d7027459/lib/rules/no-template-key.js#L30)
But in my plugin there were not <
and >
around template
because pug doesn't have such brackets 🤔
This is only one of many examples of such messages
Is it possible to update the message for pug?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Forking the whole rule code is a bit overkill, perhaps we could just wrap it, since that message is exposed in the rule meta object.
Uses https://github.com/rashfael/vue-eslint-parser-template-tokenizer-pug to drive existing and new rules.
We currently need to develop against https://github.com/rashfael/vue-eslint-parser/tree/custom-template-tokenizers . I'm using
npm link
but we can also add a github url to thepackage.json
.The goal for this PR is to have all already implemented rules run with the new tokenizer.
Todos