twilio-labs / twilio-style

Twilio's shareable ESLint config

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is This Too Opinionated To Be Used Broadly At Twilio?

hharnisc opened this issue Β· comments

Hey everyone πŸ‘‹

I tried hooking this up on a relatively new project and found it to be quite a lot of work to get past the lint phase (and there's still work left to fix the 100 or so warnings):

https://code.hq.twilio.com/identity/console-ui/pull/74/

I expected it to change most of the files because prettier is not configured and the conversion from tabs -> spaces (not a big deal). There were some great A11y issues and a couple security issues caught. However there were many changes that could not be autofixed and seemed to be more coding style that might not apply generally to Twilio and possibly more suited for a specific team. A couple examples:

react/no-multi-comp // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md
react/jsx-max-depth // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-max-depth.md
prefer-promise-reject-errors // https://eslint.org/docs/rules/prefer-promise-reject-errors

These are just a few examples, but there are quite a lot of rules configured in the packages. I wonder if all of these rules are important, or this was born of a set of opinions for a given team? It seems like we would be better off staying closer to the defaults -- and creating packages with more custom plugins for individual teams (or customizations applied at the project level lint config).

As it stands I don't think it would make sense for the team to approve this PR because many of the rules require changes that don't seem to have much benefit.

We started with the AirBnB linting rules, modified a few of them, and then added more plugins. I'd think you'll probably just get as many errors as us if you were to run the airbnb linter.

That's generally the issue when you add linter to an existing large project. My recommendation is to overwrite all of these problematic rules and change them to warn. Then slowly fix these warnings and remove them from the overwrite.

Thanks again for the history and context @ktalebian and @ahcai πŸ™Œ

Closing this in favor of our path forward and moving towards a set of standard rules for all teams!