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

ESLint conflict? #126

Closed
Ragura opened this issue May 22, 2021 · 5 comments
Closed

ESLint conflict? #126

Ragura opened this issue May 22, 2021 · 5 comments

Comments

@Ragura
Copy link

Ragura commented May 22, 2021

First of all, thanks for this amazing template. Not only is it easy to get started mocking up new application with this, but it's also taught me a million things about different aspects of Vite and Vue.

I have noticed one small issue, though I'm not 100% sure it's due to my VSCode or due to a conflict in rulesets for ESLint/formatting.

Out of the box, in the file index.vue, there is the following ESLint warning:

Expected 1 line break after opening tag (<button>), but no line breaks found.

When saving, it tries to auto fix this by placing the content between opening and closing tag on the next line, which is good, but it then immediately reverts to how it was before in a split second. Is this a case of two successive formatters doing opposite things? If this has nothing to do with your template and it's my own setup causing this, just tell me and I'll look for a deeper cause in my own VSCode.

Thanks again for all the hard work at giving Vite such a huge boost from the get-go!

@antfu
Copy link
Member

antfu commented May 22, 2021

Have you tried to upgrade the deps and then restart VS Code?

@Ragura
Copy link
Author

Ragura commented May 22, 2021

Thanks for getting back to me so quickly.

I just did a pnpm up and it did update a lot of packages, but unfortunately the problem still remains even after restarting VS Code.

It actually does this with a lot of things within the template, like the indentation for json objects. (expected indentation of 2 but found 4)
At this point I'm assuming it's my setup and you probably shouldn't put any more thought into this. I'll look into VSCode settings and try to find a conflict somewhere.

@Ragura
Copy link
Author

Ragura commented May 22, 2021

I found the issue. VSCode has the ESLint setting "Format" set to false. Enabled it and now it does its job. Feeling pretty dumb, sorry!

@Ragura Ragura closed this as completed May 22, 2021
@jd-solanki
Copy link

Hello, @Ragura I am having hard timing configuring Volar + ESLint for formatting. Can you please share a minimal vite-vue-ts setup with ESLint & Volar formatting?

Regards.

@Ragura
Copy link
Author

Ragura commented Aug 19, 2021

Hello, @Ragura I am having hard timing configuring Volar + ESLint for formatting. Can you please share a minimal vite-vue-ts setup with ESLint & Volar formatting?

Regards.

Hi @jd-0001, I'm using the default extension settings, together with the tsconfig.json that came with the Vitesse template. Just make sure VS Code is actually using ESLint to do the formatting, else you'll get warnings about the formatting, but it won't correct them automatically.

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

No branches or pull requests

3 participants