Skip to content

[core] Fix some upcoming eslint issues #34727

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

Merged
merged 1 commit into from
Oct 12, 2022
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
62 changes: 30 additions & 32 deletions docs/data/material/getting-started/templates/checkout/Checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,39 +87,37 @@ export default function Checkout() {
</Step>
))}
</Stepper>
<React.Fragment>
{activeStep === steps.length ? (
<React.Fragment>
<Typography variant="h5" gutterBottom>
Thank you for your order.
</Typography>
<Typography variant="subtitle1">
Your order number is #2001539. We have emailed your order
confirmation, and will send you an update when your order has
shipped.
</Typography>
</React.Fragment>
) : (
<React.Fragment>
{getStepContent(activeStep)}
<Box sx={{ display: 'flex', justifyContent: 'flex-end' }}>
{activeStep !== 0 && (
<Button onClick={handleBack} sx={{ mt: 3, ml: 1 }}>
Back
</Button>
)}

<Button
variant="contained"
onClick={handleNext}
sx={{ mt: 3, ml: 1 }}
>
{activeStep === steps.length - 1 ? 'Place order' : 'Next'}
{activeStep === steps.length ? (
<React.Fragment>
<Typography variant="h5" gutterBottom>
Thank you for your order.
</Typography>
<Typography variant="subtitle1">
Your order number is #2001539. We have emailed your order
confirmation, and will send you an update when your order has
shipped.
</Typography>
</React.Fragment>
) : (
<React.Fragment>
{getStepContent(activeStep)}
<Box sx={{ display: 'flex', justifyContent: 'flex-end' }}>
{activeStep !== 0 && (
<Button onClick={handleBack} sx={{ mt: 3, ml: 1 }}>
Back
</Button>
</Box>
</React.Fragment>
)}
</React.Fragment>
)}

<Button
variant="contained"
onClick={handleNext}
sx={{ mt: 3, ml: 1 }}
>
{activeStep === steps.length - 1 ? 'Place order' : 'Next'}
</Button>
</Box>
</React.Fragment>
)}
</Paper>
<Copyright />
</Container>
Expand Down
60 changes: 29 additions & 31 deletions docs/data/material/getting-started/templates/checkout/Checkout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,38 +87,36 @@ export default function Checkout() {
</Step>
))}
</Stepper>
<React.Fragment>
{activeStep === steps.length ? (
<React.Fragment>
<Typography variant="h5" gutterBottom>
Thank you for your order.
</Typography>
<Typography variant="subtitle1">
Your order number is #2001539. We have emailed your order
confirmation, and will send you an update when your order has
shipped.
</Typography>
</React.Fragment>
) : (
<React.Fragment>
{getStepContent(activeStep)}
<Box sx={{ display: 'flex', justifyContent: 'flex-end' }}>
{activeStep !== 0 && (
<Button onClick={handleBack} sx={{ mt: 3, ml: 1 }}>
Back
</Button>
)}
<Button
variant="contained"
onClick={handleNext}
sx={{ mt: 3, ml: 1 }}
>
{activeStep === steps.length - 1 ? 'Place order' : 'Next'}
{activeStep === steps.length ? (
<React.Fragment>
<Typography variant="h5" gutterBottom>
Thank you for your order.
</Typography>
<Typography variant="subtitle1">
Your order number is #2001539. We have emailed your order
confirmation, and will send you an update when your order has
shipped.
</Typography>
</React.Fragment>
) : (
<React.Fragment>
{getStepContent(activeStep)}
<Box sx={{ display: 'flex', justifyContent: 'flex-end' }}>
{activeStep !== 0 && (
<Button onClick={handleBack} sx={{ mt: 3, ml: 1 }}>
Back
</Button>
</Box>
</React.Fragment>
)}
</React.Fragment>
)}
<Button
variant="contained"
onClick={handleNext}
sx={{ mt: 3, ml: 1 }}
>
{activeStep === steps.length - 1 ? 'Place order' : 'Next'}
</Button>
</Box>
</React.Fragment>
)}
</Paper>
<Copyright />
</Container>
Expand Down
2 changes: 1 addition & 1 deletion docs/scripts/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function getLineFeed(source) {
return match === null ? os.EOL : match[0];
}

const fixBabelIssuesRegExp = new RegExp(/(?<=(\/>)|,)(\r?\n){2}/g);
const fixBabelIssuesRegExp = /(?<=(\/>)|,)(\r?\n){2}/g;
/**
* @param {string} source
*/
Expand Down
2 changes: 1 addition & 1 deletion docs/src/modules/components/AppNavDrawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ export default function AppNavDrawer(props) {

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

const renderVersionSelector = (versions = [], sx) => {
const renderVersionSelector = (versions, sx) => {
if (!versions?.length) {
return null;
}
Expand Down
4 changes: 2 additions & 2 deletions docs/src/modules/utils/i18n.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import PropTypes from 'prop-types';
import * as React from 'react';
import PropTypes from 'prop-types';

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

if (match) {
translations[match[1]] = req(filename);
Expand Down
5 changes: 1 addition & 4 deletions docs/src/modules/utils/replaceUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ export const replaceMaterialLinks = (url: string) => {
if (isNewLocation(url)) {
return url;
}
return url.replace(
new RegExp(`(guides|customization|getting-started|discover-more)`),
'material-ui/$1',
);
return url.replace(/(guides|customization|getting-started|discover-more)/, 'material-ui/$1');
};

export const replaceComponentLinks = (url: string) => {
Expand Down
7 changes: 2 additions & 5 deletions examples/nextjs-with-typescript-v4-migration/pages/about.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from 'react';
import type { NextPage } from 'next';
import Container from '@mui/material/Container';
import Typography from '@mui/material/Typography';
import Box from '@mui/material/Box';
Expand All @@ -20,7 +19,7 @@ const useStyles = makeStyles((theme) => ({
},
}));

const About: NextPage = () => {
export default function About() {
const classes = useStyles();
return (
<Container maxWidth="lg">
Expand All @@ -38,6 +37,4 @@ const About: NextPage = () => {
</div>
</Container>
);
};

export default About;
}
7 changes: 2 additions & 5 deletions examples/nextjs-with-typescript-v4-migration/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from 'react';
import type { NextPage } from 'next';
import Container from '@mui/material/Container';
import Typography from '@mui/material/Typography';
import { makeStyles } from '@mui/styles';
Expand All @@ -18,7 +17,7 @@ const useStyles = makeStyles((theme) => ({
},
}));

const Home: NextPage = () => {
export default function Home() {
const classes = useStyles();

return (
Expand All @@ -35,6 +34,4 @@ const Home: NextPage = () => {
</div>
</Container>
);
};

export default Home;
}
7 changes: 2 additions & 5 deletions examples/nextjs-with-typescript/pages/about.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from 'react';
import type { NextPage } from 'next';
import Container from '@mui/material/Container';
import Typography from '@mui/material/Typography';
import Box from '@mui/material/Box';
Expand All @@ -8,7 +7,7 @@ import Link from '../src/Link';
import ProTip from '../src/ProTip';
import Copyright from '../src/Copyright';

const About: NextPage = () => {
export default function About() {
return (
<Container maxWidth="lg">
<Box
Expand All @@ -33,6 +32,4 @@ const About: NextPage = () => {
</Box>
</Container>
);
};

export default About;
}
7 changes: 2 additions & 5 deletions examples/nextjs-with-typescript/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import * as React from 'react';
import type { NextPage } from 'next';
import Container from '@mui/material/Container';
import Typography from '@mui/material/Typography';
import Box from '@mui/material/Box';
import Link from '../src/Link';
import ProTip from '../src/ProTip';
import Copyright from '../src/Copyright';

const Home: NextPage = () => {
export default function Home() {
return (
<Container maxWidth="lg">
<Box
Expand All @@ -30,6 +29,4 @@ const Home: NextPage = () => {
</Box>
</Container>
);
};

export default Home;
}
2 changes: 1 addition & 1 deletion packages/mui-base/src/utils/appendOwnerState.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Simplify } from '@mui/types';
import React from 'react';
import isHostComponent from './isHostComponent';

/**
Expand Down