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

Allow apostrophe and interpunct in first word of item description #155

Merged
merged 3 commits into from
Dec 12, 2022

Conversation

steven2358
Copy link
Contributor

Fixes #153.

This PR fixes the errors that appear when having apostrophes or interpuncts in the first word of the description. Examples that produced an error but now pass:

- [GPT-3](https://openai.com/api/) - OpenAI's API provides access to GPT-3, which performs a wide variety of natural language tasks, and Codex, which translates natural language to code.
- [DALL·E 2](https://openai.com/dall-e-2/) - DALL·E 2 by OpenAI is a new AI system that can create realistic images and art from a description in natural language.

@@ -250,7 +250,7 @@ function validateListItemPrefixCasing(prefix, file) {
return false;
}

if (!listItemPrefixCaseAllowList.has(caseOf(firstWord)) && !/\d/.test(firstWord) && !/^["“'(]/.test(firstWord) && !identifierAllowList.has(firstWord)) {
if (!listItemPrefixCaseAllowList.has(caseOf(firstWord.replace(/['·]/,''))) && !/\d/.test(firstWord) && !/^["“'(]/.test(firstWord) && !identifierAllowList.has(firstWord)) {
Copy link
Owner

Choose a reason for hiding this comment

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

I think it would be more correct to strip anything non-ASCII. For example, there are many more kinds of apostrophe's.

Strip all non-word characters from first word before checking case.
@steven2358
Copy link
Contributor Author

@sindresorhus Ok, I changed the rule so it strips any non-word character: [^\w], equivalent to [a-zA-Z_0-9].

The change is in 2ece4a9

@sindresorhus
Copy link
Owner

Linting is failing. Always run npm test locally before pushing changes ;)

@steven2358
Copy link
Contributor Author

Ok, I ran npm test and fixed my code.

@sindresorhus sindresorhus merged commit 49bb773 into sindresorhus:main Dec 12, 2022
@steven2358 steven2358 deleted the patch-1 branch December 12, 2022 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Apostrophes and interpuncts in the first word of the description cause an error
2 participants