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

Fixed minor mistake in message of no-misleading-unicode-character #664

Merged
merged 2 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/nine-pets-tan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"eslint-plugin-regexp": patch
---

Fixed minor mistake in message of `no-misleading-unicode-character`
5 changes: 4 additions & 1 deletion lib/rules/no-misleading-unicode-character.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,10 @@ export default createRule("no-misleading-unicode-character", {
messageId: "characterClass",
data: {
graphemes,
unit: flags.unicode ? "code points" : "char codes",
unit:
flags.unicode || flags.unicodeSets
? "code points"
: "char codes",
uFlag: uFlag ? " Use the `u` flag." : "",
},
...makeFix(
Expand Down
8 changes: 8 additions & 0 deletions tests/lib/rules/no-misleading-unicode-character.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,14 @@ tester.run("no-misleading-unicode-character", rule as any, {
options: [{ fixable: true }],
errors: [{ messageId: "characterClass" }],
},
{
code: String.raw`/[👶🏻👨‍👩‍👦]/v`,
output: String.raw`/[\q{👶🏻|👨‍👩‍👦}]/v`,
options: [{ fixable: true }],
errors: [
"The character(s) '👶🏻', '👨‍👩‍👦' are all represented using multiple code points.",
],
},
{
code: String.raw`/[👶🏻&👨‍👩‍👦]/v`,
output: String.raw`/[\q{👶🏻|👨‍👩‍👦}&]/v`,
Expand Down