Skip to content

Commit

Permalink
[code-infra] Create examples eslint rule (#42170)
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Potoms <2109932+Janpot@users.noreply.github.com>
Co-authored-by: Jan Potoms <2109932+Janpot@users.noreply.github.com>
  • Loading branch information
oliviertassinari and Janpot committed May 21, 2024
1 parent aae4ecc commit 8707eb1
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 26 deletions.
33 changes: 32 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
Expand Down Expand Up @@ -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',
},
},
],
};
23 changes: 0 additions & 23 deletions examples/.eslintrc.js

This file was deleted.

1 change: 0 additions & 1 deletion examples/material-ui-express-ssr/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,5 @@ app.use(handleRender);

const port = 3000;
app.listen(port, () => {
// eslint-disable-next-line no-console
console.log(`Listening on ${port}`);
});
1 change: 0 additions & 1 deletion examples/material-ui-remix-ts/app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8707eb1

Please sign in to comment.