Skip to content
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

feat: custom eslint parser for Vue Vine #56

Merged
merged 17 commits into from
Nov 21, 2023
Merged

Conversation

ShenQingchuan
Copy link
Member

@ShenQingchuan ShenQingchuan commented Aug 27, 2023

Why this?

We can't reuse vue-eslint-parser because it's made for scanning and analyzing the .vue SFC file, and may not satisfies our requirements that well.

We must make our own custom ESTree to represent a VCF(Vine component function).

There'll be a representation of Vue's template in VCF's return statement.

Milestones

  • Tokenize all items from vine tagged template string node, and adjust position based on global offset.
  • Build VTemplateRoot ESTree root node.
  • analyze used in template variables

May put in another PR

  • Create eslint-plugin-vue-vine package to maintain rules for Vue Vine.

@netlify
Copy link

netlify bot commented Aug 27, 2023

Deploy Preview for vue-vine ready!

Name Link
🔨 Latest commit a5f880f
🔍 Latest deploy log https://app.netlify.com/sites/vue-vine/deploys/655c8b4c4526aa00086bb53e
😎 Deploy Preview https://deploy-preview-56--vue-vine.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@ShenQingchuan ShenQingchuan marked this pull request as draft August 27, 2023 02:52
@ShenQingchuan ShenQingchuan added this to the release-v0.2.0 milestone Aug 27, 2023
@so1ve
Copy link
Member

so1ve commented Aug 27, 2023

@ShenQingchuan I see there are many rollup boilerplate code in our repo. Shall we refactor them to make them reuseable, or use pkgroll instead? I use it to build the create-vine-app cli in #49

@ShenQingchuan
Copy link
Member Author

@ShenQingchuan I see there are many rollup boilerplate code in our repo. Shall we refactor them to make them reuseable, or use pkgroll instead? I use it to build the create-vine-app cli in #49

@so1ve For sure! Any refactor that brings efficient is definitely worth it.

If we can't avoid do that for 2 times due to there're 2 PRs left here right now, we could just setup them in the same way, and decrease the difference as much as possible so that there'll not be so many conflicts to resolve.

If you chose to do that in one of these 2 PRs, you can go for it and rebase it in the other PR.

Thanks! 💖 You're my GOAT !

@so1ve
Copy link
Member

so1ve commented Aug 27, 2023

I wonder if doing such refactor in these two PRs will cause huge merge conflict... Let's merge these two PRs anyway, thus we can refactor in main.

@so1ve so1ve mentioned this pull request Aug 27, 2023
@ShenQingchuan ShenQingchuan force-pushed the feat/eslint-parser branch 2 times, most recently from 7168b25 to 546bf05 Compare October 25, 2023 14:51
@ShenQingchuan ShenQingchuan marked this pull request as ready for review November 20, 2023 08:02
@ShenQingchuan ShenQingchuan marked this pull request as draft November 20, 2023 08:54
@ShenQingchuan
Copy link
Member Author

ShenQingchuan commented Nov 21, 2023

Preview video

vue-vine-eslint-parser-with-desc.mp4

Drawbacks now

Based on what's been tested so far, there are some standard rules that still need to be handled specifically for the Vue Vine scenario.

For example, StartTag for an HTML tag that taking up multiple lines and having different attributes in rows can cause ESLint to report no-multi-spaces. eslint-plugin-vue redefines a no-multi-spaces rule with the same name to cover them.

Which means we may need to do the same.

@baiwusanyu-c
Copy link
Member

image

@so1ve
Copy link
Member

so1ve commented Nov 21, 2023

image

@ShenQingchuan ShenQingchuan marked this pull request as ready for review November 21, 2023 08:32
@Simon-He95
Copy link
Contributor

image

@DaZuiZui
Copy link
Member

284512538-7546a8ba-9974-4e08-acc1-0603cb0279b4

@ShenQingchuan ShenQingchuan merged commit 697bf65 into main Nov 21, 2023
8 checks passed
@ShenQingchuan ShenQingchuan deleted the feat/eslint-parser branch November 21, 2023 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants