Skip to content

Vue 2 template using Vue 3 ESLint rules? #4994

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

Closed
m-thomson opened this issue Oct 9, 2020 · 5 comments · Fixed by #4999
Closed

Vue 2 template using Vue 3 ESLint rules? #4994

m-thomson opened this issue Oct 9, 2020 · 5 comments · Fixed by #4999
Labels

Comments

@m-thomson
Copy link

m-thomson commented Oct 9, 2020

🐛 bug report

Preflight Checklist

  • [x ] I have read the
    Contributing Guidelines
    for this project.
  • [ x] I agree to follow the
    Code of Conduct
    that this project adheres to.
  • [x ] I have searched the issue tracker for an issue that matches the one I want
    to file, without success.

Description of the problem

How has this issue affected you? What are you trying to accomplish?

I don't want to disable ESLint.

To Reproduce

See the lines mentioned above in https://codesandbox.io/s/vue-2-eslint-problem-o19ht

Link to sandbox:

https://codesandbox.io/s/vue-2-eslint-problem-o19ht

Your Environment

Software Name/Version
Сodesandbox
Browser Brave(Version 1.14.84 Chromium: 85.0.4183.121)
Operating System MacOS

Screenshot

CleanShot 2020-10-09 at 14 21 20@2x

Note from screenshot - Using Vue 2.6

@m-thomson
Copy link
Author

Since CodeSandbox is using Vetur, I wonder if this is relevant vuejs/vetur#2015

@lbogdan
Copy link
Contributor

lbogdan commented Oct 12, 2020

Hey @m-thomson ,

Thank you for your report!

This happens because we're using semver.gte() to figure out if the sandbox is using Vue 2 or 3:

function isMinimalSemverVersion(version: string, minimalVersion: string) {
try {
return semver.gte(version, minimalVersion);
} catch (e) {
// Semver couldn't be parsed, we assume that we're on the bleeding edge now, so true.
return true;
}
}

config = await getVueConfig(
linter,
!isMinimalSemverVersion(dependencies.vue || '2.0.0', '3.0.0')
);

but it seems that semver doesn't support caret versions like ^2.6.11 and throws with "TypeError: Invalid Version: ^2.6.11".

We're figuring out how to improve the check and will get back to you shortly!

@lbogdan
Copy link
Contributor

lbogdan commented Oct 12, 2020

@m-thomson You can test the fix in #4999 here: https://pr4999.build.csb.dev/s/o19ht .

@lbogdan
Copy link
Contributor

lbogdan commented Oct 12, 2020

@m-thomson The fix was just deployed, please test and confirm that it's working as expected.

And thanks again for the detailed report!

@m-thomson
Copy link
Author

This seems to be fixed. Thanks for getting to it so quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants