I can't find any react eslint rule to prettify the content between the curly braces
<div>
{
items.map(i => (<div>{i}</div>))
}
</div>
It should look like this
<div>
{
items.map(i => (<div>{i}</div>))
}
</div>
I can't find any react eslint rule to prettify the content between the curly braces
<div>
{
items.map(i => (<div>{i}</div>))
}
</div>
It should look like this
<div>
{
items.map(i => (<div>{i}</div>))
}
</div>
Copyright © 2021 Jogjafile Inc.
While it's not specific to React, the ESLint indent rule (https://eslint.org/docs/latest/rules/indent) also handles indentation in JSX.
It's not unfortunately not in eslint:recommended, so you need to enable it yourself in your configuration like so:
The default is 4-space indentation, but you can also set it to use 2 spaces
["error", 2]or tabs["error", "tab"].When it comes to formatting rather than actual code errors, I would recommend using Prettier or another tool specifically made for formatting, instead of ESLint. See this article by the ESLint team (https://typescript-eslint.io/linting/troubleshooting/formatting)