Skip to content

Commit

Permalink
Merge pull request #6 from trueberryless/fix-hyphen-issue
Browse files Browse the repository at this point in the history
fix: when a word isn't found, fallback to a non-hyphenated alternative, if it exists
  • Loading branch information
JulianCataldo authored Jan 14, 2025
2 parents acb16af + 85644b4 commit 177a474
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ const retextCasePolice: Plugin<[Settings] | [], Root> =
search(tree, casePoliceKeys, (nodes) => {
const actual = toString(nodes);
const actualLowerCased = actual.toLowerCase();
const expected = casePoliceDicts[actualLowerCased];
const actualLowerCasedNoHyphens = actual.toLowerCase().replace(/-/g, '');
const expected = casePoliceDicts[actualLowerCased] ?? casePoliceDicts[actualLowerCasedNoHyphens];

if (!ignore.includes(expected) && actual !== expected) {
const msg = file.message(
Expand Down

0 comments on commit 177a474

Please sign in to comment.