Closed mylestan closed 5 years ago
What does npm ls
print out? Note that to use the airbnb config with CRA properly you may have to eject.
Although, if the whitespace entry point enables boolean-prop-naming, that’s a bug.
Thanks for the response! Please see below:
With respect to your last comment: if I replace the message with a non-empty value in eslint-config-airbnb/rules/react.js
locally, run at airbnb/whitespace
with an offending boolean variable name, it does appear as a warning.
In node_modules/eslint-config-airbnb/rules/react.js
:
// Enforces consistent naming for boolean props
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/boolean-prop-naming.md
'react/boolean-prop-naming': ['off', {
propTypeNames: ['bool', 'mutuallyExclusiveTrueProps'],
rule: '^(is|has)[A-Z]([A-Za-z0-9]?)+',
message: 'asdf',
}],
In App.js
:
App.defaultProps = {
boolean: false
};
App.propTypes = {
boolean: PropTypes.bool
};
And on lint run:
/Users/mylestan/git/test-app/src/App.js
...
11:3 warning asdf react/boolean-prop-naming
...
These three lines are the problem:
├── UNMET DEPENDENCY react@^16.6.1
├── UNMET DEPENDENCY react-dom@^16.6.1
└── UNMET DEPENDENCY react-scripts@2.1.1
It means you're missing all three of the right versions of those modules.
Separately, since nothing in the entire airbnb config is ever set to a warning - only off or error - something must be enabling that rule somewhere. Perhaps in CRA?
My bad. Ran npm install
which resolved the unmet dependencies (see below updated npm ls
). I still get the issue above.
Separately, since nothing in the entire airbnb config is ever set to a warning - only off or error - something must be enabling that rule somewhere. Perhaps in CRA?
I thought the point of airbnb/whitespace
entry point was to only error on whitespace rules, and then warn on everything else? In which case, it would make sense to be warning on something like react/boolean-prop-naming
? Or did I misunderstand that?
You're correct; and while the airbnb config configures that rule, it doesn't enable it anywhere - which means something else in your setup is enabling it.
Hi! First off, thanks for this package. Also, I'll preface this with: I'm not 100% sure I'm using the react/whitespace option correctly, so this is more of a question than a bug report.
I ran into this issue on a project and tried to repro it in a clean app. Starting with react-create-app, I've installed
eslint-config-airbnb
as per the README, and have the following.eslintrc
:Running with
./node_modules/.bin/eslint src/
gives the following error:Extending from
"react"
only in.eslintrc
returns no errors.My
package.json
:Replacing this line with a non-empty string or removing it altogether will allow
"react/whitespace"
to run properly.Any help would be appreciated!