eslint: Escape characters are handled incorrectly in inline config comments

Tell us about your environment

  • ESLint Version: v4.7.2
  • Node Version: v8.5.0
  • npm Version: Yarn v1.0.2

What parser (default, Babel-ESLint, etc.) are you using? Default

Please show your full configuration:

Configuration
rules:
    id-match: [2, "^(([^$\\W]|\\$[a-f\\d]{2})+|[$_]\\w*|[^\\W\\d]\\w*|[A-Z]([A-Z_]*[A-Z])?)$", {
        properties: true
    }]

What did you do? Please include the actual source code causing the issue.

/* eslint id-match: [2, "^(([^$\\W]|\\$[a-f\\d]{2})+|[$_]\\w*|[^\\W\\d]\\w*|[A-Z]([A-Z_]*[A-Z])?)$", {properties: true}] */

function is$2dvoid(value) {
    return value == null
}

What did you expect to happen? It to pass (as it does without the comment)

What actually happened? Please include the actual, raw output from ESLint.

/path/to/file.js
  3:10  error  Identifier 'is$2dvoid' does not match the pattern '^(([^$\\W]|\\$[a-f\\d]{2})+|[$_]\\w*|[^\\W\\d]\\w*|[A-Z]([A-Z_]*[A-Z])?)$'  id-match

✖ 1 problem (1 error, 0 warnings)

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (13 by maintainers)

Commits related to this issue

Most upvoted comments

The levn project has just issued version 0.4.1 which allows quoted string literals to use the same escaping rules as JavaScript itself, so upgrading to latest levn may resolve this issue.

How do we want to proceed with this? It unfortunately doesn’t look like there has been any movement on the levn issue. It seems like moving away from levn might be the prudent thing to do.