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
- Fix: id-match mysteriously fails when defined in a comment. (fixes #9366) — committed to aladdin-add/eslint by deleted user 7 years ago
- Fix: id-match mysteriously fails when defined in a comment. (fixes #9366) — committed to aladdin-add/eslint by deleted user 7 years ago
- Fix: id-match mysteriously fails when defined in a comment. (fixes #9366) — committed to aladdin-add/eslint by deleted user 7 years ago
- Fix: parsing regex option failing when defined in a comment. (fixes #9366) levn parsing string differently than JSON.parse, e.g. JSON.parse( '{ "foo": "\\n" }') // => { foo: '\n' } levn.pars... — committed to aladdin-add/eslint by deleted user 7 years ago
- Upgrade: levn@0.4.1 (fixes #9366) — committed to eslint/eslint by kaicataldo 4 years ago
- Upgrade: levn@0.4.1 (fixes #9366) — committed to eslint/eslint by kaicataldo 4 years ago
- Upgrade: levn@0.4.1 (fixes #9366) (#13140) * Upgrade: levn@0.4.1 (fixes #9366) * Use String.raw to improve readability of tests * Address feedback * Update optionator@0.9.1 — committed to eslint/eslint by kaicataldo 4 years ago
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
levnissue. It seems like moving away fromlevnmight be the prudent thing to do.