Eslint giving error for duplicate props
See original GitHub issueThis is not a bug request, but rather, it’s a discussion on the reasons why you named 2 prop types of TextField
almost the same with one being upper case.
According to TextField API,
TextField
exposes two prop types with almost same names. InputProps
and inputProps
.
Currently, my Eslint gives me an error for having duplicate prop type.
Is there any reason to name 2 prop types almost the same?
Can’t we rename 1 of them to something more clarifying?
This also gives headaches with linting tools.
Expected Behavior
Eslint or any other linting tool doesn’t give me any duplicate error.(react/jsx-no-duplicate-props
).
Current Behavior
Eslint throwing duplicate prop error.
Plugin is located here.
##Temporal solution
Yes, you can set ignoreCase
to false in .eslintrc
but isn’t it better to name our props in a more definitive way?
Thank you.
Your Environment
Tech | Version |
---|---|
Material-UI | 1.0.0-beta30 |
React | ^16.0.0 |
eslint | ^4.8.0 |
Issue Analytics
- State:
- Created 6 years ago
- Reactions:17
- Comments:16 (11 by maintainers)
Top GitHub Comments
I have found the following solution to the problem: much cleaner:
I think an even better solution is to have
InputProps
do as what is expected, but changeinputProps
toNativeInputProps
. That is far more descriptive as to what it does. Having it as the same name, but differing only by the case of the property is prone to errors and simple typos. Changing the native element props toNativeInputProps
keeps with the standard of having the properties staring with an upper case as well as makes it far more descriptive.