• Please complete the contact form below with details about your inquiry and I'll get back to you as soon as possible.

  • This field is for validation purposes and should be left unchanged.

Fixing: “ESLint: Expected indentation of 2 spaces but found 6. (indent)” in PhpStorm

I recently bootstrapped a new Vue.js application from the Vue-CLI, and I chose to lint my code. Now when I write code, I tend to auto-format my code all the time. The thing is by default, ESLint will warn you if your javascript code is indented inside a script tag (for single-file components). Now I use PhpStorm, but I think the same should apply to WebStorm.

To fix the issue, go to File > Settings > Editor > Code Style > HTML > Other , and for “Do not indent children of” add the “script” tag to the list. That’s it! You can try re-formatting  your code now, and the code indentation in the script tag should be gone now, as well as the ESLint warning. Happy coding!

If you found this helpful, let me know in the commentary section below 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *