diff --git a/.eslintrc.js b/.eslintrc.js index 7f2b9b58f5c08a..bd2be3d51ac989 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -299,7 +299,7 @@ module.exports = { }, // Next.js entry points pages { - files: ['docs/pages/**/*.js'], + files: ['docs/pages/**/*{.tsx,.js}'], rules: { 'react/prop-types': 'off', }, @@ -473,5 +473,36 @@ module.exports = { 'import/prefer-default-export': 'off', }, }, + { + /** + * Examples are for demonstration purposes and should not be considered a part of the library. + * They don't contain 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/**/*'], + rules: { + 'no-console': 'off', + 'no-underscore-dangle': 'off', + 'import/no-unresolved': 'off', + 'import/namespace': 'off', + 'import/extensions': 'off', + 'import/named': 'off', + 'import/no-duplicates': 'off', + 'import/no-named-as-default': 'off', + 'import/default': 'off', + 'import/no-named-as-default-member': 'off', + 'import/order': 'off', + // Reset the default until https://github.com/jsx-eslint/eslint-plugin-react/issues/3672 is fixed. + 'react/jsx-no-target-blank': ['error', { allowReferrer: false }], + }, + }, + { + // TODO, move rule to be global, propagate: https://github.com/mui/material-ui/issues/42169 + files: ['examples/pigment-css-remix-ts/**/*'], + rules: { + 'react/react-in-jsx-scope': 'off', + }, + }, ], }; diff --git a/examples/.eslintrc.js b/examples/.eslintrc.js deleted file mode 100644 index 1cfca7d337a8ca..00000000000000 --- a/examples/.eslintrc.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - rules: { - 'import/namespace': 'off', - 'import/no-unresolved': 'off', - 'import/extensions': 'off', - 'import/named': 'off', - 'import/no-duplicates': 'off', - 'import/no-named-as-default': 'off', - 'import/default': 'off', - 'import/no-named-as-default-member': 'off', - 'import/order': 'off', - // create-vite generates .jsx - 'react/jsx-filename-extension': 'off', - }, - overrides: [ - { - files: ['pigment-css-remix-ts/**/*.*'], - rules: { - 'react/react-in-jsx-scope': 'off', - }, - }, - ], -}; diff --git a/examples/material-ui-express-ssr/server.js b/examples/material-ui-express-ssr/server.js index 23e459d0c39d06..48f48168228f43 100644 --- a/examples/material-ui-express-ssr/server.js +++ b/examples/material-ui-express-ssr/server.js @@ -66,6 +66,5 @@ app.use(handleRender); const port = 3000; app.listen(port, () => { - // eslint-disable-next-line no-console console.log(`Listening on ${port}`); }); diff --git a/examples/material-ui-remix-ts/app/root.tsx b/examples/material-ui-remix-ts/app/root.tsx index cbf0ea6c807af9..d6ca7669ec7a30 100644 --- a/examples/material-ui-remix-ts/app/root.tsx +++ b/examples/material-ui-remix-ts/app/root.tsx @@ -31,7 +31,6 @@ const Document = withEmotionCache(({ children, title }: DocumentProps, emotionCa const tags = emotionCache.sheet.tags; emotionCache.sheet.flush(); tags.forEach((tag) => { - // eslint-disable-next-line no-underscore-dangle (emotionCache.sheet as any)._insertTag(tag); }); // reset cache to reapply global styles