rashfael / eslint-plugin-vue-pug

linting your pug templates in vue single file components
MIT License
44 stars 7 forks source link

Support eslint-plugin-vue ^9 #7

Closed Shinigami92 closed 2 years ago

Shinigami92 commented 2 years ago

https://github.com/rashfael/eslint-plugin-vue-pug/blob/94b6f3698c322a17a2bd83b9d1749e74557c3412/package.json#L45

Needs to support ^9

rashfael commented 2 years ago

Fixed with 0.5.0. It also looks like end users don't need to explicitly install vue-eslint-parser or our tokenizer anymore, so I removed them from the install instructions.

euaaaio commented 2 years ago

Fixed with 0.5.0. It also looks like end users don't need to explicitly install vue-eslint-parser or our tokenizer anymore, so I removed them from the install instructions.

image

@rashfael, we still should install vue-eslint-parser as a peer dependency of tokenizer.

rashfael commented 2 years ago

Interesting, what npm version did you try this on and which command did you run?

euaaaio commented 2 years ago

Interesting, what npm version did you try this on and which command did you run?

These are pnpm’s warnings, v7.9.5 or any other. Also, I use eslint-plugin-vue-pug as optional peer dependency for my custom eslint config

rashfael commented 2 years ago

I have no experience with pnpm, which the internet says does not install peer dependencies automatically by default, in contrast to npm@7+. Marking vue-eslint-parser as peer dependency is correct in my opinion, and I cannot influence install behaviour of different package managers.

euaaaio commented 2 years ago

Yup, you’re right. I see two solutions:

  1. We should mark vue-eslint-parser as optional peer dependency via peerDependenciesMeta
  2. We should add vue-eslint-parser to the install command as necessary dependency

On the other hand, I don't understand the question deeply enough, but I see that vue-eslint-parser is not used in vue-eslint-parser-template-tokenizer-pug. So I think I don't need to install vue-eslint-parser at all. Maybe vue-eslint-parser should be a peer dependency of eslint-plugin-vue-pug?

rashfael commented 2 years ago

It's not optional, and it's also not a depedency of vue-eslint-parser-template-tokenizer-pug. vue-eslint-parser actually uses vue-eslint-parser-template-tokenizer-pug as a plugin, configured in the configs provided by eslint-plugin-vue-pug. The peerDependency just enforces version compatibility. vue-eslint-parser is a dependency of eslint-plugin-vue, which is a peer dependency of eslint-plugin-vue-pug. You need to have both installed side-by-side, which is why the installation instructions are npm install --save-dev eslint@8 eslint-plugin-vue eslint-plugin-vue-pug to get something useful to run, which definitely should install vue-eslint-parser via eslint-plugin-vue. eslint is also not a dependency of either plugin so I think having the parser also a peer dependency is in the spirit of things, since the tokenizer does not call the parser, same as a eslint-plugin does not call eslint.

euaaaio commented 2 years ago

I have double-checked everything. No more warning after updating pnpm to version 7.11.0. I should have checked everything right away. Sorry for wasting your time.

It’s amazing package. Thank you for your work.