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 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 '$'. ---