Ember-Template-Lint How to fix block-indentation errors on hbs files?

J Weezy :

I am able to run eslint on *.js files. However, it does not seem to support handlebar files.

I did some searching online and found Ember-Template-Lint. But, I am unable to figure out how to change automatically fix block indentations. Is it possible to automatically fix all block indentation errors on Ember handle bar files?

1.) What rule do I use in .template-lintrc.js (see code below)?

2.) What command do I run from the terminal to fix any/all *.hbs files?

https://github.com/ember-template-lint/ember-template-lint

.template-lintrc.js

'use strict';

module.exports = {
    extends: 'recommended',

    rules: {
        'no-html-comments': false,
        'no-bare-strings': false
    }
};
jelhan :

Ember Template Lint does not support fixing errors automatically yet. But it's under active development. You can track progress in this GitHub issue.

You can use Prettier for Glimmer Templates to automatically format your code. This will fix indentation related template linting errors. But the Glimmer support for Prettier is still experimental. It's tracked in this quest issue at GitHub.

If using Prettier for Glimmer Templates I would recommend to integrate Prettier with Ember Template Lint through ember-template-lint-plugin-prettier.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=346737&siteId=1