Skip to content

Commit

Permalink
Fixed minor mistake in message of no-misleading-unicode-character (#…
Browse files Browse the repository at this point in the history
…664)

* Fixed minor mistake in message of `no-misleading-unicode-character`

* Create nine-pets-tan.md
  • Loading branch information
RunDevelopment committed Oct 20, 2023
1 parent 882beb3 commit 669b239
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
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

0 comments on commit 669b239

Please sign in to comment.