I'm setting up ESLint for a new Next.js TypeScript project in VS Code and find that I cannot configure the @typescript-eslint/quotes
rule to enforce double-quotes rather than single-quotes.
For non-Typescript ESLint I'd just use:
"quotes": ["error", "double", { "allowTemplateLiterals": true }],
Checking the @typescript-eslint/quotes
page doesn't really describe how to config any options, and applying the same formatting as the non-TypeScript:
"@typescript-eslint/quotes": [
"error",
"double",
{
"allowTemplateLiterals": true
}
],
shows the error Array has too many items. Expected 2 or fewer.
.
Removing the third arg:
"@typescript-eslint/quotes": [
"error",
"double"
],
gives me the error Incorrect type. Expected "object"
on the "double" arg. It seems to just want error/off/warn for the first arg and an object for the second, but I can't find any docs on how to do that to mark single quotes with an error.
For now I've disabled the TypeScript rule and enabled the normal ESLint version, but is the @typescript-eslint/quotes
rule not configurable for double-quotes?
--check
flag for Prettier), but this way people don't have to manually correct linter errors around styles (eslint --fix
can fix some but not all).