retextjs / retext

natural language processor powered by plugins part of the @unifiedjs collective
https://unifiedjs.com
MIT License
2.36k stars 93 forks source link

Add `retext-case-police` to list of plugins #78

Closed JulianCataldo closed 2 years ago

JulianCataldo commented 2 years ago

Initial checklist

Description of changes

Repository

A retext plugin for checking popular names casing.

Examples:

For:


Dictionaries are from case-police.

github-actions[bot] commented 2 years ago

Hi! It seems some of the things asked in the template are missing? Please edit your post to fill out everything.

You won’t get any more notifications from me, but I’ll keep on updating this comment, and remove it when done!

If you need it, here’s the original template ```markdown ### Initial checklist * [ ] I read the support docs * [ ] I read the contributing guide * [ ] I agree to follow the code of conduct * [ ] I searched issues and couldn’t find anything (or linked relevant results below) * [ ] If applicable, I’ve added docs and tests ### Description of changes TODO ```

Thanks, — bb

codecov-commenter commented 2 years ago

Codecov Report

Merging #78 (28690c1) into main (0a3f1d4) will not change coverage. The diff coverage is n/a.

@@            Coverage Diff            @@
##              main       #78   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            9         9           
  Lines           71        71           
=========================================
  Hits            71        71           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

wooorm commented 2 years ago

Cool, looks useful!

github-actions[bot] commented 2 years ago

Hi! This was closed. Team: If this was merged, please describe when this is likely to be released. Otherwise, please add one of the no/* labels.

wooorm commented 2 years ago
JulianCataldo commented 2 years ago
  • I’m not sure why you’re checking if (nodes[0].type === 'WordNode') {? I don’t think that’s every false?

Screenshot 2022-08-31 at 23 29 20

Good question. I've added it after trial and error, for making ESLint happy 🤔 Even if it feels redundant. Smash that squiggles 😄

wooorm commented 2 years ago

This can likely be solved by using nodes[0] as the place, instead of delving into it.

A word like don’t, consists of text("don"), punctuation("’"), text("t"). Right now you are warning about don, but the warning is instead about the whole word?

JulianCataldo commented 2 years ago

Oh, neat! I wasn't conscious of what you are describing. So ESLint was right bothering me, even if for me, it wasn't clear why ^^

Did a quick try, and it does address this, indeed, while being more robust, even if the children[0] didn't seems to cause side-effects. I always observed singleton in node[0], maybe because case-police dictionaries are alphabetical only, without any embedded punctuation in tokens.

thx 👍