-
-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add pug support for vue templates #29
Comments
Thank you for this issue. Yes, it will be good if this parser can parse pug. But I don't have knowledge about pug syntax and semantics, so I don't have enough time to implement it for now. PR is welcome. |
@mysticatea I've started looking into this, and have found https://github.com/pugjs/pug-lint which could be a good starting point: Internally it uses |
@lehni Thank you! You are right. That
|
@mysticatea thank you for the detailed description! Could you point me to the part in the parser code that does this for HTML? |
|
Anyone working on it maybe? |
Unfortunately I don't have the time to do so at the moment |
@ppsirius @lehni some time ago there was some work on it by @leo-buneev |
I have abandoned this project. If anyone will continue, beware, pug-lexer returns a little bit different format of tokens, and doesn't provide all necessary data - some hacking done by me here is useful to return consistent data from pug-lexer. My idea was to return HTML syntax tree that is equivalent to PUG source code (so existing vue-eslint-plugin rules do not need reimplementation), but with different character indexes (corresponding to pug code). It was coming along nicely, but still far from finishing. We've moved our projects to html since (https://github.com/leo-buneev/pug-to-html). Curiously, it increased character count only by 3.8% - much less than I expected. Pug has more drawbacks than benefits, imho - Benefits:
Drawbacks:
|
Why don't you use https://github.com/myfreeweb/eslint-plugin-pug ? |
Any news on this one? |
Is there any perspective of solving this issue? |
@tats-u because |
Honestly, why I'm slightly saddened at the reduced flexibility, I think @leo-buneev made the right call here. Open Source is maintained out of the good-will of kind developers. And Leo made a good analysis showing why adding the extra work load of supporting Pug just doesn't have enough objective benefits to warrant it. |
To everyone who want this feature be implemented by have not time to implement it yourself: P. S. |
FYI: There's a prettier-pug plugin now that works quite well for my use-case: |
@lehni |
Oh Boy, I wish I had seen this issue before starting a big Vue project using PUG 🙄 |
Author of https://github.com/prettier/plugin-pug here. Please |
I have currently a hard time trying to find out what could be the best/correct way of processing the files. It seems I cannot implement just a e.g. ... So could take a while ... mainly because I also have a real life 🤣 |
I'm not progressing as fast as I wanted 🙁 I'm still interested in solving this (for my pug-vue community), but this could take weeks to month due to the other stuff around me 🤷 |
ESLint is yielding false negatives because of Pug templates see vuejs/vue-eslint-parser#29
https://www.npmjs.com/package/eslint-plugin-vue-pug-sfc/v/1.0.0-alpha.2 👀 This is a first alpha and "supports" Please give it a try and please also start to create issues in the repo for every rule you want to get support for! Please also feel free to jump into the code and help me 😃 @TokugawaTakeshi You don't need to but I would really love to get at least a bit of your offered investment.
I will not spam here anymore, so please lets move all discussions to the project's repo. |
I am responsible for my words. |
It seems that there is no desire to add support for it - but I'll still leave my comment, as I am one of many who love and want to continue using Pug, but not having the ability to use https://github.com/vuejs/eslint-plugin-vue is a big issue |
@doutatsu Whats wrong with my plugin? https://github.com/Shinigami92/eslint-plugin-vue-pug-sfc |
@Shinigami92 Nothing particularly wrong with yours, but this is an official VueJS ESLint parser, so I think it's still appropriate to ask for the official support for pug here. |
Ah yeah, sry now I understand: yeah I would love if the parser would parse the pug content. But sadly the structure is not really compatible. |
Totally understand @doutatsu here with no disrespect to the incredible, selfless work @Shinigami92 is doing here for the pug community. As much a third-party solution is appreciated, let's keep hoping that's at some point pug support is added to Having said that, I feel for @juliovedovatto ... Our last greenfield project's head foolishly decided to go for pug templates out of personal coding preference despite the team's overwhelming amount of evidence against it and it also left us with a ton of pug-related issues...
Hope at the very least this PR conversation helps folks considering pug in their vue project think twice before using it (at least until official support is added to |
@sgarcia-dev Thanks for the kind words regarding me, but I would say that it is okay to use pug (maybe without all the pug-js stuff, but using framework stuff like |
I gave implementing this also a shot and got most of the Since supporting pug like that might involve bigger changes, what's the opinion of the maintainers (@mysticatea , @ota-meshi?) on pug specific tokens? In the meantime I'll contribute to @Shinigami92's project. |
Pug support has been added via eslint-plugin-vue-pug, which adds a template tokenizer to vue-eslint-parser, making a lot of rules of eslint-plugin-vue just work. |
Hello, it is very desired feature to have in eslint-plugin-vue, but they relay on this lib to parse things. So I just wanted to ask if there are any plans to add pug support?
Original issue: vuejs/eslint-plugin-vue#310
The text was updated successfully, but these errors were encountered: