Skip to content

🐛 noUselessEscapeInRegex incorrectly removes required escapes in v-flag regex character classes #10034

@vbudovski

Description

@vbudovski

Environment information

Details
CLI:
  Version:                      2.4.12
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_PATH:                    unset
  BIOME_LOG_PREFIX_NAME:             unset
  BIOME_LOG_LEVEL:                   unset
  BIOME_LOG_KIND:                    unset
  BIOME_CONFIG_PATH:                 unset
  BIOME_THREADS:                     unset
  BIOME_WATCHER_KIND:                unset
  BIOME_WATCHER_POLLING_INTERVAL:    unset
  NO_COLOR:                     unset
  TERM:                         xterm-256color
  JS_RUNTIME_VERSION:           v24.2.0
  JS_RUNTIME_NAME:              node
  NODE_PACKAGE_MANAGER:         deno/2.7.12

Biome Configuration:
  Status:                       Loaded successfully
  Path:                         /Users/vitaly/git/typescript-projects/paseri/biome.json
  Formatter enabled:            true
  Linter enabled:               true
  Assist enabled:               true
  VCS enabled:                  false
  HTML full support enabled:    unset

Workspace:
  Open Documents:               0


What happened?

https://biomejs.dev/playground/?tab=analyzer-fixes&pane=Diagnostics&code=YwBvAG4AcwB0ACAAcgBlACAAPQAgAC8AWwBhAC0AegBcACYAXQAvAHYAOwA%3D

Expected result

The \ before the & must not be stripped, as that results in an invalid regex.
Per the ECMAScript spec, the following characters are individually reserved inside v-mode character classes and must be escaped: &, !, #, %, ,, :, ;, <, =, >, @, `, ~.

Code of Conduct

  • I agree to follow Biome's Code of Conduct

Metadata

Metadata

Assignees

Labels

A-LinterArea: linterL-JavaScriptLanguage: JavaScript and super languagesS-Bug-confirmedStatus: report has been confirmed as a valid bug

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions