Environment information
CLI:
Version: 2.0.0-beta.6
Color support: true
Platform:
CPU Architecture: x86_64
OS: linux
Environment:
BIOME_LOG_PATH: unset
BIOME_LOG_PREFIX_NAME: unset
BIOME_CONFIG_PATH: unset
BIOME_THREADS: unset
NO_COLOR: unset
TERM: screen-256color
JS_RUNTIME_VERSION: unset
JS_RUNTIME_NAME: unset
NODE_PACKAGE_MANAGER: unset
Biome Configuration:
Status: Loaded successfully
Path: /home/dcsapak/git/biome.json
Formatter enabled: true
Linter enabled: true
Assist enabled: true
VCS enabled: false
Workspace:
Open Documents: 0
Rule name
noUselessEscapeInRegex
Playground link
https://next.biomejs.dev/playground/?indentStyle=space&indentWidth=4&lintRules=all&code=YwBvAG4AcwB0ACAAcgBlAGcAZQB4ACAAPQAgAC8AXgBbAFwAXAAtAF0AKwAkAC8AOwAKAAoAIgBcAFwAIgAuAG0AYQB0AGMAaAAoAHIAZQBnAGUAeAApADsA&language=js
Expected result
The following code produces a false positive:
const regex = /^[\\-]+$/;
it believes the '-' is escaped, while actually the \ is escaped.
The safe fix, removes both backslashes, which results in wrong code
it should not falsely detect the escape for '-'
Code of Conduct
Environment information
Rule name
noUselessEscapeInRegex
Playground link
https://next.biomejs.dev/playground/?indentStyle=space&indentWidth=4&lintRules=all&code=YwBvAG4AcwB0ACAAcgBlAGcAZQB4ACAAPQAgAC8AXgBbAFwAXAAtAF0AKwAkAC8AOwAKAAoAIgBcAFwAIgAuAG0AYQB0AGMAaAAoAHIAZQBnAGUAeAApADsA&language=js
Expected result
The following code produces a false positive:
it believes the '-' is escaped, while actually the
\is escaped.The safe fix, removes both backslashes, which results in wrong code
it should not falsely detect the escape for '-'
Code of Conduct