Skip to content

Commit

Permalink
Convert all ReactDOM imports to import *
Browse files Browse the repository at this point in the history
  • Loading branch information
mj12albert committed Feb 15, 2023
1 parent a8aa46c commit 12edb1f
Show file tree
Hide file tree
Showing 39 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion benchmark/browser/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import ReactDOM from 'react-dom';
import * as ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import { logReactMetrics } from './utils';

Expand Down
2 changes: 1 addition & 1 deletion benchmark/server/scenarios/core.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-console */
import Benchmark from 'benchmark';
import * as React from 'react';
import ReactDOMServer from 'react-dom/server';
import * as ReactDOMServer from 'react-dom/server';
import { StylesProvider } from '@mui/styles';
import ButtonBase from '@mui/material/ButtonBase';

Expand Down
2 changes: 1 addition & 1 deletion benchmark/server/scenarios/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Benchmark from 'benchmark';
import fs from 'fs';
import path from 'path';
import * as React from 'react';
import ReactDOMServer from 'react-dom/server';
import * as ReactDOMServer from 'react-dom/server';
import MarkdownElement from 'docs/src/modules/components/MarkdownElement';
import Markdown from 'docs/data/material/getting-started/templates/blog/Markdown';
import { createStore } from 'redux';
Expand Down
2 changes: 1 addition & 1 deletion benchmark/server/scenarios/server.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-console */
import express from 'express';
import * as React from 'react';
import ReactDOMServer from 'react-dom/server';
import * as ReactDOMServer from 'react-dom/server';
import { SheetsRegistry } from 'jss';
import { createTheme } from '@mui/material/styles';
import {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/server/scenarios/styles.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-console */
import Benchmark from 'benchmark';
import * as React from 'react';
import ReactDOMServer from 'react-dom/server';
import * as ReactDOMServer from 'react-dom/server';
import styledComponents, { ServerStyleSheet } from 'styled-components';
import styledEmotion from '@emotion/styled';
import { css } from '@emotion/react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Finally, you need to provide an implementation of [matchMedia](https://developer
For instance on the server-side:

```js
import ReactDOMServer from 'react-dom/server';
import * as ReactDOMServer from 'react-dom/server';
import parser from 'ua-parser-js';
import mediaQuery from 'css-mediaquery';
import { ThemeProvider } from '@material-ui/core/styles';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ Finally, you need to provide an implementation of [matchMedia](https://developer
For instance on the server-side:

```js
import ReactDOMServer from 'react-dom/server';
import * as ReactDOMServer from 'react-dom/server';
import parser from 'ua-parser-js';
import mediaQuery from 'css-mediaquery';
import { ThemeProvider } from '@mui/core/styles';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Using [css-mediaquery](https://github.com/ericf/css-mediaquery) to emulate match
For instance on the server-side:

```js
import ReactDOMServer from 'react-dom/server';
import * as ReactDOMServer from 'react-dom/server';
import parser from 'ua-parser-js';
import mediaQuery from 'css-mediaquery';
import { createTheme, ThemeProvider } from '@mui/material/styles';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ Import the initializer in `/src/index.js`.
```diff
+import './MuiClassNameSetup';
import * as React from 'react';
import ReactDOM from 'react-dom';
import * as ReactDOM from 'react-dom';
import App from './App';

ReactDOM.render(<App />);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ Import the initializer in `/src/index.js`.
```diff
+import './MuiClassNameSetup';
import * as React from 'react';
import ReactDOM from 'react-dom';
import * as ReactDOM from 'react-dom';
import App from './App';

ReactDOM.render(<App />);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ Import the initializer in `/src/index.js`.
```diff
+import './MuiClassNameSetup';
import * as React from 'react';
import ReactDOM from 'react-dom';
import * as ReactDOM from 'react-dom';
import App from './App';

ReactDOM.render(<App />);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Vamos ver como isso é passado na função `renderFullPage`.
```jsx
import express from 'express';
import * as React from 'react';
import ReactDOMServer from 'react-dom/server';
import * as ReactDOMServer from 'react-dom/server';
import CssBaseline from '@material-ui/core/CssBaseline';
import { ThemeProvider } from '@material-ui/core/styles';
import createEmotionServer from '@emotion/server/create-instance';
Expand Down Expand Up @@ -181,7 +181,7 @@ The client-side is straightforward. All we need to do is use the same cache conf

```jsx
import * as React from 'react';
import ReactDOM from 'react-dom';
import * as ReactDOM from 'react-dom';
import CssBaseline from '@material-ui/core/CssBaseline';
import { ThemeProvider } from '@material-ui/core/styles';
import { CacheProvider } from '@emotion/react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ With this we are creating a new Emotion cache instance and using this to extract
```jsx
import express from 'express';
import * as React from 'react';
import ReactDOMServer from 'react-dom/server';
import * as ReactDOMServer from 'react-dom/server';
import CssBaseline from '@mui/material/CssBaseline';
import { ThemeProvider } from '@mui/material/styles';
import { CacheProvider } from '@emotion/react';
Expand Down Expand Up @@ -150,7 +150,7 @@ app.use(handleRender);
const port = 3000;
app.listen(port); import express from 'express';
import * as React from 'react';
import ReactDOMServer from 'react-dom/server';
import * as ReactDOMServer from 'react-dom/server';
import CssBaseline from '@mui/core/CssBaseline';
import { ThemeProvider } from '@mui/core/styles';
import createEmotionServer from '@emotion/server/create-instance';
Expand Down Expand Up @@ -220,7 +220,7 @@ The client-side is straightforward. All we need to do is use the same cache conf

```jsx
import * as React from 'react';
import ReactDOM from 'react-dom';
import * as ReactDOM from 'react-dom';
import CssBaseline from '@mui/core/CssBaseline';
import { ThemeProvider } from '@mui/core/styles';
import { CacheProvider } from '@emotion/react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ We will see how this is passed along in the `renderFullPage` function.
```jsx
import express from 'express';
import * as React from 'react';
import ReactDOMServer from 'react-dom/server';
import * as ReactDOMServer from 'react-dom/server';
import CssBaseline from '@mui/material/CssBaseline';
import { ThemeProvider } from '@mui/material/styles';
import { CacheProvider } from '@emotion/react';
Expand Down Expand Up @@ -186,7 +186,7 @@ Let's take a look at the client file:

```jsx
import * as React from 'react';
import ReactDOM from 'react-dom';
import * as ReactDOM from 'react-dom';
import CssBaseline from '@mui/material/CssBaseline';
import { ThemeProvider } from '@mui/material/styles';
import { CacheProvider } from '@emotion/react';
Expand Down
2 changes: 1 addition & 1 deletion docs/data/styles/advanced/advanced-pt.md
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ export default function App() {
This example returns a string of HTML and inlines the critical CSS required, right before it's used:

```jsx
import ReactDOMServer from 'react-dom/server';
import * as ReactDOMServer from 'react-dom/server';
import { ServerStyleSheets } from '@material-ui/styles';

function render() {
Expand Down
2 changes: 1 addition & 1 deletion docs/data/styles/advanced/advanced-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ const jss = create({
这个例子返回一个HTML字符串,并在使用前将所需的关键CSS内联。
```jsx
import ReactDOMServer from 'react-dom/server';
import * as ReactDOMServer from 'react-dom/server';
import { ServerStyleSheets } from '@mui/styles';

function render() {
Expand Down
2 changes: 1 addition & 1 deletion docs/data/styles/advanced/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ export default function App() {
This example returns a string of HTML and inlines the critical CSS required, right before it's used:

```jsx
import ReactDOMServer from 'react-dom/server';
import * as ReactDOMServer from 'react-dom/server';
import { ServerStyleSheets } from '@mui/styles';

function render() {
Expand Down
2 changes: 1 addition & 1 deletion docs/data/styles/api/api-pt.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export default function MyComponent(props) {
Esta é uma classe auxiliar para manipular a renderização do lado do servidor. [You can follow this guide for a practical approach](/material-ui/guides/server-rendering/).

```jsx
import ReactDOMServer from 'react-dom/server';
import * as ReactDOMServer from 'react-dom/server';
import { ServerStyleSheets } from '@material-ui/styles';

const sheets = new ServerStyleSheets();
Expand Down
2 changes: 1 addition & 1 deletion docs/data/styles/api/api-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export default function MyComponent(props) {
这是一个处理服务器端渲染的类助手(class helper)。 [你可以遵循本指南的实用方法](/material-ui/guides/server-rendering/)

```jsx
import ReactDOMServer from 'react-dom/server';
import * as ReactDOMServer from 'react-dom/server';
import { ServerStyleSheets } from '@mui/styles';

const sheets = new ServerStyleSheets();
Expand Down
2 changes: 1 addition & 1 deletion docs/data/styles/api/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export default function MyComponent(props) {
This is a class helper to handle server-side rendering. [You can follow this guide for a practical approach](/material-ui/guides/server-rendering/).

```jsx
import ReactDOMServer from 'react-dom/server';
import * as ReactDOMServer from 'react-dom/server';
import { ServerStyleSheets } from '@mui/styles';

const sheets = new ServerStyleSheets();
Expand Down
2 changes: 1 addition & 1 deletion docs/src/modules/components/AppSearch.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { createPortal } from 'react-dom';
import { pathnameToLanguage } from 'docs/src/modules/utils/helpers';
import ReactDOMServer from 'react-dom/server';
import * as ReactDOMServer from 'react-dom/server';
import PropTypes from 'prop-types';
import NextLink from 'next/link';
import { useRouter } from 'next/router';
Expand Down
2 changes: 1 addition & 1 deletion docs/src/modules/components/DemoSandbox.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import ReactDOM from 'react-dom';
import * as ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import { useRouter } from 'next/router';
import { create } from 'jss';
Expand Down
4 changes: 2 additions & 2 deletions docs/src/modules/sandbox/CodeSandbox.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('CodeSandbox', () => {
},
'index.js': {
content:
"import * as React from 'react';\nimport ReactDOM from 'react-dom/client';\nimport { StyledEngineProvider } from '@mui/material/styles';\nimport Demo from './demo';\n\nReactDOM.createRoot(document.querySelector(\"#root\")).render(\n <React.StrictMode>\n <StyledEngineProvider injectFirst>\n <Demo />\n </StyledEngineProvider>\n </React.StrictMode>\n);",
"import * as React from 'react';\nimport * as ReactDOM from 'react-dom/client';\nimport { StyledEngineProvider } from '@mui/material/styles';\nimport Demo from './demo';\n\nReactDOM.createRoot(document.querySelector(\"#root\")).render(\n <React.StrictMode>\n <StyledEngineProvider injectFirst>\n <Demo />\n </StyledEngineProvider>\n </React.StrictMode>\n);",
},
});
});
Expand Down Expand Up @@ -101,7 +101,7 @@ describe('CodeSandbox', () => {
},
'index.tsx': {
content:
"import * as React from 'react';\nimport ReactDOM from 'react-dom/client';\nimport { StyledEngineProvider } from '@mui/material/styles';\nimport Demo from './demo';\n\nReactDOM.createRoot(document.querySelector(\"#root\")).render(\n <React.StrictMode>\n <StyledEngineProvider injectFirst>\n <Demo />\n </StyledEngineProvider>\n </React.StrictMode>\n);",
"import * as React from 'react';\nimport * as ReactDOM from 'react-dom/client';\nimport { StyledEngineProvider } from '@mui/material/styles';\nimport Demo from './demo';\n\nReactDOM.createRoot(document.querySelector(\"#root\")).render(\n <React.StrictMode>\n <StyledEngineProvider injectFirst>\n <Demo />\n </StyledEngineProvider>\n </React.StrictMode>\n);",
},
'tsconfig.json': {
content:
Expand Down
2 changes: 1 addition & 1 deletion docs/src/modules/sandbox/CodeSandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const createJoyTemplate = (demo: {
},
[`index.${ext}`]: {
content: `import * as React from 'react';
import ReactDOM from 'react-dom/client';
import * as ReactDOM from 'react-dom/client';
import { StyledEngineProvider } from '@mui/joy/styles';
import App from './App';
Expand Down
6 changes: 3 additions & 3 deletions docs/src/modules/sandbox/CreateReactApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const getHtml = ({ title, language }: { title: string; language: string }
export const getRootIndex = (product?: 'joy-ui' | 'base') => {
if (product === 'joy-ui') {
return `import * as React from 'react';
import ReactDOM from 'react-dom/client';
import * as ReactDOM from 'react-dom/client';
import { StyledEngineProvider, CssVarsProvider } from '@mui/joy/styles';
import Demo from './demo';
Expand All @@ -39,7 +39,7 @@ ReactDOM.createRoot(document.querySelector("#root")).render(
}
if (product === 'base') {
return `import * as React from 'react';
import ReactDOM from 'react-dom/client';
import * as ReactDOM from 'react-dom/client';
import Demo from './demo';
ReactDOM.createRoot(document.querySelector("#root")).render(
Expand All @@ -49,7 +49,7 @@ ReactDOM.createRoot(document.querySelector("#root")).render(
);`;
}
return `import * as React from 'react';
import ReactDOM from 'react-dom/client';
import * as ReactDOM from 'react-dom/client';
import { StyledEngineProvider } from '@mui/material/styles';
import Demo from './demo';
Expand Down
4 changes: 2 additions & 2 deletions docs/src/modules/sandbox/StackBlitz.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('StackBlitz', () => {
'demo.js':
'import * as React from \'react\';\nimport Stack from \'@mui/material/Stack\';\nimport Button from \'@mui/material/Button\';\n\nexport default function BasicButtons() {\n return (\n <Stack spacing={2} direction="row">\n <Button variant="text">Text</Button>\n <Button variant="contained">Contained</Button>\n <Button variant="outlined">Outlined</Button>\n </Stack>\n );\n}\n',
'index.js':
"import * as React from 'react';\nimport ReactDOM from 'react-dom/client';\nimport { StyledEngineProvider } from '@mui/material/styles';\nimport Demo from './demo';\n\nReactDOM.createRoot(document.querySelector(\"#root\")).render(\n <React.StrictMode>\n <StyledEngineProvider injectFirst>\n <Demo />\n </StyledEngineProvider>\n </React.StrictMode>\n);",
"import * as React from 'react';\nimport * as ReactDOM from 'react-dom/client';\nimport { StyledEngineProvider } from '@mui/material/styles';\nimport Demo from './demo';\n\nReactDOM.createRoot(document.querySelector(\"#root\")).render(\n <React.StrictMode>\n <StyledEngineProvider injectFirst>\n <Demo />\n </StyledEngineProvider>\n </React.StrictMode>\n);",
},
dependencies: {
react: 'latest',
Expand Down Expand Up @@ -67,7 +67,7 @@ describe('StackBlitz', () => {
'demo.tsx':
'import * as React from \'react\';\nimport Stack from \'@mui/material/Stack\';\nimport Button from \'@mui/material/Button\';\n\nexport default function BasicButtons() {\n return (\n <Stack spacing={2} direction="row">\n <Button variant="text">Text</Button>\n <Button variant="contained">Contained</Button>\n <Button variant="outlined">Outlined</Button>\n </Stack>\n );\n}\n',
'index.tsx':
"import * as React from 'react';\nimport ReactDOM from 'react-dom/client';\nimport { StyledEngineProvider } from '@mui/material/styles';\nimport Demo from './demo';\n\nReactDOM.createRoot(document.querySelector(\"#root\")).render(\n <React.StrictMode>\n <StyledEngineProvider injectFirst>\n <Demo />\n </StyledEngineProvider>\n </React.StrictMode>\n);",
"import * as React from 'react';\nimport * as ReactDOM from 'react-dom/client';\nimport { StyledEngineProvider } from '@mui/material/styles';\nimport Demo from './demo';\n\nReactDOM.createRoot(document.querySelector(\"#root\")).render(\n <React.StrictMode>\n <StyledEngineProvider injectFirst>\n <Demo />\n </StyledEngineProvider>\n </React.StrictMode>\n);",
'tsconfig.json':
'{\n "compilerOptions": {\n "target": "es5",\n "lib": [\n "dom",\n "dom.iterable",\n "esnext"\n ],\n "allowJs": true,\n "skipLibCheck": true,\n "esModuleInterop": true,\n "allowSyntheticDefaultImports": true,\n "strict": true,\n "forceConsistentCasingInFileNames": true,\n "module": "esnext",\n "moduleResolution": "node",\n "resolveJsonModule": true,\n "isolatedModules": true,\n "noEmit": true,\n "jsx": "react"\n },\n "include": [\n "src"\n ]\n}\n',
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import ReactDOM from 'react-dom';
import * as ReactDOM from 'react-dom';
import CssBaseline from '@mui/material/CssBaseline';
import App from './App';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import ReactDOM from 'react-dom';
import * as ReactDOM from 'react-dom';
import CssBaseline from '@mui/material/CssBaseline';
import App from './App';
import * as serviceWorker from './serviceWorker';
Expand Down
2 changes: 1 addition & 1 deletion examples/mui-base-with-tailwind-css/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import ReactDOM from 'react-dom/client';
import * as ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';

Expand Down
2 changes: 1 addition & 1 deletion examples/preact/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import ReactDOM from 'react-dom';
import * as ReactDOM from 'react-dom';
import App from './App';

ReactDOM.render(
Expand Down
2 changes: 1 addition & 1 deletion examples/ssr/client.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import ReactDOM from 'react-dom';
import * as ReactDOM from 'react-dom';
import CssBaseline from '@mui/material/CssBaseline';
import { ThemeProvider } from '@mui/material/styles';
import { CacheProvider } from '@emotion/react';
Expand Down
2 changes: 1 addition & 1 deletion examples/ssr/server.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import express from 'express';
import * as React from 'react';
import ReactDOMServer from 'react-dom/server';
import * as ReactDOMServer from 'react-dom/server';
import CssBaseline from '@mui/material/CssBaseline';
import { ThemeProvider } from '@mui/material/styles';
import { CacheProvider } from '@emotion/react';
Expand Down
2 changes: 1 addition & 1 deletion examples/vitejs-with-typescript/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import ReactDOM from 'react-dom/client';
import * as ReactDOM from 'react-dom/client';
import { ThemeProvider } from '@emotion/react';
import { CssBaseline } from '@mui/material';
import theme from './theme';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { createPortal } from 'react-dom';
import { pathnameToLanguage } from 'docs/src/modules/utils/helpers';
import ReactDOMServer from 'react-dom/server';
import * as ReactDOMServer from 'react-dom/server';
import PropTypes from 'prop-types';
import NextLink from 'next/link';
import { useRouter } from 'next/router';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { createPortal } from 'react-dom';
import { pathnameToLanguage } from 'docs/src/modules/utils/helpers';
import ReactDOMServer from 'react-dom/server';
import * as ReactDOMServer from 'react-dom/server';
import PropTypes from 'prop-types';
import NextLink from 'next/link';
import { useRouter } from 'next/router';
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-lab/src/TabContext/TabContext.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
import * as React from 'react';
import ReactDOMServer from 'react-dom/server';
import * as ReactDOMServer from 'react-dom/server';
import { expect } from 'chai';
import { createRenderer } from 'test/utils';
import TabContext, { getPanelId, getTabId, useTabContext } from './TabContext';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import ReactDOMServer from 'react-dom/server';
import * as ReactDOMServer from 'react-dom/server';
import { expect } from 'chai';
import { create, SheetsRegistry } from 'jss';
import { createMount, strictModeDoubleLoggingSupressed } from 'test/utils';
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import ReactDOM from 'react-dom';
import * as ReactDOM from 'react-dom';
import { createRoot } from 'react-dom/client';
import { BrowserRouter as Router, Routes, Route, Link } from 'react-router-dom';
import * as DomTestingLibrary from '@testing-library/dom';
Expand Down
2 changes: 1 addition & 1 deletion test/regressions/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import * as ReactDOM from 'react-dom';
import { BrowserRouter as Router, Routes, Route, Link } from 'react-router-dom';
import webfontloader from 'webfontloader';
import TestViewer from './TestViewer';
Expand Down

0 comments on commit 12edb1f

Please sign in to comment.