Do any of you know a linter for React TypeScript, that replaces single quotes with double quotes on push to git. So next time someone pulls the project down, there is only double quotes.
Asked
Active
Viewed 157 times
0
-
can use something like `husky` and `eslint` on "precommit" have a rule that edit the quotes – Woohaik Nov 24 '22 at 21:26
1 Answers
0
I have this scenario currently implemented using husky and eslint.
In the pre-commit
file from husky, I have this command
eslint ./src/. --fix
And in .eslintrc
this rule
"quotes": [
"error",
"double",
{
"allowTemplateLiterals": true
}
]
Eslint with the --fix
flag will try to fix what it cans things like adding semicolons or updating quotes. With the rule I'm saying: I want all quotes to be double quotes but allow me to use template literals.
This does not affect react props you can still have props like
When running a commit command, husky will trigger the hook and add double quotes so the commit will have the changes.

Woohaik
- 1,084
- 1
- 6
- 24