4:10 error Incorrect indentation of htmlAttribute 'type' beginning at L4:C10. Expected 'type' to be at L5:C4. attribute-indentation
I try to migrate an old project from Ember 2.14.0 to Ember 3.5.0 and this template is only copied from old to new project. I search for days but I do not understand what’s wrong…
Template linting is turned on by default in the newest versions of Ember. This is simply the template linter suggesting (at least I think) that instead of having all of the HTML attributes for the button on the same line like this:
<button type="button" class="..." ...>
That you write it more like this:
<button
type="button"
class="..."
...
>
If you dont’ want to bother with all this you can probably change the template linting rules or just disable template linting altogether.
eslint is the library for linting .js files, so that’s not what you want.
.template-lintrc.js is a file added to newer ember projects and it configures the template linter. That’s where you want to put your rule configuration. If you don’t have that file it may not have run all the blueprints correctly when upgrading 3.5. I just started a 3.5 project and the file looks like this:
Like I mentioned above eslint and the template linter are two different things. ESLint is meant to lint javascript files (es => ecmascript which is javascript) and the template linter is meant to lint your htmlbars hbs files. Separate libraries, separate rules.
This kind of errors does not cause any problems in running the program.,
The reason for the indentation error is Ember templates( handlebars ) prefer indentation of 2 spaces, but when we use most IDEs, it automatically indent to 4 spaces. So what you have to do is, use sublime text and at the right bottom, you can see an option tab-size, make it 2 when you use handlebars