Eslint - enforces many more rules. #139
Reference in New Issue
Block a user
No description provided.
Delete Branch "eslint"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Based on the review comments I saw for #138 I thought the linting rules could do with being 'tightened up'.
I checked the
.eslintrc
and found that the only thing being checked was the quotes style, and that was only being applied toLayout.js
!I've auto-configured ESLint based on the existing codebase, then added a few rules that I think are most important. Let me know what you think.
@vjeux @devongovett - I've relaxed the eqeqeq rule to permit eqeq checks against null, as @devongovett rightly points out this allows you to check for both null and undefined with a single test.
As an side, it does feel like the
getLeadingMargin
function, and its neighbours, share a lot of common code. I'll have a look at refactoring as a separate PR.See how React and Relay have eslint set up – they use a common config from the fbjs-scripts package.
@spicyj thanks for the heads up, didn't realise there was a centralised lint configuration. I've updated the PR to use the
fbjs-scripts
eslint configuration and fixed all errors / warnings.Sweet! Outside of the typeof undefined and null, looks very good! Thanks for doing that
Fair point, guarding against redefinition of
undefined
is a little unnecessary, and does make the code less readable. I've made these updates.No problems :-)
Feel free to land if travis passes :)
Travis is happy - all done 👍