Skip to content

[quotes] Clarify that "avoid-escape" does not allow backticks #5147

Closed
@feross

Description

Using the latest eslint (2.0.0-rc.0).

Rules:

{
  "parserOptions": {
    "ecmaVersion": 6
  },
  "rules": {
    "quotes": [2, "single", "avoid-escape"]
  }
}

Code:

console.log(`hello 'hi'`)

Gives the following false-positive error:

  1:13  error  Strings must use singlequote  quotes

The ` string should be allowed, because it's being used to avoid quotes.

Changing the code to:

console.log("hello 'hi'")

causes the error to go away. This is inconsistent and contrary to what the docs say.

Metadata

Assignees

No one assigned

    Labels

    acceptedThere is consensus among the team that this change meets the criteria for inclusionarchived due to ageThis issue has been archived; please open a new issue for any further discussiondocumentationRelates to ESLint's documentationenhancementThis change enhances an existing feature of ESLint

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions