eslint-plugin-vue-pug-sfc
eslint-plugin-vue-pug-sfc copied to clipboard
Use custom template tokenizer for vue-eslint-parser
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 the package.json.
The goal for this PR is to have all already implemented rules run with the new tokenizer.
Todos
- [ ] add vue-eslint-parser-template-tokenizer-pug to exported config
- [ ] test existing rules if upstream eslint-plugin-vue rules work out of the box
I started with testing script-setup-uses-vars since that's what has brought me to this project and it's just working out of the box.
@Shinigami92 could you help me with typescript definitions here? That test is just ported from eslint-plugin-vue.
@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, eslint-plugin-vue doesn't bring types with it, so we may need to build them on our own
How do you AUTOGENERATED the files, could you add the script in the scripts folder?
Also, how do we add custom pug specific tests if these tests are autogenerated?
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.