Sometimes, we want to tell ESLint to prefer single quotes around strings.
In this article, we’ll look at how to tell ESLint to prefer single quotes around strings.
How to tell ESLint to prefer single quotes around strings?
To tell ESLint to prefer single quotes around strings, we add the singleQuote
option.
For instance, we write
{
//...
"rules": {
"prettier/prettier": [
"warn",
{
"singleQuote": true,
"semi": true
}
]
}
//...
}
to set the singleQuote
option to true in
.eslintrc`.
Then ESLint will send a warning if single quote strings aren’t being used.
Conclusion
To tell ESLint to prefer single quotes around strings, we add the singleQuote
option.