目录

@typescript-eslint/quotes

Enforce the consistent use of either backticks, double, or single quotes.

  • By default, this rule check whether strings are correctly wrapped in double quotes. For any adjustments, see Options.
  • This rule is recommended for checking .ts files. To check .ets files, consider using @hw-stylistic/quotes.

Rule Configuration

// code-linter.json5
{
  "rules": {
    "@typescript-eslint/quotes": "error"
  }
}

Options

For details, see @typescript-eslint/quotes.

Example of Correct Code

export const double = "double";
export const foo = `back
tick`;  // backticks are allowed due to newline

Example of Incorrect Code

// Double quotes are recommended by default.
export const single = 'single';
export const unescaped = 'a string containing "double" quotes';
export const backtick = `back\ntick`; // you can use \n in single or double quoted strings

Rule Set

plugin:@typescript-eslint/all

For details about how to configure Code Linter check rules, see Code Linter.