Skip to content

Commit 1ef668f

Browse files
Docs: upgrade to Create React App 4 (#1276)
1 parent 53b82ec commit 1ef668f

17 files changed

+2471
-2996
lines changed

.eslintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
}
3939
],
4040
"import/extensions": ["error", "always", { "ignorePackages": true }],
41+
"import/no-anonymous-default-export": "error",
4142
"import/no-extraneous-dependencies": "off",
4243
"import/no-namespace": "error",
4344
"import/no-relative-parent-imports": "error",

docs/.env

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"react-router-dom": "^5.2.0"
2525
},
2626
"devDependencies": {
27-
"react-scripts": "3.4.0"
27+
"react-scripts": "4.0.0"
2828
},
2929
"browserslist": [
3030
"last 2 versions",

docs/src/AppWrapper.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// @flow strict
2+
import React, { type Node } from 'react';
3+
import { BrowserRouter, Route, Switch, Redirect } from 'react-router-dom';
4+
import App from './components/App.js';
5+
import CardPage from './components/CardPage.js';
6+
import routes from './components/routes.js';
7+
import sidebarIndex from './components/sidebarIndex.js';
8+
9+
import './docs.css';
10+
import 'gestalt/dist/gestalt.css';
11+
import 'gestalt-datepicker/dist/gestalt-datepicker.css';
12+
13+
const mapRoutes = (pages) =>
14+
pages.map((page, i) => (
15+
<Route
16+
path={`/${page}`}
17+
key={i}
18+
render={() => <CardPage cards={routes[page]} page={page} />}
19+
/>
20+
));
21+
22+
function AppWrapper(): Node {
23+
return (
24+
<BrowserRouter>
25+
<App>
26+
<Switch>
27+
<Route exact path="/" render={() => <Redirect to="/What's New" />} />
28+
{sidebarIndex.map((section) => mapRoutes(section.pages))}
29+
</Switch>
30+
</App>
31+
</BrowserRouter>
32+
);
33+
}
34+
35+
export default AppWrapper;

docs/src/components/atomDark.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// @flow strict
2-
export default {
2+
const atomDark = {
33
plain: {
44
color: '#c5c8c6',
55
backgroundColor: '#111',
@@ -91,3 +91,5 @@ export default {
9191
},
9292
],
9393
};
94+
95+
export default atomDark;

docs/src/index.js

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,14 @@
11
// @flow strict
22
import React from 'react';
3-
import { BrowserRouter, Route, Switch, Redirect } from 'react-router-dom';
43
import { render } from 'react-dom';
5-
import 'gestalt/dist/gestalt.css';
6-
import 'gestalt-datepicker/dist/gestalt-datepicker.css';
7-
import App from './components/App.js';
8-
import CardPage from './components/CardPage.js';
9-
import routes from './components/routes.js';
10-
import './docs.css';
11-
import sidebarIndex from './components/sidebarIndex.js';
4+
import AppWrapper from './AppWrapper.js';
125

136
const container = document.getElementById('root');
14-
const mapRoutes = (pages) =>
15-
pages.map((page, i) => (
16-
<Route
17-
path={`/${page}`}
18-
key={i}
19-
render={() => <CardPage cards={routes[page]} page={page} />}
20-
/>
21-
));
227

238
if (container instanceof Element) {
249
render(
2510
<React.StrictMode>
26-
<BrowserRouter>
27-
<App>
28-
<Switch>
29-
<Route
30-
exact
31-
path="/"
32-
render={() => <Redirect to="/What's New" />}
33-
/>
34-
{sidebarIndex.map((section) => mapRoutes(section.pages))}
35-
</Switch>
36-
</App>
37-
</BrowserRouter>
11+
<AppWrapper />
3812
</React.StrictMode>,
3913
container
4014
);

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"@testing-library/react": "^11.0.4",
2727
"@testing-library/react-hooks": "^3.4.2",
2828
"babel-eslint": "10.1.0",
29-
"babel-jest": "^26.5.2",
29+
"babel-jest": "^26.6.0",
3030
"blueimp-md5": "^2.18.0",
3131
"caniuse-lite": "^1.0.30001146",
3232
"chalk": "^4.1.0",
@@ -35,7 +35,7 @@
3535
"cssnano": "^4.1.10",
3636
"cypress": "^5.3.0",
3737
"danger": "10.5.0",
38-
"eslint": "7.10.0",
38+
"eslint": "7.11.0",
3939
"eslint-config-airbnb": "^18.2.0",
4040
"eslint-config-prettier": "^6.13.0",
4141
"eslint-plugin-cypress": "^2.11.2",
@@ -50,7 +50,7 @@
5050
"flow-bin": "^0.135.0",
5151
"husky": "^4.3.0",
5252
"identity-obj-proxy": "^3.0.0",
53-
"jest": "^26.5.2",
53+
"jest": "26.6.0",
5454
"jscodeshift": "^0.11.0",
5555
"lint-staged": "^10.4.0",
5656
"netlify-cli": "^2.65.1",

packages/gestalt-datepicker/rollup.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// eslint-disable-next-line flowtype/require-valid-file-annotation
22
import plugins from '../gestalt-core/build.js'; // eslint-disable-line import/no-relative-parent-imports
33

4-
export default {
4+
const rollupConfig = {
55
input: 'src/index.js',
66
output: [
77
{
@@ -45,3 +45,5 @@ export default {
4545
],
4646
plugins: plugins('gestalt-datepicker'),
4747
};
48+
49+
export default rollupConfig;

packages/gestalt/rollup.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// eslint-disable-next-line flowtype/require-valid-file-annotation
22
import plugins from '../gestalt-core/build.js'; // eslint-disable-line import/no-relative-parent-imports
33

4-
export default {
4+
const rollupConfig = {
55
input: 'src/index.js',
66
output: [
77
{
@@ -42,3 +42,5 @@ export default {
4242
],
4343
plugins: plugins('gestalt'),
4444
};
45+
46+
export default rollupConfig;

packages/gestalt/src/Button.jsdom.test.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ describe('Button', () => {
5555
render(<Button text="test" disabled ref={ref} />);
5656
expect(ref.current instanceof HTMLButtonElement).toEqual(true);
5757
expect(
58-
ref.current instanceof HTMLButtonElement && ref.current?.tabIndex
59-
).toEqual(-1);
58+
ref.current instanceof HTMLButtonElement && ref.current?.disabled
59+
).toEqual(true);
6060
});
6161

6262
it('renders a disabled link button', () => {
@@ -75,9 +75,6 @@ describe('Button', () => {
7575
expect(
7676
ref.current instanceof HTMLAnchorElement && ref.current?.href
7777
).toEqual('');
78-
expect(
79-
ref.current instanceof HTMLAnchorElement && ref.current?.tabIndex
80-
).toEqual(-1);
8178
});
8279

8380
it('renders a button removed from sequential keyboard navigation via tabIndex', () => {

0 commit comments

Comments
 (0)