Skip to content

Commit 6efa798

Browse files
committed
flow: Apply strict-local everywhere we can: 306/397 files.
This applies all the strictness rules of `@flow strict`, except for `nonstrict-import`. So that lets us avoid adding any new uses of unsafe patterns in these files, even while they import other files that use unsafe patterns. To do this, I first added `strict-local` to every file that has Flow but not `strict` or `strict-local`: sed -i 's/@flow/@flow strict-local/' -- \ $(git grep -l '@flow [^s]' src/) Then of course there were a lot of errors. But the great thing about this feature is that it doesn't interact between files! So I just identified the files with errors, and reverted the changes there: git checkout @ -- \ $(yarn flow --show-all-errors \ |& perl -lane 'print $1 if (/^Error.* (\S+):\d+:\d+$/)' \ | sort -u) This left 306 files gaining this protection, after reverting 91 files.
1 parent e993bb1 commit 6efa798

File tree

306 files changed

+306
-306
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

306 files changed

+306
-306
lines changed

src/ZulipMobile.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import React from 'react';
33

44
import './boot/ReactotronConfig';

src/__flow-tests__/types-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { Action } from '../types';
33

44
// Assert that Action does not allow arbitrary objects.

src/account-info/LogoutButton.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import { connect } from 'react-redux';
33

44
import React, { PureComponent } from 'react';

src/account-info/SwitchAccountButton.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import { connect } from 'react-redux';
33

44
import React, { PureComponent } from 'react';

src/account/AccountItem.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import React, { PureComponent } from 'react';
33
import { StyleSheet, View } from 'react-native';
44

src/account/AccountList.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import React, { PureComponent } from 'react';
33
import { View, FlatList } from 'react-native';
44

src/account/AccountPickScreen.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import { connect } from 'react-redux';
33

44
import React, { PureComponent } from 'react';

src/account/__tests__/accountsReducers-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import deepFreeze from 'deep-freeze';
33

44
import {

src/account/__tests__/accountsSelectors-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import deepFreeze from 'deep-freeze';
33

44
import { getAuth } from '../accountsSelectors';

src/account/__tests__/getActiveAccount-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import deepFreeze from 'deep-freeze';
33

44
import { getActiveAccount } from '../accountsSelectors';

src/account/accountActions.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type {
33
AccountSwitchAction,
44
RealmAddAction,

src/account/accountsReducers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import {
33
REALM_ADD,
44
LOGIN_SUCCESS,

src/account/accountsSelectors.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import { createSelector } from 'reselect';
33

44
import type { Account, Selector } from '../types';

src/actionCreator.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { Action, GlobalState, Dispatch } from './types';
33
import { clearTypingNotification } from './typing/clearTypingNotification';
44
import { EVENT_TYPING_START } from './actionConstants';

src/actions.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
export * from './account/accountActions';
33
export * from './events/eventActions';
44
export * from './nav/navActions';

src/alertWords/alertWordsActions.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { Dispatch, GetState } from '../types';
33
import { getAlertWords } from '../api';
44
import { INIT_ALERT_WORDS } from '../actionConstants';

src/alertWords/alertWordsReducer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type {
33
AlertWordsState,
44
AlertWordsAction,

src/animation/AnimatedComponent.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import React, { PureComponent } from 'react';
33
import type { ChildrenArray } from 'react';
44
import { Animated, Easing } from 'react-native';

src/animation/AnimatedRotateComponent.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import React, { PureComponent } from 'react';
33
import type { ChildrenArray } from 'react';
44
import { Animated, Easing } from 'react-native';

src/animation/AnimatedScaleComponent.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import React, { PureComponent } from 'react';
33
import type { ChildrenArray } from 'react';
44
import { Animated, Easing } from 'react-native';

src/api/alert_words/getAlertWords.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { Auth } from '../apiTypes';
33
import { apiGet } from '../apiFetch';
44

src/api/apiTypes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { PresenceState } from '../types';
33

44
export type Auth = {

src/api/checkCompatibility.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import userAgent from '../utils/userAgent';
33

44
// check with server if current mobile app is compatible with latest backend

src/api/devFetchApiKey.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { Auth } from './apiTypes';
33
import { apiPost } from './apiFetch';
44

src/api/devListUsers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { Auth, ApiResponseSuccess, DevUser } from './apiTypes';
33
import { apiGet } from './apiFetch';
44

src/api/emoji_reactions/emojiReactionAdd.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { ApiResponse, Auth } from '../apiTypes';
33
import { apiPost } from '../apiFetch';
44

src/api/emoji_reactions/emojiReactionRemove.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { Auth, ApiResponse } from '../apiTypes';
33
import { apiDelete } from '../apiFetch';
44

src/api/fetchApiKey.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { Auth, ApiResponseSuccess } from './apiTypes';
33
import { apiPost } from './apiFetch';
44

src/api/focusPing.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { ApiResponseWithPresence, Auth } from './apiTypes';
33
import { apiPost } from './apiFetch';
44

src/api/getTopics.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { Auth, Topic } from './apiTypes';
33
import { apiGet } from './apiFetch';
44

src/api/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
export { default as queueMarkAsRead } from './queueMarkAsRead';
33
export { default as checkCompatibility } from './checkCompatibility';
44
export { default as devFetchApiKey } from './devFetchApiKey';

src/api/mark_as_read/markAllAsRead.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { ApiResponse, Auth } from '../apiTypes';
33
import { apiPost } from '../apiFetch';
44

src/api/mark_as_read/markStreamAsRead.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { ApiResponse, Auth } from '../apiTypes';
33
import { apiPost } from '../apiFetch';
44

src/api/mark_as_read/markTopicAsRead.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { ApiResponse, Auth } from '../apiTypes';
33
import { apiPost } from '../apiFetch';
44

src/api/messages/deleteMessage.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { ApiResponse, Auth } from '../apiTypes';
33
import { apiPatch } from '../apiFetch';
44

src/api/messages/getMessageContentById.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { Auth } from '../apiTypes';
33
import { apiGet } from '../apiFetch';
44

src/api/messages/getMessages.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { Auth, Message, Narrow } from '../apiTypes';
33
import { apiGet } from '../apiFetch';
44

src/api/messages/messagesFlags.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { ApiResponse, Auth } from '../apiTypes';
33
import { apiPost } from '../apiFetch';
44

src/api/messages/sendMessage.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22

33
import type { ApiResponse, Auth } from '../apiTypes';
44
import { apiPost } from '../apiFetch';

src/api/notifications/unregisterPush.android.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { Auth } from '../apiTypes';
33
import { apiDelete } from '../apiFetch';
44

src/api/notifications/unregisterPush.ios.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { Auth } from '../apiTypes';
33
import { apiDelete } from '../apiFetch';
44

src/api/pollForEvents.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { Auth } from './apiTypes';
33
import { apiGet } from './apiFetch';
44

src/api/realm/getRealmEmojis.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { Auth, RealmEmojiState } from '../apiTypes';
33
import { apiGet } from '../apiFetch';
44

src/api/realm/getRealmFilters.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { Auth, RealmFilter } from '../apiTypes';
33
import { apiGet } from '../apiFetch';
44

src/api/registerForEvents.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { Auth } from './apiTypes';
33
import { apiPost } from './apiFetch';
44

src/api/settings/getServerSettings.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { ApiServerSettings } from '../apiTypes';
33
import { apiGet } from '../apiFetch';
44

src/api/settings/toggleMobilePushSettings.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { ApiResponse, Auth } from '../apiTypes';
33
import { apiPatch } from '../apiFetch';
44

src/api/streams/createStream.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { ApiResponse, Auth } from '../apiTypes';
33
import { apiPost } from '../apiFetch';
44

src/api/streams/deleteStream.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { ApiResponse, Auth } from '../apiTypes';
33
import { apiDelete } from '../apiFetch';
44

src/api/streams/getStreams.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { Auth, Stream } from '../apiTypes';
33
import { apiGet } from '../apiFetch';
44

src/api/streams/updateStream.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { ApiResponse, Auth } from '../apiTypes';
33
import { apiPatch } from '../apiFetch';
44

src/api/subscriptions/getSubscriptions.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { Auth, Subscription } from '../apiTypes';
33
import { apiGet } from '../apiFetch';
44

src/api/subscriptions/muteStream.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { ApiResponse, Auth } from '../apiTypes';
33
import { apiPost } from '../apiFetch';
44

src/api/subscriptions/muteTopic.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { ApiResponse, Auth } from '../apiTypes';
33
import { apiPatch } from '../apiFetch';
44

src/api/subscriptions/subscriptionAdd.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { ApiResponse, Auth } from '../apiTypes';
33
import { apiPost } from '../apiFetch';
44

src/api/subscriptions/subscriptionRemove.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { ApiResponse, Auth } from '../apiTypes';
33
import { apiDelete } from '../apiFetch';
44

src/api/subscriptions/toggleMuteStream.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { ApiResponse, Auth } from '../apiTypes';
33
import { apiPost } from '../apiFetch';
44

src/api/subscriptions/togglePinStream.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { ApiResponse, Auth } from '../apiTypes';
33
import { apiPost } from '../apiFetch';
44

src/api/subscriptions/toggleStreamNotifications.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { ApiResponse, Auth } from '../apiTypes';
33
import { apiPost } from '../apiFetch';
44

src/api/subscriptions/unmuteTopic.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { ApiResponse, Auth } from '../apiTypes';
33
import { apiPatch } from '../apiFetch';
44

src/api/typing.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { ApiResponse, Auth, TypingOperation } from './apiTypes';
33
import { apiPost } from './apiFetch';
44

src/api/uploadFile.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { Auth } from './apiTypes';
33
import { apiFile } from './apiFetch';
44
import { getFileExtension, getMimeTypeFromFileExtension } from '../utils/url';

src/api/user_groups/createUserGroup.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { ApiResponse, Auth } from '../apiTypes';
33
import { apiPost } from '../apiFetch';
44

src/api/user_groups/deleteUserGroup.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { ApiResponse, Auth } from '../apiTypes';
33
import { apiDelete } from '../apiFetch';
44

src/api/user_groups/editUserGroup.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { ApiResponse, Auth } from '../apiTypes';
33
import { apiPatch } from '../apiFetch';
44

src/api/user_groups/editUserGroupMembers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @flow */
1+
/* @flow strict-local */
22
import type { ApiResponse, Auth } from '../apiTypes';
33
import { apiPost } from '../apiFetch';
44

0 commit comments

Comments
 (0)