Skip to content

Commit 551e824

Browse files
oliviertassinarialexfauquette
authored andcommitted
[core] Fix some upcoming eslint issues (mui#34727)
1 parent 61b60d0 commit 551e824

File tree

11 files changed

+73
-92
lines changed

11 files changed

+73
-92
lines changed

docs/data/material/getting-started/templates/checkout/Checkout.js

+30-32
Original file line numberDiff line numberDiff line change
@@ -87,39 +87,37 @@ export default function Checkout() {
8787
</Step>
8888
))}
8989
</Stepper>
90-
<React.Fragment>
91-
{activeStep === steps.length ? (
92-
<React.Fragment>
93-
<Typography variant="h5" gutterBottom>
94-
Thank you for your order.
95-
</Typography>
96-
<Typography variant="subtitle1">
97-
Your order number is #2001539. We have emailed your order
98-
confirmation, and will send you an update when your order has
99-
shipped.
100-
</Typography>
101-
</React.Fragment>
102-
) : (
103-
<React.Fragment>
104-
{getStepContent(activeStep)}
105-
<Box sx={{ display: 'flex', justifyContent: 'flex-end' }}>
106-
{activeStep !== 0 && (
107-
<Button onClick={handleBack} sx={{ mt: 3, ml: 1 }}>
108-
Back
109-
</Button>
110-
)}
111-
112-
<Button
113-
variant="contained"
114-
onClick={handleNext}
115-
sx={{ mt: 3, ml: 1 }}
116-
>
117-
{activeStep === steps.length - 1 ? 'Place order' : 'Next'}
90+
{activeStep === steps.length ? (
91+
<React.Fragment>
92+
<Typography variant="h5" gutterBottom>
93+
Thank you for your order.
94+
</Typography>
95+
<Typography variant="subtitle1">
96+
Your order number is #2001539. We have emailed your order
97+
confirmation, and will send you an update when your order has
98+
shipped.
99+
</Typography>
100+
</React.Fragment>
101+
) : (
102+
<React.Fragment>
103+
{getStepContent(activeStep)}
104+
<Box sx={{ display: 'flex', justifyContent: 'flex-end' }}>
105+
{activeStep !== 0 && (
106+
<Button onClick={handleBack} sx={{ mt: 3, ml: 1 }}>
107+
Back
118108
</Button>
119-
</Box>
120-
</React.Fragment>
121-
)}
122-
</React.Fragment>
109+
)}
110+
111+
<Button
112+
variant="contained"
113+
onClick={handleNext}
114+
sx={{ mt: 3, ml: 1 }}
115+
>
116+
{activeStep === steps.length - 1 ? 'Place order' : 'Next'}
117+
</Button>
118+
</Box>
119+
</React.Fragment>
120+
)}
123121
</Paper>
124122
<Copyright />
125123
</Container>

docs/data/material/getting-started/templates/checkout/Checkout.tsx

+29-31
Original file line numberDiff line numberDiff line change
@@ -87,38 +87,36 @@ export default function Checkout() {
8787
</Step>
8888
))}
8989
</Stepper>
90-
<React.Fragment>
91-
{activeStep === steps.length ? (
92-
<React.Fragment>
93-
<Typography variant="h5" gutterBottom>
94-
Thank you for your order.
95-
</Typography>
96-
<Typography variant="subtitle1">
97-
Your order number is #2001539. We have emailed your order
98-
confirmation, and will send you an update when your order has
99-
shipped.
100-
</Typography>
101-
</React.Fragment>
102-
) : (
103-
<React.Fragment>
104-
{getStepContent(activeStep)}
105-
<Box sx={{ display: 'flex', justifyContent: 'flex-end' }}>
106-
{activeStep !== 0 && (
107-
<Button onClick={handleBack} sx={{ mt: 3, ml: 1 }}>
108-
Back
109-
</Button>
110-
)}
111-
<Button
112-
variant="contained"
113-
onClick={handleNext}
114-
sx={{ mt: 3, ml: 1 }}
115-
>
116-
{activeStep === steps.length - 1 ? 'Place order' : 'Next'}
90+
{activeStep === steps.length ? (
91+
<React.Fragment>
92+
<Typography variant="h5" gutterBottom>
93+
Thank you for your order.
94+
</Typography>
95+
<Typography variant="subtitle1">
96+
Your order number is #2001539. We have emailed your order
97+
confirmation, and will send you an update when your order has
98+
shipped.
99+
</Typography>
100+
</React.Fragment>
101+
) : (
102+
<React.Fragment>
103+
{getStepContent(activeStep)}
104+
<Box sx={{ display: 'flex', justifyContent: 'flex-end' }}>
105+
{activeStep !== 0 && (
106+
<Button onClick={handleBack} sx={{ mt: 3, ml: 1 }}>
107+
Back
117108
</Button>
118-
</Box>
119-
</React.Fragment>
120-
)}
121-
</React.Fragment>
109+
)}
110+
<Button
111+
variant="contained"
112+
onClick={handleNext}
113+
sx={{ mt: 3, ml: 1 }}
114+
>
115+
{activeStep === steps.length - 1 ? 'Place order' : 'Next'}
116+
</Button>
117+
</Box>
118+
</React.Fragment>
119+
)}
122120
</Paper>
123121
<Copyright />
124122
</Container>

docs/scripts/helpers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function getLineFeed(source) {
88
return match === null ? os.EOL : match[0];
99
}
1010

11-
const fixBabelIssuesRegExp = new RegExp(/(?<=(\/>)|,)(\r?\n){2}/g);
11+
const fixBabelIssuesRegExp = /(?<=(\/>)|,)(\r?\n){2}/g;
1212
/**
1313
* @param {string} source
1414
*/

docs/src/modules/components/AppNavDrawer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ export default function AppNavDrawer(props) {
296296

297297
const navItems = renderNavItems({ onClose, pages, activePage, depth: 0, t });
298298

299-
const renderVersionSelector = (versions = [], sx) => {
299+
const renderVersionSelector = (versions, sx) => {
300300
if (!versions?.length) {
301301
return null;
302302
}

docs/src/modules/utils/i18n.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import PropTypes from 'prop-types';
21
import * as React from 'react';
2+
import PropTypes from 'prop-types';
33

44
function mapTranslations(req) {
55
const translations = {};
66
req.keys().forEach((filename) => {
7-
const match = filename.match(new RegExp(`-([a-z]{2}).json$`));
7+
const match = filename.match(/-([a-z]{2}).json$/);
88

99
if (match) {
1010
translations[match[1]] = req(filename);

docs/src/modules/utils/replaceUrl.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ export const replaceMaterialLinks = (url: string) => {
1717
if (isNewLocation(url)) {
1818
return url;
1919
}
20-
return url.replace(
21-
new RegExp(`(guides|customization|getting-started|discover-more)`),
22-
'material-ui/$1',
23-
);
20+
return url.replace(/(guides|customization|getting-started|discover-more)/, 'material-ui/$1');
2421
};
2522

2623
export const replaceComponentLinks = (url: string) => {

examples/nextjs-with-typescript-v4-migration/pages/about.tsx

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as React from 'react';
2-
import type { NextPage } from 'next';
32
import Container from '@mui/material/Container';
43
import Typography from '@mui/material/Typography';
54
import Box from '@mui/material/Box';
@@ -20,7 +19,7 @@ const useStyles = makeStyles((theme) => ({
2019
},
2120
}));
2221

23-
const About: NextPage = () => {
22+
export default function About() {
2423
const classes = useStyles();
2524
return (
2625
<Container maxWidth="lg">
@@ -38,6 +37,4 @@ const About: NextPage = () => {
3837
</div>
3938
</Container>
4039
);
41-
};
42-
43-
export default About;
40+
}

examples/nextjs-with-typescript-v4-migration/pages/index.tsx

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as React from 'react';
2-
import type { NextPage } from 'next';
32
import Container from '@mui/material/Container';
43
import Typography from '@mui/material/Typography';
54
import { makeStyles } from '@mui/styles';
@@ -18,7 +17,7 @@ const useStyles = makeStyles((theme) => ({
1817
},
1918
}));
2019

21-
const Home: NextPage = () => {
20+
export default function Home() {
2221
const classes = useStyles();
2322

2423
return (
@@ -35,6 +34,4 @@ const Home: NextPage = () => {
3534
</div>
3635
</Container>
3736
);
38-
};
39-
40-
export default Home;
37+
}

examples/nextjs-with-typescript/pages/about.tsx

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as React from 'react';
2-
import type { NextPage } from 'next';
32
import Container from '@mui/material/Container';
43
import Typography from '@mui/material/Typography';
54
import Box from '@mui/material/Box';
@@ -8,7 +7,7 @@ import Link from '../src/Link';
87
import ProTip from '../src/ProTip';
98
import Copyright from '../src/Copyright';
109

11-
const About: NextPage = () => {
10+
export default function About() {
1211
return (
1312
<Container maxWidth="lg">
1413
<Box
@@ -33,6 +32,4 @@ const About: NextPage = () => {
3332
</Box>
3433
</Container>
3534
);
36-
};
37-
38-
export default About;
35+
}

examples/nextjs-with-typescript/pages/index.tsx

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import * as React from 'react';
2-
import type { NextPage } from 'next';
32
import Container from '@mui/material/Container';
43
import Typography from '@mui/material/Typography';
54
import Box from '@mui/material/Box';
65
import Link from '../src/Link';
76
import ProTip from '../src/ProTip';
87
import Copyright from '../src/Copyright';
98

10-
const Home: NextPage = () => {
9+
export default function Home() {
1110
return (
1211
<Container maxWidth="lg">
1312
<Box
@@ -30,6 +29,4 @@ const Home: NextPage = () => {
3029
</Box>
3130
</Container>
3231
);
33-
};
34-
35-
export default Home;
32+
}

packages/mui-base/src/utils/appendOwnerState.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import * as React from 'react';
12
import { Simplify } from '@mui/types';
2-
import React from 'react';
33
import isHostComponent from './isHostComponent';
44

55
/**

0 commit comments

Comments
 (0)