-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[core] Lint with typescript-eslint parser #21758
Conversation
5f39f8b
to
935ebfb
Compare
Heads up: We recently bumped |
935ebfb
to
7243c5d
Compare
7243c5d
to
29f9613
Compare
faf0c05
to
5079f88
Compare
I have rebased, no change in the configuration was required :). |
extends: [ | ||
'plugin:import/recommended', | ||
'plugin:import/typescript', | ||
'airbnb-typescript', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What the motivation of usage predefined config? Why not to use recommended by @tpescript-eslint?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the end goal is to avoid developers or have to format the code once they copy and paste it from the demos. So the question we should answer to is: what's more popular in the community? Also, we have to consider that the stricter rules also cover lesser rules, meaning we can cover more developers by being more strict than the average.
The second goal is to make us more productive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that we were already using the Airbnb configuration. My objective was to lint TypeScript minimizing the diff. If we want to change the rules, that would be best in a different pull request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can discuss the preset in another issue. This PR should be limited to switching the parser and adding TS files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might've repeated myself but there's a lot to go through here. Big thanks to working on this 👍
extends: [ | ||
'plugin:import/recommended', | ||
'plugin:import/typescript', | ||
'airbnb-typescript', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can discuss the preset in another issue. This PR should be limited to switching the parser and adding TS files.
.eslintrc.js
Outdated
rules: { | ||
'@typescript-eslint/dot-notation': 'off', // Too slow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you enable the rules that are disabled with // Too slow
, you will timeout the CI. No answers after 10 minutes. It seems to get stuck. I haven't looked at why.
f3027d3
to
fe2a906
Compare
I have tried to take as many feedback as possible into account
Co-authored-by: Sebastian Silbermann <[email protected]>
40bab50
to
f34e233
Compare
'react/destructuring-assignment': 'off', // It's fine. | ||
'react/forbid-prop-types': 'off', // Too strict, no time for that | ||
'react/jsx-curly-brace-presence': 'off', // broken | ||
'react/jsx-filename-extension': ['error', { extensions: ['.js', '.tsx'] }], // airbnb is using .jsx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why no .jsx here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't care about restricting the file extensions that may contain JSX.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.jsx
isn't allowed, influenced by airbnb/javascript#985 (comment)
Follow-up on mui#21758 (comment)
This effort is part of a unification of the infrastructure that supports the authoring of outstanding React components for Material-UI between the main repository, the enterprise repository (written in TypeScript) and the pickers repository (written in TypeScript) that will likely be split between the main one for the MIT components and the x one for the enterprise features (#19706).
The objective is to find a configuration that works in the environment that sets the highest constraints (here) to then be able to copy and paste (until we find something better) the configuration to: