diff --git a/.eslintrc.js b/.eslintrc.js index c2de50d965d78..e3fd3e6439c61 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,6 +1,7 @@ const baseline = require('@mui/monorepo/.eslintrc'); const path = require('path'); +// TODO move this helper to @mui/monorepo/.eslintrc const buildPackageRestrictedImports = (packageName, root) => ({ files: [`packages/${root}/src/**/*{.ts,.tsx,.js}`], excludedFiles: ['*.d.ts', '*.spec.ts', '*.spec.tsx', '**.test.tx', '**.test.tsx'], @@ -50,10 +51,12 @@ module.exports = { */ rules: { ...baseline.rules, + // TODO move to @mui/monorepo, codebase is moving away from default exports 'import/prefer-default-export': 'off', // TODO move rule into the main repo once it has upgraded '@typescript-eslint/return-await': 'off', 'no-restricted-imports': 'off', + // TODO move to @mui/monorepo 'jsdoc/require-param': ['error', { contexts: ['TSFunctionType'] }], 'jsdoc/require-param-type': ['error', { contexts: ['TSFunctionType'] }], 'jsdoc/require-param-name': ['error', { contexts: ['TSFunctionType'] }], @@ -75,7 +78,10 @@ module.exports = { ], // Fixes false positive when using both `inputProps` and `InputProps` on the same example // See https://stackoverflow.com/questions/42367236/why-am-i-getting-this-warning-no-duplicate-props-allowed-react-jsx-no-duplicate + // TODO move to @mui/monorepo + // TODO rename the props to not fall in this case 'react/jsx-no-duplicate-props': [1, { ignoreCase: false }], + // TOOD move to @mui/monorepo, these are false positive 'react/no-unstable-nested-components': ['error', { allowAsProps: true }], }, overrides: [ @@ -114,6 +120,8 @@ module.exports = { }, parserOptions: { tsconfigRootDir: __dirname, project: ['./tsconfig.json'] }, }, + // TODO remove, shouldn't disable prop-type generation rule. + // lot of public components are missing it. { files: ['*.tsx'], excludedFiles: '*.spec.tsx', @@ -121,12 +129,6 @@ module.exports = { 'react/prop-types': 'off', }, }, - { - files: ['docs/data/**/*.js', 'docs/data/**/*.tsx'], - rules: { - 'filenames/match-exported': ['error'], - }, - }, { files: ['**/*.mjs'], rules: { @@ -137,6 +139,7 @@ module.exports = { files: ['packages/*/src/**/*{.ts,.tsx,.js}'], excludedFiles: ['*.d.ts', '*.spec.ts', '*.spec.tsx'], rules: { + 'react/prop-types': 'error', 'material-ui/mui-name-matches-component-name': [ 'error', {