Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Bump monorepo #14141

Merged
merged 15 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
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
77 changes: 46 additions & 31 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@ const addReactCompilerRule = (packagesNames, isEnabled) =>
},
}));

const RESTRICTED_TOP_LEVEL_IMPORTS = [
'@mui/material',
'@mui/x-charts',
'@mui/x-charts-pro',
'@mui/x-codemod',
'@mui/x-date-pickers',
'@mui/x-date-pickers-pro',
'@mui/x-tree-view',
'@mui/x-tree-view-pro',
];

// TODO move this helper to @mui/monorepo/.eslintrc
// It needs to know about the parent "no-restricted-imports" to not override them.
const buildPackageRestrictedImports = (packageName, root, allowRootImports = true) => [
Expand Down Expand Up @@ -85,43 +96,16 @@ const buildPackageRestrictedImports = (packageName, root, allowRootImports = tru
files: [
`packages/${root}/src/**/*.test{.ts,.tsx,.js}`,
`packages/${root}/src/**/*.spec{.ts,.tsx,.js}`,
'docs/data/**/*{.ts,.tsx,.js}',
],
excludedFiles: ['*.d.ts'],
rules: {
'no-restricted-imports': [
'error',
{
paths: [
{
name: '@mui/x-charts',
message: 'Use deeper import instead',
},
{
name: '@mui/x-charts-pro',
message: 'Use deeper import instead',
},
{
name: '@mui/x-codemod',
message: 'Use deeper import instead',
},
{
name: '@mui/x-date-pickers',
message: 'Use deeper import instead',
},
{
name: '@mui/x-date-pickers-pro',
message: 'Use deeper import instead',
},
{
name: '@mui/x-tree-view',
message: 'Use deeper import instead',
},
{
name: '@mui/x-tree-view-pro',
message: 'Use deeper import instead',
},
],
paths: RESTRICTED_TOP_LEVEL_IMPORTS.map((name) => ({
name,
message: 'Use deeper import instead',
})),
},
],
},
Expand Down Expand Up @@ -269,6 +253,37 @@ module.exports = {
],
},
},
{
files: ['docs/**/*{.ts,.tsx,.js}'],
excludedFiles: ['*.d.ts'],
rules: {
'no-restricted-imports': [
'error',
{
paths: RESTRICTED_TOP_LEVEL_IMPORTS.map((name) => ({
name,
message: 'Use deeper import instead',
})),
patterns: [
{
group: [
'@mui/*/*/*',
// Allow any import depth with any internal packages
'!@mui/internal-*/**',

// Exceptions (QUESTION: Keep or remove?)
'!@mui/x-date-pickers/internals/demo',
'!@mui/x-tree-view/hooks/useTreeViewApiRef',
// TODO: export this from /ButtonBase in core. This will break after we move to package exports
'!@mui/material/ButtonBase/TouchRipple',
],
message: 'Use less deep import instead',
},
],
},
],
},
},
...buildPackageRestrictedImports('@mui/x-charts', 'x-charts', false),
...buildPackageRestrictedImports('@mui/x-charts-pro', 'x-charts-pro', false),
...buildPackageRestrictedImports('@mui/x-codemod', 'x-codemod', false),
Expand Down
5 changes: 5 additions & 0 deletions docs/.link-check-errors.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
Broken links found by `docs:link-check` that exist:

- https://mui.com/material-ui/customization/css-theme-variables/configuration/#advanced-configuration
- https://mui.com/material-ui/customization/css-theme-variables/configuration/#changing-variable-prefixes
- https://mui.com/material-ui/customization/theme-components/#creating-new-component-variants
- https://mui.com/material-ui/customization/theme-components/#overrides-based-on-props
- https://mui.com/material-ui/react-grid2/#whats-changed
2 changes: 1 addition & 1 deletion docs/data/charts-component-api-pages.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { MuiPage } from '@mui/monorepo/docs/src/MuiPage';
import type { MuiPage } from 'docs/src/MuiPage';

const apiPages: MuiPage[] = [
{
Expand Down
3 changes: 2 additions & 1 deletion docs/data/charts/pie-demo/OnSeriesItemClick.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as React from 'react';
import { PieChart } from '@mui/x-charts/PieChart';

Copy link
Member Author

Choose a reason for hiding this comment

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

Can't remove this newline for some reason. But didn't take the time to look into it.

Copy link
Member

Choose a reason for hiding this comment

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

This behavior is known and we tend to ignore it. 🙈
P.S. I take it that adding type after import doesn't change anything? 🤔

Copy link
Member Author

@Janpot Janpot Aug 14, 2024

Choose a reason for hiding this comment

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

It signals compilers that this import is not usable as a javascript value. Can be important depending on the context this is compiled in.

import { Typography, Stack } from '@mui/material';
import Typography from '@mui/material/Typography';
import Stack from '@mui/material/Stack';

const items = [
{ value: 10, label: 'Series A ( no Id )' },
Expand Down
3 changes: 2 additions & 1 deletion docs/data/charts/pie-demo/OnSeriesItemClick.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as React from 'react';
import { PieChart } from '@mui/x-charts/PieChart';
import { PieItemIdentifier, DefaultizedPieValueType } from '@mui/x-charts/models';
import { Typography, Stack } from '@mui/material';
import Typography from '@mui/material/Typography';
import Stack from '@mui/material/Stack';

const items = [
{ value: 10, label: 'Series A ( no Id )' },
Expand Down
12 changes: 5 additions & 7 deletions docs/data/charts/scatter/VoronoiInteraction.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import * as React from 'react';
import {
Stack,
FormControlLabel,
Checkbox,
Typography,
Slider,
} from '@mui/material';
import Stack from '@mui/material/Stack';
import FormControlLabel from '@mui/material/FormControlLabel';
import Checkbox from '@mui/material/Checkbox';
import Typography from '@mui/material/Typography';
import Slider from '@mui/material/Slider';
import { ScatterChart } from '@mui/x-charts/ScatterChart';

const data = [
Expand Down
12 changes: 5 additions & 7 deletions docs/data/charts/scatter/VoronoiInteraction.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import * as React from 'react';
import {
Stack,
FormControlLabel,
Checkbox,
Typography,
Slider,
} from '@mui/material';
import Stack from '@mui/material/Stack';
import FormControlLabel from '@mui/material/FormControlLabel';
import Checkbox from '@mui/material/Checkbox';
import Typography from '@mui/material/Typography';
import Slider from '@mui/material/Slider';
import { ScatterChart } from '@mui/x-charts/ScatterChart';

const data = [
Expand Down
2 changes: 1 addition & 1 deletion docs/data/data-grid-component-api-pages.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { MuiPage } from '@mui/monorepo/docs/src/MuiPage';
import type { MuiPage } from 'docs/src/MuiPage';

const apiPages: MuiPage[] = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
gridFilteredDescendantRowCountSelector,
} from '@mui/x-data-grid-premium';
import { useMovieData } from '@mui/x-data-grid-generator';
import { Box } from '@mui/material';
import Box from '@mui/material/Box';

function CustomFooterRowCount(props) {
const { visibleRowCount: topLevelRowCount } = props;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
gridFilteredDescendantRowCountSelector,
} from '@mui/x-data-grid-premium';
import { useMovieData } from '@mui/x-data-grid-generator';
import { Box } from '@mui/material';
import Box from '@mui/material/Box';

function CustomFooterRowCount(props: GridRowCountProps) {
const { visibleRowCount: topLevelRowCount } = props;
Expand Down
2 changes: 1 addition & 1 deletion docs/data/date-pickers-component-api-pages.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { MuiPage } from '@mui/monorepo/docs/src/MuiPage';
import type { MuiPage } from 'docs/src/MuiPage';

const apiPages: MuiPage[] = [
{
Expand Down
4 changes: 2 additions & 2 deletions docs/data/date-pickers/lifecycle/lifecycle.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ You can find more information [in the dedicated doc section](/x/react-date-picke

The `onChange` callback is called whenever the current value changes.

If you don't want to listen to the intermediary steps, consider using the [`onAccept` prop](/x/react-date-pickers/lifecycle/#lifecycle-on-pickers-onaccept) instead.
If you don't want to listen to the intermediary steps, consider using the [`onAccept` prop](/x/react-date-pickers/lifecycle/#lifecycle-on-pickers-quot-onaccept-quot) instead.
LukasTy marked this conversation as resolved.
Show resolved Hide resolved

```tsx
<DatePicker onChange={(value) => setValue(value)} />
Expand Down Expand Up @@ -392,6 +392,6 @@ In such a case, the recommended UI is to add a button for validating the form.
If for some reason, you need to send the data to the server without having the user pressing a validation button, you can debounce the `onChange` as follows.

The following demo shows how to extend the Date Field component by adding an `onAccept` prop, which is a debounced version of `onChange`.
You can find more information about the `onAccept` prop [in the dedicated doc section](/x/react-date-pickers/lifecycle/#lifecycle-on-pickers-onaccept).
You can find more information about the `onAccept` prop [in the dedicated doc section](/x/react-date-pickers/lifecycle/#lifecycle-on-pickers-quot-onaccept-quot).

{{"demo": "ServerInteraction.js"}}
2 changes: 1 addition & 1 deletion docs/data/pages.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { MuiPage } from '@mui/monorepo/docs/src/MuiPage';
import type { MuiPage } from 'docs/src/MuiPage';
import dataGridComponentApi from './data-grid-component-api-pages';
import pickersComponentApi from './date-pickers-component-api-pages';
import chartsComponentApi from './charts-component-api-pages';
Expand Down
2 changes: 1 addition & 1 deletion docs/data/tree-view-component-api-pages.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { MuiPage } from '@mui/monorepo/docs/src/MuiPage';
import type { MuiPage } from 'docs/src/MuiPage';

const apiPages: MuiPage[] = [
{
Expand Down
1 change: 1 addition & 0 deletions docs/docs-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '@types/react-docgen';
2 changes: 1 addition & 1 deletion docs/pages/_document.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import MyDocument from '@mui/monorepo/docs/pages/_document';
import MyDocument from 'docs/pages/_document';

export default MyDocument;
1 change: 0 additions & 1 deletion docs/src/modules/components/overview/DateLibraries.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from 'react';
// @ts-ignore
import SectionHeadline from 'docs/src/components/typography/SectionHeadline';
import { HighlightedCode } from '@mui/docs/HighlightedCode';
import Box from '@mui/material/Box';
Expand Down
13 changes: 5 additions & 8 deletions docs/src/modules/components/overview/Internationalization.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'dayjs/locale/zh-cn';
import utc from 'dayjs/plugin/utc';
import timezone from 'dayjs/plugin/timezone';
import { styled, createTheme, ThemeProvider, useTheme } from '@mui/material/styles';
// @ts-ignore
import SectionHeadline from 'docs/src/components/typography/SectionHeadline';
import Box from '@mui/material/Box';
import Button from '@mui/material/Button';
Expand All @@ -16,13 +15,11 @@ import MuiToggleButtonGroup, { toggleButtonGroupClasses } from '@mui/material/To
import MuiToggleButton from '@mui/material/ToggleButton';
import Typography from '@mui/material/Typography';
import ArrowForwardIcon from '@mui/icons-material/ArrowForward';
import {
DateTimeRangePicker,
DateTimeField,
DatePicker,
DateTimeValidationError,
DateCalendar,
} from '@mui/x-date-pickers-pro';
import { DateTimeRangePicker } from '@mui/x-date-pickers-pro/DateTimeRangePicker';
import { DateTimeField } from '@mui/x-date-pickers/DateTimeField';
import { DatePicker } from '@mui/x-date-pickers/DatePicker';
import { DateTimeValidationError } from '@mui/x-date-pickers/models';
import { DateCalendar } from '@mui/x-date-pickers/DateCalendar';
import { AdapterDayjs } from '@mui/x-date-pickers-pro/AdapterDayjs';
import { LocalizationProvider } from '@mui/x-date-pickers-pro/LocalizationProvider';
import { roRO, enUS, zhCN } from '@mui/x-date-pickers-pro/locales';
Expand Down
1 change: 0 additions & 1 deletion docs/src/modules/components/overview/Keyboard.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as React from 'react';
import clsx from 'clsx';
import dayjs from 'dayjs';
// @ts-ignore
import SectionHeadline from 'docs/src/components/typography/SectionHeadline';
import Button from '@mui/material/Button';
import Divider from '@mui/material/Divider';
Expand Down
1 change: 0 additions & 1 deletion docs/src/modules/components/overview/XLogo.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from 'react';
import Typography from '@mui/material/Typography';
// @ts-ignore
import IconImage from 'docs/src/components/icon/IconImage';

export default function XLogo() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { styled } from '@mui/material/styles';
import Card from '@mui/material/Card';
import Paper from '@mui/material/Paper';
import Typography from '@mui/material/Typography';
import { StaticTimePicker } from '@mui/x-date-pickers/StaticTimePicker';
import { StaticTimePicker, StaticTimePickerProps } from '@mui/x-date-pickers/StaticTimePicker';
import {
PickersLayoutProps,
usePickerLayout,
Expand All @@ -14,7 +14,6 @@ import {
} from '@mui/x-date-pickers/PickersLayout';
import { renderMultiSectionDigitalClockTimeView } from '@mui/x-date-pickers/timeViewRenderers';
import { TimeView } from '@mui/x-date-pickers/models';
import { TimePickerViewRenderers } from '@mui/x-date-pickers/TimePicker/shared';

const StyledLayout = styled(PickersLayoutRoot)({
overflow: 'auto',
Expand Down Expand Up @@ -58,7 +57,7 @@ export default function DigitalClock() {
hours: renderMultiSectionDigitalClockTimeView,
minutes: renderMultiSectionDigitalClockTimeView,
meridiem: renderMultiSectionDigitalClockTimeView,
} as TimePickerViewRenderers<Dayjs, 'meridiem' | TimeView, any>
} as StaticTimePickerProps<Dayjs>['viewRenderers']
}
/>
</Paper>
Expand Down
8 changes: 7 additions & 1 deletion docs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
"esModuleInterop": true,
"incremental": true
},
"include": ["pages/**/*.ts*", "data/**/*", "src/modules/components/**/*", "next.config.mjs"],
"include": [
"pages/**/*.ts*",
"data/**/*",
"src/modules/components/**/*",
"next.config.mjs",
"docs-env.d.ts"
],
"exclude": ["docs/.next", "docs/export", "pages/playground"]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"@mui/internal-markdown": "^1.0.9",
"@mui/internal-test-utils": "^1.0.7",
"@mui/material": "^5.16.5",
"@mui/monorepo": "github:mui/material-ui#4a82b6b0e0395db8fa0a0d49b6b76de4516b1579",
"@mui/monorepo": "github:mui/material-ui#0acfe665034fdf4578156ebaf4372713cf23bce4",
"@mui/utils": "^5.16.5",
"@next/eslint-plugin-next": "14.2.5",
"@octokit/plugin-retry": "^7.1.1",
Expand Down
Loading