ljharb on master
[eslint config] [base] [patch] … [eslint config] [patch] extend … Merge pull request #1996 from r… (compare)
ljharb on master
[editorial] [react] fix typo [eslint config] [*] [deps] upda… (compare)
eslint
error ^, why this rule is as such (morgan makes sense as a devdependency for me) & how can I overwrite it?
document
, you have to set browser: true
in your env
settings, if that applies to your project
env
settings & it fixed the document
error.
jsx
extension in the import
statement. That causes eslint
to throw this error:Unexpected use of file extension "jsx" for "./components/Reviews.jsx"eslint(import/extensions)
I'm trying to map the reviews
array, but I get 2 eslint
warnings:
render() {
const reviews = this.state.reviews.map((review, index) => (
<div key={index} className="review">
</div>
));
}
1- Must use destructuring state assignmenteslint(react/destructuring-assignment)
2- Do not use Array index in keyseslint(react/no-array-index-key
What's the suggested solution to fix these 2 warnings in this situation?
key
to an _id
property , but I got this eslint
warning:Unexpected dangling '_' in '_id'.eslint(no-underscore-dangle)
"no-underscore-dangle": ["error", { "allow": ["_id"] }],
in my .eslintrc.js
file as suggested by Jordan on this thread (airbnb/javascript#1408)
_id
would be for tho