From 7d3f05dae3a27c36f3d3abe62e8ca022185099eb Mon Sep 17 00:00:00 2001 From: John Knox Date: Wed, 17 Jul 2019 06:27:25 -0700 Subject: [PATCH] Re-enable flow module checking Summary: Setting the module extension to .tsx overrode the defaults, meaning .js files were no longer being checked when imported. This adds the defaults back to the extensions to be checked, including `.js` It does seem to cause errors importing `.tsx` at the moment, but there aren't many so I've just $FlowFixMe'd them for now. https://flow.org/en/docs/config/options/#toc-module-file-ext-string Reviewed By: passy Differential Revision: D16333800 fbshipit-source-id: 7bea92c038048234b4f634704f71c15d79ab3c63 --- .flowconfig | 4 ++++ src/App.js | 1 + src/chrome/__tests__/TitleBar.electron.js | 1 + src/utils/CertificateProvider.js | 1 + src/utils/__tests__/Idler.node.js | 1 + src/utils/reduxDevToolsConfig.js | 1 + 6 files changed, 9 insertions(+) diff --git a/.flowconfig b/.flowconfig index c83ba41c9..dd5aeef88 100644 --- a/.flowconfig +++ b/.flowconfig @@ -22,6 +22,10 @@ emoji=true all=true include_warnings=true module.name_mapper='flipper' -> '/src/index.js' +module.file_ext=.js +module.file_ext=.jsx +module.file_ext=.json +module.file_ext=.mjs module.file_ext=.tsx module.name_mapper.extension='tsx' -> 'any' module.name_mapper.extension='ts' -> 'any' diff --git a/src/App.js b/src/App.js index f810b0471..d78b8ae21 100644 --- a/src/App.js +++ b/src/App.js @@ -9,6 +9,7 @@ import React from 'react'; import {FlexColumn, FlexRow} from 'flipper'; import {connect} from 'react-redux'; import WelcomeScreen from './chrome/WelcomeScreen.js'; +// $FlowFixMe T47375728 import TitleBar from './chrome/TitleBar.tsx'; import MainSidebar from './chrome/MainSidebar.js'; import BugReporterDialog from './chrome/BugReporterDialog.js'; diff --git a/src/chrome/__tests__/TitleBar.electron.js b/src/chrome/__tests__/TitleBar.electron.js index 60817f86d..5bb6441c2 100644 --- a/src/chrome/__tests__/TitleBar.electron.js +++ b/src/chrome/__tests__/TitleBar.electron.js @@ -5,6 +5,7 @@ * @format */ +// $FlowFixMe T47375728 import TitleBar from '../TitleBar.tsx'; import renderer from 'react-test-renderer'; import reducers from '../../reducers/index.js'; diff --git a/src/utils/CertificateProvider.js b/src/utils/CertificateProvider.js index f571a9f76..ccd180d0e 100644 --- a/src/utils/CertificateProvider.js +++ b/src/utils/CertificateProvider.js @@ -21,6 +21,7 @@ import iosUtil from '../fb-stubs/iOSContainerUtility'; import {reportPlatformFailures} from './metrics'; import {getAdbClient} from './adbClient'; import * as androidUtil from './androidContainerUtility'; +// $FlowFixMe T47375728 import dateFormat from 'dateformat'; const writeFile = promisify(fs.writeFile); const exists = promisify(fs.exists); diff --git a/src/utils/__tests__/Idler.node.js b/src/utils/__tests__/Idler.node.js index ef57429a0..2f4b44067 100644 --- a/src/utils/__tests__/Idler.node.js +++ b/src/utils/__tests__/Idler.node.js @@ -17,6 +17,7 @@ test('Idler should interrupt', async () => { } await idler.idle(); } + // $FlowFixMe T47375728 fail('Idler should have thrown an error'); } catch (e) { expect(i).toEqual(100); diff --git a/src/utils/reduxDevToolsConfig.js b/src/utils/reduxDevToolsConfig.js index 1ca88309e..c858eed58 100644 --- a/src/utils/reduxDevToolsConfig.js +++ b/src/utils/reduxDevToolsConfig.js @@ -5,6 +5,7 @@ * @format */ +// $FlowFixMe T47375728 export const stateSanitizer = state => { let sanitizedState = state; if (state.connections) {