-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[code-infra] Refactor eslint config #18643
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
Conversation
Deploy preview: https://deploy-preview-18643--material-ui-x.netlify.app/ Bundle size reportTotal Size Change: 0B(0.00%) - Total Gzip Change: 0B(0.00%) Show details for 100 more bundles (22 more not shown)@mui/x-charts parsed: 0B(0.00%) gzip: 0B(0.00%) |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
files: [`docs/**/*.${EXTENSION_TS}`], | ||
files: [ | ||
`docs/**/*.${EXTENSION_TS}`, | ||
`packages/{!x-data-grid*|!x-license|!x-telemetry}/src/**/*.{test|spec}.${EXTENSION_TS}`, |
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.
The negations here are to replicate the allowRootImports
behavior
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.
When I tried it, setting allowRootImports
default to false
didn't break the lint at all. Do we even need it?
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.
Good spot! 🙏
I've tested it a bit more and indeed, this rule does not seem to do anything and nor it did before... 🤷
The idea is to avoid importing the root of forbidden paths in test files.
I'm looking into it. 😉
@@ -1,3 +1,4 @@ | |||
// eslint-disable-next-line no-restricted-imports |
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.
This was the only case we had this line for: https://github.com/mui/mui-x/pull/18643/files#diff-9601a8f6c734c2001be34a2361f76946d19a39a709b5e8c624a2a5a0aade05f2L92
...buildPackageRestrictedImports('@mui/x-license', 'x-license'), | ||
...buildPackageRestrictedImports('@mui/x-telemetry', 'x-telemetry'), | ||
|
||
...[ |
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.
I hope this approach is more readable. 🤞
To me, it looks way clearer. 🤯
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.
Definitely cleaner.
Follow-up on #18562 (comment).