4 ms·
Enforce shared ESLint rules on commit, and use Airbnb+React with most of the defaults set.
by Andrex 6y ago
Enforce shared ESLint rules on commit, and use Airbnb+React with most of the defaults set.
- jakelazaroff 6y agoHow would that catch a misspelled prop name?
- mikewhy 6y agoYou would end up defining PropTypes, and ESLint is capable of keeping you in check there. It's much worse than just using TypeScript (only at runtime, PropTypes aren't that useful anywhere else, PropType syntax doesn't match Flow, TS, or jsdoc, ESLint can't check any PropTypes you spread in), but it can get you by in a pinch.
- ngerrity 6y agolinting wouldn't, but if you're writing unit tests, that kind of problem would be caught pretty quickly.
- mikewhy 6y agoThis also works in TypeScript's favor. Meaning you can skip writing tests that simply check you're giving the correct props.
- nailer 6y agoI don't think anyone /does/ write tests that simply check they're giving the correct props. They write unit tests, and props are part of that.
- eyelidlessness 6y agoThis also works in TypeScript's favor. You get test coverage which you would never write. A "simple" component that doesn't have any logic and doesn't warrant a test still checks its prop types, and you don't have to do anything other than make the compiler pass.
- gameswithgo 6y agoa sufficiently complex linting process is a transpiled language, with the same downsides
- Andrex 6y agoI would advocate for as much simplicity as possible then. :)