question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Autofix does not work on .vue files

See original GitHub issue

I’m using ESLint with vue-eslint-parser then I enabled vscode-eslint for .vue files. vue-eslint-parser supports autofix for .vue files. But eslint.autoFixOnSave option and eslint.executeAutofix command did not work on .vue files.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:32 (23 by maintainers)

github_iconTop GitHub Comments

11reactions
Asing1001commented, Jun 12, 2017

I only add this to settings.json and it works :

"eslint.validate": [
        { "language": "vue", "autoFix": true },
        { "language": "html", "autoFix": true }
    ]
11reactions
dbaeumercommented, Dec 16, 2016

I published version 1.2.2 of the ESLint extension. It allows for selective autoFix configuration. From the readme:

Added configuration options to enable code actions and auto fix on save selectively per language. In release 1.2.1 code actions and auto fix on save very still only available for JavaScript. In 1.2.2 you can now enable this selectively per language. For compatibility it is enabled by default for JavaScript and disabled by default for all other languages. The reason is that I encounter cases for non JavaScript file types where the computed fixes had wrong positions resulting in ‘broken’ documents. To enable it simply provide an object literal in the validate setting with the properties language and autoFix instead of a simple string. An example is:

"eslint.validate": [ "javascript", "javascriptreact", { "language": "html", "autoFix": true } ]
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use eslint autofix in .vue? - Stack Overflow
Try to use it with specifying files extensions eslint --fix --ext .js,.vue src.
Read more >
VSCode - Fix eslint autofix not work in .vue file - Sing's Log
VSCode - Fix eslint autofix not work in .vue file · Install ESLint extension · Open settings.json by pressing Ctrl, · Add following...
Read more >
ESLint and Prettier with Vite and Vue.js 3 - Vue School Blog
Now we've got ESLint reporting the errors directly in the file but we don't have any automation setup for Prettier to reformat the...
Read more >
Auto-fix linting errors with vue-cli 3 : r/vuejs - Reddit
This would be what I'd do. Having a process that's not my editor change and save files blindly sounds like a bad time....
Read more >
Share your .eslintrc, auto-fix on save, and related config files
Do you know that Visual Studio Code itself can auto-fix your code ... Currently, I auto-fixes TypeScript, JavaScript, Vue, Markdown files.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found