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

[Feat]: jsx-pascal-case allowAllCaps allows underscore #2364

Merged
merged 1 commit into from
Jul 31, 2019
Merged

[Feat]: jsx-pascal-case allowAllCaps allows underscore #2364

merged 1 commit into from
Jul 31, 2019

Conversation

TylerR909
Copy link

Hello, I hope this finds you well.

My team uses a custom tool for Localization and by convention we've adopted an all-caps snake case for "Translatable Strings" like <TS_USER_INPUT /> or <TS_ADD_BUTTON /> to facilitate that.

Our ESLint configs fell out of date as we moved to adopt TypeScript, during which we've written hundreds of these new components. Now that I'm trying to refresh and re-enable them, the jsx-pascal-case rule is throwing tons of errors. I like what it's trying to do, though, so I don't want to turn it off. If I had more time I'd try to make ignore accept Regex patterns like /^TS_[A-Z0-9]+$/ but I figure enabling Snake Case with the allowAllCaps rule is a simple enough change for most people as it doesn't seem like a breaking change to me.

I hope it meets with your approval! Thanks for your time.

}, {
code: '<TEST_COMPONENT_ />',
options: [{allowAllCaps: true}],
errors: [{message: 'Imported JSX component TEST_COMPONENT_ must be in PascalCase'}]
Copy link
Member

Choose a reason for hiding this comment

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

seems like the message, when allowAllCaps, should say "in PascalCase or SCREAMING_SNAKE_CASE"?

lib/rules/jsx-pascal-case.js Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants