Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 9 additions & 40 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,29 +56,22 @@ module.exports = {
*/
rules: {
...baseline.rules,
// TODO move to @mui/monorepo, codebase is moving away from default exports https://github.com/mui/material-ui/issues/21862
/* TODO, trying to move to @mui/monorepo */
// codebase is moving away from default exports https://github.com/mui/material-ui/issues/21862
'import/prefer-default-export': 'off',
// TODO move rule into the main repo once it has upgraded
'@typescript-eslint/return-await': 'off',
Comment on lines -61 to -62
Copy link
Member Author

@oliviertassinari oliviertassinari Dec 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'no-restricted-imports': ['error', noRestrictedImports],
'react-compiler/react-compiler': 'error',
// Turning react/jsx-key back on.
// https://github.com/airbnb/javascript/blob/5155aa5fc1ea9bb2c6493a06ddbd5c7a05414c86/packages/eslint-config-airbnb/rules/react.js#L94
'react/jsx-key': ['error', { checkKeyMustBeforeSpread: true, warnOnDuplicates: true }],

/* Toolpad specfic */
'no-restricted-syntax': [
...baseline.rules['no-restricted-syntax'].filter((rule) => {
// Too opinionated for Toolpad
return rule?.selector !== 'ForOfStatement';
}),
],
// Turning react/jsx-key back on.
// https://github.com/airbnb/javascript/blob/5155aa5fc1ea9bb2c6493a06ddbd5c7a05414c86/packages/eslint-config-airbnb/rules/react.js#L94
'react/jsx-key': ['error', { checkKeyMustBeforeSpread: true, warnOnDuplicates: true }],
// This got turned of in the mono-repo:
// See https://github.com/mui/toolpad/pull/866#discussion_r957222171
'react/no-unused-prop-types': [
'error',
{
customValidators: [],
skipShapeProps: true,
},
],
'no-restricted-imports': ['error', noRestrictedImports],
'import/no-unresolved': [
'error',
{
Expand All @@ -100,37 +93,13 @@ module.exports = {
},
],
'material-ui/no-hardcoded-labels': 'off', // We are not really translating the docs/website anymore
'react-compiler/react-compiler': 'error',
},
overrides: [
...baseline.overrides,
{
files: ['**/*.test.js', '**/*.test.ts', '**/*.test.tsx'],
extends: ['plugin:testing-library/react'],
},
{
files: ['docs/src/modules/components/**/*.js'],
Copy link
Member Author

@oliviertassinari oliviertassinari Dec 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed, duplicate with

'material-ui/no-hardcoded-labels': 'off', // We are not really translating the docs/website anymore

rules: {
'material-ui/no-hardcoded-labels': 'off',
},
},
{
/**
* TODO move to @mui/monorepo
*
* Examples are for demostration purposes and should not be considered as part of the library.
* They don't contain an eslint setup, so we don't want them to contain eslint directives
* We do however want to keep the rules in place to ensure the examples are following
* a reasonably similar code style as the library.
*/
files: ['examples/**/*'],
Copy link
Member Author

@oliviertassinari oliviertassinari Dec 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rules: {
'no-console': 'off',
'no-underscore-dangle': 'off',
// no node_modules in examples as they are not installed
'import/no-unresolved': 'off',
},
},
{
files: [
'packages/create-toolpad-app/**/*',
Expand Down
Loading