Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💅 Linter fail on code files contains literal RegExp contains Cyrillic symbols #1522

Closed
1 task done
mrakobes27 opened this issue Jan 11, 2024 · 1 comment · Fixed by #1592
Closed
1 task done
Assignees
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug S-Help-wanted Status: you're familiar with the code base and want to help the project

Comments

@mrakobes27
Copy link

Environment information

Linter fail on code files contains literal RegExp contains Cyrillic symbols.

Example code:
() => currentValue !== '' && !checkError(currentValue.replace(/[^A-ZА-Я0-9]/gi, '')),

Linter Output:
 × processing panicked: byte index 6 is not a char boundary; it is inside 'А' (bytes 5..7) of `[^A-ZА-Я0-9]`

Or (if RegExp contains symbol "-"):
  × processing panicked: byte index 9 is not a char boundary; it is inside '' (bytes 7..10) of `[0-3]\d—[0-3]\d`

Rule name

noMisleadingCharacterClass

Playground link

https://biomejs.dev/playground/?code=YwBvAG4AcwB0ACAAYQAgAD0AIAAvAFsAXgBBAC0AWgAQBC0ALwQwAC0AOQBdAC8AZwBpADsACgBjAG8AbgBzAHQAIABiACAAPQAgAC8AWwAwAC0AMwBdAFwAZAAUIFsAMAAtADMAXQBcAGQALwBnAGkAOwAKAA%3D%3D

Expected result

Print valid validation information for rule "noMisleadingCharacterClass".

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@Conaclos Conaclos added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug labels Jan 11, 2024
@atheck
Copy link

atheck commented Jan 11, 2024

I have the same issue with the following code:

value.replaceAll(/[\u200E\u2066-\u2069]/gu, "");

The error is:

Source Location: crates/biome_js_analyze/src/semantic_analyzers/nursery/no_misleading_character_class.rs:317:62
Thread Name: biome::worker_0
Message: byte index 2 is not a char boundary; it is inside '\u{200e}' (bytes 1..4) of `[‎⁦-⁩]`

@ematipico ematipico added the S-Help-wanted Status: you're familiar with the code base and want to help the project label Jan 13, 2024
@Conaclos Conaclos self-assigned this Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug S-Help-wanted Status: you're familiar with the code base and want to help the project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants