diff --git a/.eslintrc.js b/.eslintrc.js index 37a5829e392401..670e229c62378b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -242,8 +242,6 @@ module.exports = /** @type {Config} */ ({ // We re-export default in many places, remove when https://github.com/airbnb/javascript/issues/2500 gets resolved 'no-restricted-exports': 'off', - // Some of these occurences are deliberate and fixing them will break things in repos that use @monorepo dependency - 'import/no-relative-packages': 'off', // Avoid accidental auto-"fixes" https://github.com/jsx-eslint/eslint-plugin-react/issues/3458 'react/no-invalid-html-attribute': 'off', @@ -304,15 +302,6 @@ module.exports = /** @type {Config} */ ({ 'react/no-unused-prop-types': 'off', }, }, - { - files: ['docs/src/modules/components/**/*.js'], - rules: { - 'material-ui/no-hardcoded-labels': [ - 'error', - { allow: ['MUI', 'X', 'GitHub', 'Stack Overflow'] }, - ], - }, - }, // Next.js plugin { files: ['docs/**/*'], @@ -325,18 +314,27 @@ module.exports = /** @type {Config} */ ({ rules: { // We're not using the Image component at the moment '@next/next/no-img-element': 'off', + 'no-restricted-imports': [ + 'error', + { + paths: NO_RESTRICTED_IMPORTS_PATHS_TOP_LEVEL_PACKAGES, + patterns: NO_RESTRICTED_IMPORTS_PATTERNS_DEEPLY_NESTED, + }, + ], }, }, - // Next.js entry points pages { - files: ['docs/pages/**/*.?(c|m)[jt]s?(x)'], + files: ['docs/src/modules/components/**/*'], rules: { - 'react/prop-types': 'off', + 'material-ui/no-hardcoded-labels': [ + 'error', + { allow: ['MUI', 'X', 'GitHub', 'Stack Overflow'] }, + ], }, }, // demos { - files: ['docs/src/pages/**/*.?(c|m)[jt]s?(x)', 'docs/data/**/*.?(c|m)[jt]s?(x)'], + files: ['docs/src/pages/**/*', 'docs/data/**/*'], rules: { // This most often reports data that is defined after the component definition. // This is safe to do and helps readability of the demo code since the data is mostly irrelevant. @@ -346,8 +344,15 @@ module.exports = /** @type {Config} */ ({ 'no-console': 'off', }, }, + // Next.js entry points pages + { + files: ['docs/pages/**/*'], + rules: { + 'react/prop-types': 'off', + }, + }, { - files: ['docs/data/**/*.?(c|m)[jt]s?(x)'], + files: ['docs/data/**/*'], excludedFiles: [ // filenames/match-exported sees filename as 'file-name.d' // Plugin looks unmaintain, find alternative? (e.g. eslint-plugin-project-structure) @@ -359,6 +364,14 @@ module.exports = /** @type {Config} */ ({ 'filenames/match-exported': ['error'], }, }, + { + files: ['docs/data/material/getting-started/templates/**/*'], + rules: { + // So we can use # to improve the page UX + // and so developer get eslint warning to remind them to fix the links + 'jsx-a11y/anchor-is-valid': 'off', + }, + }, { files: ['*.d.ts'], rules: { @@ -442,18 +455,6 @@ module.exports = /** @type {Config} */ ({ 'no-bitwise': 'off', }, }, - { - files: ['docs/**/*.?(c|m)[jt]s?(x)'], - rules: { - 'no-restricted-imports': [ - 'error', - { - paths: NO_RESTRICTED_IMPORTS_PATHS_TOP_LEVEL_PACKAGES, - patterns: NO_RESTRICTED_IMPORTS_PATTERNS_DEEPLY_NESTED, - }, - ], - }, - }, { files: ['packages/*/src/**/*.?(c|m)[jt]s?(x)'], excludedFiles: ['*.d.ts', '*.spec.*'], @@ -530,11 +531,9 @@ module.exports = /** @type {Config} */ ({ }, }, { - files: ['docs/data/material/getting-started/templates/**/*'], + files: ['apps/**/*'], rules: { - // So we can use # to improve the page UX - // and so developer get eslint warning to remind them to fix the links - 'jsx-a11y/anchor-is-valid': 'off', + 'import/no-relative-packages': 'off', }, }, ], diff --git a/dangerFileContent.ts b/dangerFileContent.ts index 8469d7f28978b6..89960978b0c16d 100644 --- a/dangerFileContent.ts +++ b/dangerFileContent.ts @@ -1,7 +1,8 @@ import { exec } from 'child_process'; import type * as dangerModule from 'danger'; +import replaceUrl from '@mui-internal/api-docs-builder/utils/replaceUrl'; +// eslint-disable-next-line import/no-relative-packages import { loadComparison } from './scripts/sizeSnapshot'; -import replaceUrl from './packages/api-docs-builder/utils/replaceUrl'; declare const danger: (typeof dangerModule)['danger']; declare const markdown: (typeof dangerModule)['markdown']; diff --git a/docs/scripts/updateIconSynonyms.js b/docs/scripts/updateIconSynonyms.js index 6b3cc0f1f6c152..22deec1e057f22 100644 --- a/docs/scripts/updateIconSynonyms.js +++ b/docs/scripts/updateIconSynonyms.js @@ -4,6 +4,7 @@ import fetch from 'cross-fetch'; import fse from 'fs-extra'; import * as mui from '@mui/icons-material'; import synonyms from 'docs/data/material/components/material-icons/synonyms'; +// eslint-disable-next-line import/no-relative-packages import myDestRewriter from '../../packages/mui-icons-material/renameFilters/material-design-icons'; function not(a, b) { diff --git a/docs/src/modules/components/ApiPage/list/ClassesList.tsx b/docs/src/modules/components/ApiPage/list/ClassesList.tsx index bce18f61354667..b3ea79b64cbd11 100644 --- a/docs/src/modules/components/ApiPage/list/ClassesList.tsx +++ b/docs/src/modules/components/ApiPage/list/ClassesList.tsx @@ -87,6 +87,7 @@ export default function ClassesList(props: ClassesListProps) { {description &&

} {displayClassKeys && !isGlobal && (

+ {/* eslint-disable-next-line material-ui/no-hardcoded-labels */} {'Rule name'}: {key}

diff --git a/docs/src/modules/components/ApiPage/list/PropertiesList.tsx b/docs/src/modules/components/ApiPage/list/PropertiesList.tsx index cd406c29d2ec30..85f73c32c3b7fa 100644 --- a/docs/src/modules/components/ApiPage/list/PropertiesList.tsx +++ b/docs/src/modules/components/ApiPage/list/PropertiesList.tsx @@ -157,11 +157,13 @@ export default function PropertiesList(props: PropertiesListProps) { {propName} {isProPlan && ( + // eslint-disable-next-line material-ui/no-hardcoded-labels )} {isPremiumPlan && ( + // eslint-disable-next-line material-ui/no-hardcoded-labels diff --git a/docs/src/modules/components/ApiPage/sections/ToggleDisplayOption.tsx b/docs/src/modules/components/ApiPage/sections/ToggleDisplayOption.tsx index 353805e3039281..12839405f03d59 100644 --- a/docs/src/modules/components/ApiPage/sections/ToggleDisplayOption.tsx +++ b/docs/src/modules/components/ApiPage/sections/ToggleDisplayOption.tsx @@ -117,7 +117,8 @@ export default function ToggleDisplayOption(props: ToggleDisplayOptionProps) { sx={{ height: '1.875rem', p: '6px 4px 6px 8px', textTransform: 'capitalize' }} > - View: + {/* eslint-disable-next-line material-ui/no-hardcoded-labels */} + {'View:'} {displayOption} @@ -136,7 +137,8 @@ export default function ToggleDisplayOption(props: ToggleDisplayOptionProps) { data-ga-event-action={sectionType} data-ga-event-label="table" > - Table + {/* eslint-disable-next-line material-ui/no-hardcoded-labels */} + {'Table'} @@ -149,7 +151,8 @@ export default function ToggleDisplayOption(props: ToggleDisplayOptionProps) { data-ga-event-action={sectionType} data-ga-event-label="expanded" > - Expanded list + {/* eslint-disable-next-line material-ui/no-hardcoded-labels */} + {'Expanded list'} @@ -162,7 +165,8 @@ export default function ToggleDisplayOption(props: ToggleDisplayOptionProps) { data-ga-event-action={sectionType} data-ga-event-label="collapsed" > - Collapsed list + {/* eslint-disable-next-line material-ui/no-hardcoded-labels */} + {'Collapsed list'} diff --git a/docs/src/modules/components/ApiPage/table/ClassesTable.tsx b/docs/src/modules/components/ApiPage/table/ClassesTable.tsx index 025c6e4b242682..463e7aa2685f59 100644 --- a/docs/src/modules/components/ApiPage/table/ClassesTable.tsx +++ b/docs/src/modules/components/ApiPage/table/ClassesTable.tsx @@ -65,9 +65,11 @@ export default function ClassesTable(props: ClassesTableProps) { - Class name - {displayClassKeys && Rule name} - Description + {/* eslint-disable material-ui/no-hardcoded-labels */} + {'Class name'} + {displayClassKeys && {'Rule name'}} + {'Description'} + {/* eslint-enable material-ui/no-hardcoded-labels */} diff --git a/docs/src/modules/components/ApiPage/table/PropertiesTable.tsx b/docs/src/modules/components/ApiPage/table/PropertiesTable.tsx index c08aff256245d7..356f62187cef06 100644 --- a/docs/src/modules/components/ApiPage/table/PropertiesTable.tsx +++ b/docs/src/modules/components/ApiPage/table/PropertiesTable.tsx @@ -133,10 +133,12 @@ export default function PropertiesTable(props: PropertiesTableProps) { - Name - Type - {hasDefaultColumn && Default} - Description + {/* eslint-disable material-ui/no-hardcoded-labels */} + {'Name'} + {'Type'} + {hasDefaultColumn && {'Default'}} + {'Description'} + {/* eslint-enable material-ui/no-hardcoded-labels */} @@ -168,11 +170,13 @@ export default function PropertiesTable(props: PropertiesTableProps) { {isRequired ? '*' : ''} {isOptional ? '?' : ''} {isProPlan && ( + // eslint-disable-next-line material-ui/no-hardcoded-labels )} {isPremiumPlan && ( + // eslint-disable-next-line material-ui/no-hardcoded-labels diff --git a/docs/src/modules/components/ApiPage/table/SlotsTable.tsx b/docs/src/modules/components/ApiPage/table/SlotsTable.tsx index de1e6ee7889888..ae82b75331ae3c 100644 --- a/docs/src/modules/components/ApiPage/table/SlotsTable.tsx +++ b/docs/src/modules/components/ApiPage/table/SlotsTable.tsx @@ -97,6 +97,7 @@ export default function SlotsTable(props: SlotsTableProps) { {name} + {/* eslint-disable-next-line material-ui/no-hardcoded-labels */} {className && {`.${className}`}} {defaultValue && {defaultValue}} diff --git a/docs/src/modules/components/JoyThemeBuilder.tsx b/docs/src/modules/components/JoyThemeBuilder.tsx index 834d439b77594d..6f0feae3ffa79e 100644 --- a/docs/src/modules/components/JoyThemeBuilder.tsx +++ b/docs/src/modules/components/JoyThemeBuilder.tsx @@ -1,3 +1,4 @@ +/* eslint-disable material-ui/no-hardcoded-labels */ import * as React from 'react'; import TypeScriptIcon from '@mui/docs/svgIcons/TypeScript'; import startCase from 'lodash/startCase'; diff --git a/docs/src/modules/components/JoyUsageDemo.tsx b/docs/src/modules/components/JoyUsageDemo.tsx index 98804104e7b016..cd62b187277655 100644 --- a/docs/src/modules/components/JoyUsageDemo.tsx +++ b/docs/src/modules/components/JoyUsageDemo.tsx @@ -1,3 +1,4 @@ +/* eslint-disable material-ui/no-hardcoded-labels */ import * as React from 'react'; import Check from '@mui/icons-material/Check'; import CheckRounded from '@mui/icons-material/CheckRounded'; diff --git a/docs/src/modules/components/JoyVariablesDemo.tsx b/docs/src/modules/components/JoyVariablesDemo.tsx index a691cc654f9112..f350f110fe3531 100644 --- a/docs/src/modules/components/JoyVariablesDemo.tsx +++ b/docs/src/modules/components/JoyVariablesDemo.tsx @@ -1,3 +1,4 @@ +/* eslint-disable material-ui/no-hardcoded-labels */ import * as React from 'react'; import Box from '@mui/joy/Box'; import Divider from '@mui/joy/Divider'; diff --git a/docs/src/modules/components/MuiProductSelector.tsx b/docs/src/modules/components/MuiProductSelector.tsx index c6f3f9980b5088..af9370110bd50d 100644 --- a/docs/src/modules/components/MuiProductSelector.tsx +++ b/docs/src/modules/components/MuiProductSelector.tsx @@ -260,6 +260,7 @@ const MuiProductSelector = React.forwardRef(function MuiProductSelector( }, }} > + {/* eslint-disable-next-line material-ui/no-hardcoded-labels */} MUI X Components {advancedProducts.map((product) => ( @@ -292,6 +293,7 @@ const MuiProductSelector = React.forwardRef(function MuiProductSelector( }} > + {/* eslint-disable-next-line material-ui/no-hardcoded-labels */} Toolpad + {/* eslint-disable-next-line material-ui/no-hardcoded-labels */} {`${objectKey}: `} {type === 'color' ? ( diff --git a/packages/rsc-builder/buildRsc.ts b/packages/rsc-builder/buildRsc.ts index b8f78490bcada1..72211bac33a6d2 100644 --- a/packages/rsc-builder/buildRsc.ts +++ b/packages/rsc-builder/buildRsc.ts @@ -1,8 +1,8 @@ import path from 'path'; import * as yargs from 'yargs'; import * as fse from 'fs-extra'; -import findComponents from '../api-docs-builder/utils/findComponents'; -import findHooks from '../api-docs-builder/utils/findHooks'; +import findComponents from '@mui-internal/api-docs-builder/utils/findComponents'; +import findHooks from '@mui-internal/api-docs-builder/utils/findHooks'; type CommandOptions = { grep?: string };