From d97db1df3fd0430e59bed9f09852638fba38964a Mon Sep 17 00:00:00 2001 From: "adamlui@protonmail.com" Date: Thu, 14 Nov 2024 08:57:34 -0800 Subject: [PATCH 1/2] Corrected capturing group not found grammar --- lib/rules/no-useless-dollar-replacements.ts | 4 ++-- .../no-useless-dollar-replacements.ts.eslintsnap | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/rules/no-useless-dollar-replacements.ts b/lib/rules/no-useless-dollar-replacements.ts index 417704dcd..d242e0f40 100644 --- a/lib/rules/no-useless-dollar-replacements.ts +++ b/lib/rules/no-useless-dollar-replacements.ts @@ -32,11 +32,11 @@ export default createRule("no-useless-dollar-replacements", { numberRef: "'${{ refText }}' replacement will insert '${{ refText }}' because there are less than {{ num }} capturing groups. Use '$$' if you want to escape '$'.", numberRefCapturingNotFound: - "'${{ refText }}' replacement will insert '${{ refText }}' because capturing group does not found. Use '$$' if you want to escape '$'.", + "'${{ refText }}' replacement will insert '${{ refText }}' because capturing group is not found. Use '$$' if you want to escape '$'.", namedRef: "'$<{{ refText }}>' replacement will be ignored because the named capturing group is not found. Use '$$' if you want to escape '$'.", namedRefNamedCapturingNotFound: - "'$<{{ refText }}>' replacement will insert '$<{{ refText }}>' because named capturing group does not found. Use '$$' if you want to escape '$'.", + "'$<{{ refText }}>' replacement will insert '$<{{ refText }}>' because named capturing group is not found. Use '$$' if you want to escape '$'.", }, type: "suggestion", // "problem", }, diff --git a/tests/lib/rules/__snapshots__/no-useless-dollar-replacements.ts.eslintsnap b/tests/lib/rules/__snapshots__/no-useless-dollar-replacements.ts.eslintsnap index d8c1a6d8f..b872fe21b 100644 --- a/tests/lib/rules/__snapshots__/no-useless-dollar-replacements.ts.eslintsnap +++ b/tests/lib/rules/__snapshots__/no-useless-dollar-replacements.ts.eslintsnap @@ -62,7 +62,7 @@ Code: | ^~ [1] 4 | -[1] '$1' replacement will insert '$1' because capturing group does not found. Use '$$' if you want to escape '$'. +[1] '$1' replacement will insert '$1' because capturing group is not found. Use '$$' if you want to escape '$'. --- @@ -73,7 +73,7 @@ Code: | ^~~~ [1] 3 | -[1] '$' replacement will insert '$' because named capturing group does not found. Use '$$' if you want to escape '$'. +[1] '$' replacement will insert '$' because named capturing group is not found. Use '$$' if you want to escape '$'. --- From b2bd4b2395632fdfdda85cfdbea605b6c488f24c Mon Sep 17 00:00:00 2001 From: Yosuke Ota Date: Fri, 15 Nov 2024 08:45:37 +0900 Subject: [PATCH 2/2] Create tough-planes-smell.md --- .changeset/tough-planes-smell.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/tough-planes-smell.md diff --git a/.changeset/tough-planes-smell.md b/.changeset/tough-planes-smell.md new file mode 100644 index 000000000..768294fec --- /dev/null +++ b/.changeset/tough-planes-smell.md @@ -0,0 +1,5 @@ +--- +"eslint-plugin-regexp": patch +--- + +fix(regexp/no-useless-dollar-replacements): Correct capturing group not found grammar