eslint-plugin-vue-pug-sfc icon indicating copy to clipboard operation
eslint-plugin-vue-pug-sfc copied to clipboard

Use custom template tokenizer for vue-eslint-parser

Open rashfael opened this issue 3 years ago • 5 comments

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

rashfael avatar Mar 23 '22 19:03 rashfael

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 avatar Mar 23 '22 19:03 rashfael

could you help me with typescript definitions here?

I will look into this tomorrow

Shinigami92 avatar Mar 23 '22 19:03 Shinigami92

@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

Shinigami92 avatar Mar 24 '22 09:03 Shinigami92

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?

Shinigami92 avatar Mar 24 '22 09:03 Shinigami92

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.

rashfael avatar Mar 24 '22 12:03 rashfael