Configure code formatting to respect linter configuration?

My immediate goal is to configure WebStorm (2018.2.3 on Linux x86_64) to reformat the contents of *.hbs (handlebars / htmlbars = HTML templating language) so that the linter (ember-template-lint) doesn't balk. Ultimately, it'd be much nicer if WebStorm could automatically detect my linter settings and format accordingly.

I found some old posts like these: "Code formatting for template languages" and "How can you set the code style for Handlebars templates?". It seems that the obvious approach is to go to `Settings -> Editor -> Code Style -> HTML` and adjust the options to one's liking. However, there doesn't seem to be enough flexibility for handling handlebars styling rules. For example, one of the rules enforces used of double quotes instead of single quotes but the IDE seems to only help with these if they're in the raw HTML portion, e.g.


<code>

<div class='this gets caught / fixed'></div>
<!-- none of the below violations get caught/fixed -->
{{some-component
  foo='bar'
  baz=(quux 'blah')
}}

</code>

Is there any support for this? If not, is there a feature request to add it?

3 comments
Comment actions Permalink

Normally handlebars formatting should follow HTML code style preferences; but it doesn't seem to work. Logged as https://youtrack.jetbrains.com/issue/WEB-34867, please follow it for updates

0
Comment actions Permalink

That's a different problem. What I am saying is that (1) there aren't always analogous HTML options and (2) these seem to have to be configured manually. So I am asking for (1) first-class support for HBS parsing / formatting and (2) the ability to detect / import settings from a project's linter configuration.

0
Comment actions Permalink

Please feel free to create requests for both features in youtrack, https://youtrack.jetbrains.com/issues/WEB

0

Please sign in to leave a comment.