Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Aug 26, 2022

Conversation

JulianCataldo
Copy link
Contributor

@JulianCataldo JulianCataldo commented Aug 26, 2022

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

Repository

A retext plugin for checking popular names casing.

Examples:

  • ⚠️ macbook → ✅ MacBook
  • ⚠️ MacOS → ✅ macOS

For:


Dictionaries are from case-police.

@github-actions github-actions bot added the 👋 phase/new Post is being triaged automatically label Aug 26, 2022
@github-actions

This comment has been minimized.

@github-actions github-actions bot added 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Aug 26, 2022
@codecov-commenter

This comment was marked as resolved.

@wooorm
Copy link
Member

wooorm commented Aug 26, 2022

Cool, looks useful!

  • I recommend a message of the form Expected casing of `${correctOne}` instead of `${original}`
    • Puts what’s expected in front
    • Uses markdown (code) for “literal” values
  • I recommend adding actual, expected, and url fields to messages.
    • actual is supposed to hold the actual value in the document: toString(nodes)
    • expected is supposed to hold the suggestion (an array of strings or one string): correctOne
    • url can go to documentation, preferrably specific to the ruleId
  • I’m not sure why you’re checking if (nodes[0].type === 'WordNode') {? I don’t think that’s every false?

@@ -73,7 +75,7 @@ The list of plugins:
* [`retext-syntax-mentions`](https://github.com/retextjs/retext-syntax-mentions)
— classify `@mentions` as syntax
* [`retext-syntax-urls`](https://github.com/retextjs/retext-syntax-urls)
Classify url-like values (example.com, example.md, etc) as syntax
classify url-like values (example.com, example.md, etc) as syntax
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch :)

@wooorm wooorm changed the title Add reference to retext-case-police Add retext-case-police to list of plugins Aug 26, 2022
@wooorm wooorm merged commit 44d6e7a into retextjs:main Aug 26, 2022
@wooorm wooorm added 📚 area/docs This affects documentation 💪 phase/solved Post is done labels Aug 26, 2022
@github-actions

This comment has been minimized.

@github-actions github-actions bot removed the 🤞 phase/open Post is being triaged manually label Aug 26, 2022
@wooorm
Copy link
Member

wooorm commented Aug 26, 2022

@JulianCataldo
Copy link
Contributor Author

  • 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
Copy link
Member

wooorm commented Sep 1, 2022

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
Copy link
Contributor Author

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 👍

JulianCataldo added a commit to JulianCataldo/retext-case-police that referenced this pull request Sep 10, 2022
github-actions bot pushed a commit to JulianCataldo/retext-case-police that referenced this pull request Sep 10, 2022
## [1.1.4](v1.1.3...v1.1.4) (2022-09-10)

### Bug Fixes

* wrong node place / children ([a736d5d](a736d5d)), closes [/github.com/retextjs/retext/pull/78#issuecomment-1233888024](https://github.com//github.com/retextjs/retext/pull/78/issues/issuecomment-1233888024)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 area/docs This affects documentation 💪 phase/solved Post is done
Development

Successfully merging this pull request may close these issues.

3 participants