retextjs/retext-spell

Ignore times in common formats (e.g. 2:41PM)

danielgolden opened this issue · 5 comments

Initial checklist

Affected packages and versions

5.1.0

Link to runnable example

https://peaceful-mclean-b30fef.netlify.app

Steps to reproduce

  1. Open the runnable example.
  2. In the text field, paste the following string: Good morning, today is 2:41pm.
  3. In the right pane, you'll see that a warning is returned for the time of day.

Expected behavior

TL;DR: I expect that the retext-spell plugin wouldn't return any warnings for times in common formats like 2:41pm.

Description

First, retext and unified as a whole is an incredible project. Thank you for making and maintaining this.

I'm working on creating a JavaScript prose linter for anyone who writes copy in our UI. It's accessible via a browser or in a Figma Plugin since it's primarily meant for product designers to use. The prose linter that I've created uses many existing retext plugins (like retext-spell) and several custom plugins for rules to help our teams adhere to our writing style guide. Since my company is a software monitoring tool, we often use times (e.g. 2:41pm) in our UI and it's very plausible that folks will attempt to use my plugin on text layers that contain times.

I'm taking advantage of the ignoreDigits option and it's working wonderfully! I was hoping to find another option that allows consumers of the project to control whether to ignore words that contain any digits as opposed to only digits (as the ignoreDigits option does).

Affected runtime and version

node@14.15.5

Affected package manager and version

npm@8.10.0

Affected OS and version

macOS Monterey 12.2.1

Build and bundle tools

webpack, Vite

Good idea.
If you are interested in a PR, it could be solved here:

return ignore.includes(word) || (ignoreDigits && /^\d+$/.test(word))
.

Hi! This was marked as ready to be worked on! Note that while this is ready to be worked on, nothing is said about priority: it may take a while for this to be solved.

Is this something you can and want to work on?

Team: please use the area/* (to describe the scope of the change), platform/* (if this is related to a specific one), and semver/* and type/* labels to annotate this. If this is first-timers friendly, add good first issue and if this could use help, add help wanted.

Awesome. Thanks for the feedback! I'm definitely interested.
I'll try to submit a PR for it this week.

Hi! This was closed. Team: If this was fixed, please add phase/solved. Otherwise, please add one of the no/* labels.

Released in 5.3.0!