Skip to content
This repository has been archived by the owner on May 22, 2022. It is now read-only.

Support tagged-template literal indentation #7

Open
JRJurman opened this issue Oct 26, 2019 · 3 comments
Open

Support tagged-template literal indentation #7

JRJurman opened this issue Oct 26, 2019 · 3 comments

Comments

@JRJurman
Copy link
Member

JRJurman commented Oct 26, 2019

Summary

Since most tagged template literals for tram-one don't actually take into account indentation, it would be ideal if they shared indentation with the rest of the project (that is, by default, 1 tab). Right now it's possible to set whatever indentation you want, but if there was a rule we could apply here, that might allow a formatter to auto-fix it to be similar to the rest of the project.

Example

Iin Tram-One, the components look a lot like this

html`
  <div>
    <h1>Hello World</h1>
    <SpecialFooter />
  </div>
`

What I would like to do is force the indentation in the template to be consistent with the rest of the project (in this case, one tab). In the example above, it would be 1 tab before the starter and ending div tag, and 2 tabs before the h1 and SpecialFooter.

Potential Implementation

There might be an eslint rule we can add here that would give a warning or error on indentation being incorrect. I believe if this is the case, the formatter (xo) will pick up that this change needs to be made.

@anusha5695
Copy link

Hi @JRJurman, can I pick this?

@anusha5695
Copy link

Hi @JRJurman : Can you review this?

@JRJurman
Copy link
Member Author

It looks like this stackoverflow post has some details... it looks like it should be indenting, and there are specific configurations to turn it off...
https://stackoverflow.com/questions/52178093/ignore-the-indentation-in-a-template-literal-with-the-eslint-indent-rule

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants