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

string-content rule: case insensitive matching #2277

Open
skondrashov opened this issue Feb 7, 2024 · 1 comment
Open

string-content rule: case insensitive matching #2277

skondrashov opened this issue Feb 7, 2024 · 1 comment

Comments

@skondrashov
Copy link

skondrashov commented Feb 7, 2024

I'd like to be able to match a word case insensitively to be able to catch words that should be abbreviated in my project, eg End of Day -> EOD. I've tried using the (?i) regex mode modifier but it breaks the parsing, and using '/End of Day/i' doesn't work. Whatever the recommended way to do this is, even if it's just '[Ee][Nn][Dd]\\s+[Oo][Ff]\\s+[Dd][Aa][Yy]', could it be added to string-content.md?

@fregante fregante changed the title string-content case insensitive matching string-content rule: case insensitive matching Feb 10, 2024
@sindresorhus
Copy link
Owner

I think we could add a caseSensitive option to patterns:

{
	"unicorn/string-content": [
		"error",
		{
			"patterns": {
				"end of day": {
					"caseSensitive": false,
					"suggest": "😎",
					"fix": false
				}
			}
		}
	]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants