Skip to main content

quotes

JavaScript allows strings to be defined with double quotes, single quotes, or backticks. This rule enforces consistency.
Rule Type: Layout
Fixable: Yes (automatically fixable)
Deprecated: Consider using Prettier

Rule Details

This rule enforces consistent use of quotes throughout your codebase.

Options

String Option

  • "double" (default) - Require double quotes
  • "single" - Require single quotes
  • "backtick" - Require backticks

Object Options

  • "avoidEscape": true - Allow other quotes to avoid escaping
  • "allowTemplateLiterals": true - Allow template literals

Examples

"double"

Incorrect:
Correct:

"single"

Incorrect:
Correct:

"backtick"

Incorrect:
Correct:

avoidEscape Option

Allow other quote styles to avoid escaping:

allowTemplateLiterals Option

Allow template literals alongside your preferred quote style:
This doesn’t disallow ALL template literals - only simple ones. Template literals with expressions or newlines are always allowed.

Configuration Examples

Common Patterns

Avoiding Escaping

JSX

For JSX attributes, ESLint uses the jsx-quotes rule:

Template Literals

When Not to Use It

Most modern projects use Prettier for formatting. If you use Prettier, disable this rule.
Disable if:
  • You use Prettier or another formatter
  • You don’t care about quote consistency
  • Your team hasn’t agreed on a quote style