Skip to content

Commit 86cba74

Browse files
lukythVilém Jeniš
authored andcommitted
Upgrade eslint + flow, and fix failed test from nullishCoalescingOperator (facebookarchive#2083)
Summary: **Summary** I want to upgrade ESLint and Flow on this project. I ended up with - Remove unused `eslint-plugin-relay` - Upgrade all ESLint packages to the latest version and fix all the new lint errors afterward. - `eslint-config-fbjs` - `eslint-config-prettier` - `eslint-plugin-babel` - `eslint-plugin-flowtype` - `eslint-plugin-jsx-a11y` - `eslint-plugin-prettier` - `eslint-plugin-react` - Upgrade Flow (`flow-bin`) to the `0.115.0`. ~Then I found that `yarn test` is failing at~ ``` src/component/handlers/composition/__tests__/DraftEditorCompostionHandler-test.js: Support for the experimental syntax 'nullishCoalescingOperator' isn't currently enabled (70:40) ``` ~So I added `babel/plugin-proposal-nullish-coalescing-operator` to jest preprocessor as well.~ Move plugins in `.babelrc` to jest preprocessor as facebookarchive#2083 (comment) **Test Plan** `yarn lint`, `yarn flow`, and `yarn test` should all pass. Pull Request resolved: facebookarchive#2083 Reviewed By: claudiopro Differential Revision: D19398251 Pulled By: mrkev fbshipit-source-id: 4fc2f6dd6e0cd44266d061455b7b6a433231715a
1 parent 542522e commit 86cba74

File tree

8 files changed

+171
-87
lines changed

8 files changed

+171
-87
lines changed

.babelrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

meta/bundle-size-stats/Draft.js.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

meta/bundle-size-stats/Draft.min.js.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

package.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,16 @@
5353
"cross-env": "^6.0.3",
5454
"del": "^5.1.0",
5555
"es6-shim": "^0.35.5",
56-
"eslint": "^6.6.0",
56+
"eslint": "^6.8.0",
5757
"eslint-config-fbjs": "^3.1.1",
58-
"eslint-config-prettier": "^6.5.0",
58+
"eslint-config-prettier": "^6.9.0",
5959
"eslint-plugin-babel": "^5.3.0",
60-
"eslint-plugin-flowtype": "^4.3.0",
60+
"eslint-plugin-flowtype": "^4.6.0",
6161
"eslint-plugin-jsx-a11y": "^6.2.3",
62-
"eslint-plugin-prettier": "^3.1.1",
63-
"eslint-plugin-react": "^7.16.0",
64-
"eslint-plugin-relay": "^1.3.12",
62+
"eslint-plugin-prettier": "^3.1.2",
63+
"eslint-plugin-react": "^7.17.0",
6564
"fbjs-scripts": "^1.2.0",
66-
"flow-bin": "^0.110.1",
65+
"flow-bin": "^0.115.0",
6766
"gulp": "^4.0.2",
6867
"gulp-babel": "^8.0.0",
6968
"gulp-clean-css": "^4.2.0",

scripts/jest/preprocessor.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ module.exports = {
1515
process(src, filename) {
1616
var options = {
1717
presets: [fbjsConfigurePreset({rewriteModules: {map: moduleMap}})],
18+
plugins: [
19+
require('@babel/plugin-proposal-nullish-coalescing-operator'),
20+
require('@babel/plugin-proposal-optional-chaining')
21+
],
1822
filename: filename,
1923
retainLines: true,
2024
};

src/.flowconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ unsafe-getters-setters
5050
; nonstrict-import
5151

5252
[version]
53-
^0.110.1
53+
^0.115.0

src/component/handlers/edit/editOnBlur.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ function editOnBlur(editor: DraftEditor, e: SyntheticEvent<HTMLElement>): void {
2929
// opposed to clicking to another tab or window).
3030
const {ownerDocument} = e.currentTarget;
3131
if (
32+
// This ESLint rule conflicts with `sketchy-null-bool` flow check
33+
// eslint-disable-next-line no-extra-boolean-cast
3234
!Boolean(editor.props.preserveSelectionOnBlur) &&
3335
getActiveElement(ownerDocument) === ownerDocument.body
3436
) {

yarn.lock

Lines changed: 156 additions & 74 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)