Reputation: 863
I like to use my Javascript file indentation to 3 spaces. But Eslint doesn't like this way and it gives me some indentation warning. How should I fix it?
And when we work with team other team members maybe configure their editor and formatter differently. In this case how should I configure Eslint? And also what if I don't want Eslit to give me any indentation error.
error Expected indentation of 2 spaces but found 3
warning Expected indentation of 2 spaces but found 3 spaces
warning Expected indentation of 4 spaces but found 6 spaces
warning Expected indentation of 4 spaces but found 6 spaces
warning Expected indentation of 2 spaces but found 3 spaces
Clarification from comments:
"I don't use prettier"
Upvotes: 2
Views: 1850
Reputation: 209
you can use the below code to configure it
"indent": ["error", 4] // Indent with 4 spaces
"react/jsx-indent": ["error", 4] // Indent JSX with 4 spaces
"react/jsx-indent-props": ["error", 4] // Indent props with 4 spaces
Upvotes: 2