Skip to content

react/jsx-pascal-case warns on components that are all-caps abbreviations #575

Closed

Description

Some components by a user may contain all caps when it is an abbreviation, eg. <YMCA />, which is still technically valid PascalCase.

In the documentation it specifies that <TEST_COMPONENT> should throw a warning. Obviously it would be impossible for the parser to tell whether a component in all caps is a word or an abbreviation (unless, eg, it looked for punctuation, but even then still not certain).

Would you consider an optional parameter passed to the react/jsx-pascal-case rule to allow all-caps components, or perhaps to specify which component names are allowed to be all caps, would be appropriate?

I'm thinking:

"react/jsx-pascal-case": [2, {"all-caps": true} ]

or

"react/jsx-pascal-case": [2, {"exceptions": "YMCA"}]

Obviously it should still throw an error on components <ymca> or <yMCA>. I'm not sure what solution would best integrate with the rest of the project so open to your thoughts. I use several of these abbreviated components throughout many of my apps.

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

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions