Skip to content
This repository was archived by the owner on Oct 29, 2020. It is now read-only.

Commit 94f8f34

Browse files
build: upgrade react-scripts to v4
This also updates to React 17, eslint 7, TypeScript v4, etc. - React 17 has no new features, but does have a few breaking changes that shouldn't affect bsd. (https://reactjs.org/blog/2020/10/20/react-v17.html) - eslint 7 and the updated config caused a minor issue (https://stackoverflow.com/a/64024916/549363) - react-scripts v4 seems to have a bug while validating TS config, which this commit works around (facebook/create-react-app#9429)
1 parent 33e1df9 commit 94f8f34

File tree

6 files changed

+3520
-3108
lines changed

6 files changed

+3520
-3108
lines changed

Diff for: .eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.eslintrc.js
12
src/react-app-env.d.ts
23
coverage
34
types

Diff for: .eslintrc.js

+3
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ module.exports = {
6666
'@typescript-eslint/no-unused-vars': ['error', {
6767
'vars': 'all'
6868
}],
69+
// note you must disable the base rule as it can report incorrect errors
70+
"no-use-before-define": "off",
71+
"@typescript-eslint/no-use-before-define": ["error"],
6972
'no-restricted-syntax': 'off',
7073
'react/destructuring-assignment': 'off',
7174
'react/jsx-boolean-value': [2, 'never'],

Diff for: package.json

+16-16
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,16 @@
6060
"js-sha256": "^0.9.0",
6161
"normalize.css": "^8.0.1",
6262
"pluralize": "^7.0.0",
63-
"react": "^16.13.1",
64-
"react-dom": "^16.13.1",
65-
"react-dropzone": "^11.0.1",
63+
"react": "^17.0.1",
64+
"react-dom": "^17.0.1",
65+
"react-dropzone": "^11.2.1",
6666
"react-modal": "^3.11.2",
6767
"react-router-dom": "^5.2.0",
68-
"react-scripts": "3.4.1",
68+
"react-scripts": "4.0.0",
6969
"rxjs": "^6.6.0",
7070
"styled-components": "^4.2.0",
7171
"ts-jest": "^26.1.3",
72-
"typescript": "3.9.2",
72+
"typescript": "4.0.3",
7373
"use-interval": "^1.2.1",
7474
"yauzl": "^2.10.0"
7575
},
@@ -80,18 +80,18 @@
8080
"@types/pify": "^3.0.2",
8181
"@types/react-router-dom": "^5.1.5",
8282
"@types/yauzl": "^2.9.1",
83-
"@typescript-eslint/eslint-plugin": "^2.33.0",
84-
"@typescript-eslint/parser": "^2.33.0",
83+
"@typescript-eslint/eslint-plugin": "^4.5.0",
84+
"@typescript-eslint/parser": "^4.5.0",
8585
"@votingworks/ballot-encoder": "^4.0.0",
86-
"eslint": "^6.6.0",
87-
"eslint-config-airbnb": "^18.1.0",
88-
"eslint-config-prettier": "^6.11.0",
89-
"eslint-plugin-import": "^2.20.2",
90-
"eslint-plugin-jest": "^23.13.1",
91-
"eslint-plugin-jsx-a11y": "^6.2.3",
92-
"eslint-plugin-prettier": "^3.1.3",
93-
"eslint-plugin-react": "^7.20.0",
94-
"eslint-plugin-react-hooks": "^4.0.2",
86+
"eslint": "^7.11.0",
87+
"eslint-config-airbnb": "^18.2.0",
88+
"eslint-config-prettier": "^6.14.0",
89+
"eslint-plugin-import": "^2.22.1",
90+
"eslint-plugin-jest": "^24.1.0",
91+
"eslint-plugin-jsx-a11y": "^6.3.1",
92+
"eslint-plugin-prettier": "^3.1.4",
93+
"eslint-plugin-react": "^7.21.5",
94+
"eslint-plugin-react-hooks": "^4.2.0",
9595
"fetch-mock": "^9.9.0",
9696
"history": "^4.10.1",
9797
"husky": "^4.2.5",

Diff for: src/App.test.tsx

+7-6
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ beforeEach(() => {
2424
})
2525

2626
const oldWindowLocation = window.location
27-
delete window.location
28-
window.location = {
29-
...oldWindowLocation,
30-
href: '/',
31-
}
27+
Object.defineProperty(window, 'location', {
28+
value: {
29+
...oldWindowLocation,
30+
href: '/',
31+
},
32+
configurable: true,
33+
})
3234
})
3335

3436
test('renders without crashing', async () => {
@@ -88,7 +90,6 @@ test('clicking Scan Batch will scan a batch', async () => {
8890
})
8991

9092
const mockAlert = jest.fn()
91-
delete window.alert
9293
window.alert = mockAlert
9394

9495
await act(async () => {

Diff for: tsconfig.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@
55
"esModuleInterop": true,
66
"forceConsistentCasingInFileNames": true,
77
"isolatedModules": true,
8-
"jsx": "preserve",
8+
"jsx": "react",
99
"lib": ["dom", "dom.iterable", "esnext"],
1010
"module": "esnext",
1111
"moduleResolution": "node",
1212
"noEmit": true,
1313
"resolveJsonModule": true,
1414
"skipLibCheck": true,
1515
"strict": true,
16-
"target": "es2017"
16+
"target": "es2017",
17+
"noFallthroughCasesInSwitch": true
1718
},
1819
"exclude": ["src/setupProxy.js", ".eslintrc.js"],
1920
"include": ["src", "prodserver", "test", "types"]

0 commit comments

Comments
 (0)