Update dependency flow-bin to ^0.183.0 (#11753)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Bob Silverberg <bob.silverberg@gmail.com>
This commit is contained in:
renovate[bot] 2022-07-25 11:42:56 -04:00 коммит произвёл GitHub
Родитель 67733c2207
Коммит 0be53062e9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
35 изменённых файлов: 117 добавлений и 152 удалений

Просмотреть файл

@ -23,6 +23,5 @@ module.system=node
# See: https://github.com/facebook/flow/blob/master/Changelog.md#01111
module.system.node.allow_root_relative=true
module.system.node.root_relative_dirname=./src
log.file=./flow/logs/flow.log
# suppress_comment= \\(.\\|\n\\)*\\$FlowFixMe
# suppress_comment= \\(.\\|\n\\)*\\$FlowIgnore

Просмотреть файл

@ -284,7 +284,7 @@
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-testing-library": "^5.0.5",
"file-loader": "^6.0.0",
"flow-bin": "^0.176.0",
"flow-bin": "^0.183.0",
"glob": "^8.0.0",
"html-webpack-plugin": "5.5.0",
"http-proxy": "^1.16.2",

Просмотреть файл

@ -124,7 +124,7 @@ export type SetReviewReplyAction = {|
export const setReviewReply = ({
originalReviewId,
reply,
}: SetReviewReplyParams = {}): SetReviewReplyAction => {
}: SetReviewReplyParams): SetReviewReplyAction => {
if (!originalReviewId) {
throw new Error('The originalReviewId parameter is required');
}
@ -448,7 +448,7 @@ export const sendReplyToReview = ({
originalReviewId,
body,
title,
}: SendReplyToReviewParams = {}): SendReplyToReviewAction => {
}: SendReplyToReviewParams): SendReplyToReviewAction => {
if (!errorHandlerId) {
throw new Error('The errorHandlerId parameter is required');
}
@ -472,7 +472,7 @@ type ReviewIdActionParams = {|
export const reviewIdAction = ({
reviewId,
type,
}: ReviewIdActionParams = {}): any => {
}: ReviewIdActionParams): any => {
if (!reviewId) {
throw new Error('The reviewId parameter is required');
}
@ -490,7 +490,7 @@ export type ShowEditReviewFormAction = {|
export const showEditReviewForm = ({
reviewId,
}: ShowEditReviewFormParams = {}): ShowEditReviewFormAction => {
}: ShowEditReviewFormParams): ShowEditReviewFormAction => {
return reviewIdAction({ type: SHOW_EDIT_REVIEW_FORM, reviewId });
};
@ -505,7 +505,7 @@ export type ShowReplyToReviewFormAction = {|
export const showReplyToReviewForm = ({
reviewId,
}: ShowReplyToReviewParams = {}): ShowReplyToReviewFormAction => {
}: ShowReplyToReviewParams): ShowReplyToReviewFormAction => {
return reviewIdAction({ type: SHOW_REPLY_TO_REVIEW_FORM, reviewId });
};
@ -520,7 +520,7 @@ export type HideEditReviewFormAction = {|
export const hideEditReviewForm = ({
reviewId,
}: HideEditReviewFormParams = {}): HideEditReviewFormAction => {
}: HideEditReviewFormParams): HideEditReviewFormAction => {
return reviewIdAction({ type: HIDE_EDIT_REVIEW_FORM, reviewId });
};
@ -535,7 +535,7 @@ export type HideReplyToReviewFormAction = {|
export const hideReplyToReviewForm = ({
reviewId,
}: HideReplyToReviewFormParams = {}): HideReplyToReviewFormAction => {
}: HideReplyToReviewFormParams): HideReplyToReviewFormAction => {
return reviewIdAction({ type: HIDE_REPLY_TO_REVIEW_FORM, reviewId });
};
@ -556,7 +556,7 @@ export const flagReview = ({
note,
reason,
reviewId,
}: FlagReviewParams = {}): FlagReviewAction => {
}: FlagReviewParams): FlagReviewAction => {
if (!errorHandlerId) {
throw new Error('The errorHandlerId parameter is required');
}
@ -585,7 +585,7 @@ export type ReviewWasFlaggedAction = {|
export const setReviewWasFlagged = ({
reason,
reviewId,
}: ReviewWasFlaggedParams = {}): ReviewWasFlaggedAction => {
}: ReviewWasFlaggedParams): ReviewWasFlaggedAction => {
if (!reason) {
throw new Error('The reason parameter is required');
}

Просмотреть файл

@ -42,9 +42,9 @@ type PrivilegedNavigatorType = {|
mozAddonManager: MozAddonManagerType,
|};
type OptionalParams = {|
type OptionalParams = {
_mozAddonManager?: MozAddonManagerType,
|};
};
type GetAddonStatusParams = {|
addon: FirefoxAddon,
@ -123,12 +123,12 @@ export function reportAbuse(
return Promise.reject(new Error('Cannot report abuse via Firefox'));
}
type OptionalInstallParams = {|
type OptionalInstallParams = {
...OptionalParams,
_log?: typeof log,
hash?: string | null,
onIgnoredRejection?: () => void,
|};
};
export function install(
_url: string,
@ -191,7 +191,7 @@ export function addChangeListeners(
canUninstall: boolean,
|}) => Promise<void>,
mozAddonManager: MozAddonManagerType,
{ _log = log }: {| _log: typeof log |} = {},
{ _log = log }: { _log: typeof log } = {},
): HandleChangeEventFunction {
function handleChangeEvent(e: AddonChangeEvent) {
const { id: guid, type, needsRestart } = e;

Просмотреть файл

@ -18,7 +18,7 @@ export type ExternalAddonInfoType = {|
export const getAddonInfo = ({
api,
slug,
}: GetAddonInfoParams = {}): Promise<ExternalAddonInfoType> => {
}: GetAddonInfoParams): Promise<ExternalAddonInfoType> => {
invariant(slug, 'slug is required');
return callApi({

Просмотреть файл

@ -330,7 +330,7 @@ type GetNextResponseType = (
nextURL?: string,
) => Promise<PaginatedApiResponse<any>>;
type AllPagesOptions = {| pageLimit: number |};
type AllPagesOptions = { pageLimit: number };
export const allPages = async (
getNextResponse: GetNextResponseType,

Просмотреть файл

@ -116,7 +116,7 @@ export const replyToReview = ({
body,
errorHandler,
originalReviewId,
}: ReplyToReviewParams = {}): Promise<ExternalReviewReplyType> => {
}: ReplyToReviewParams): Promise<ExternalReviewReplyType> => {
return new Promise((resolve) => {
const endpoint = `ratings/rating/${originalReviewId}/reply/`;
@ -159,11 +159,10 @@ export function getReviews({
user,
addon,
...params
}: GetReviewsParams = {}): Promise<GetReviewsApiResponse> {
}: GetReviewsParams): Promise<GetReviewsApiResponse> {
return new Promise((resolve) => {
if (!user && !addon) {
throw new Error('Either user or addon must be specified');
}
invariant(user || addon, 'Either user or addon must be specified');
resolve(
callApi({
auth: true,
@ -188,7 +187,7 @@ export async function getLatestUserReview({
apiState,
user,
addon,
}: GetLatestUserReviewParams = {}): Promise<GetLatestUserReviewResponse> {
}: GetLatestUserReviewParams): Promise<GetLatestUserReviewResponse> {
invariant(user, 'The user parameter is required');
invariant(addon, 'The addon parameter is required');
@ -222,7 +221,7 @@ export const flagReview = ({
note,
reason,
reviewId,
}: FlagReviewParams = {}): Promise<void> => {
}: FlagReviewParams): Promise<void> => {
return new Promise((resolve) => {
if (!reviewId) {
throw new Error('The reviewId parameter is required');
@ -261,7 +260,7 @@ export const deleteReview = ({
apiState,
errorHandler,
reviewId,
}: DeleteReviewParams = {}): Promise<void> => {
}: DeleteReviewParams): Promise<void> => {
invariant(reviewId, 'reviewId is required');
return new Promise((resolve) => {
resolve(
@ -284,7 +283,7 @@ export type GetReviewParams = {|
export const getReview = ({
apiState,
reviewId,
}: GetReviewParams = {}): Promise<ExternalReviewType> => {
}: GetReviewParams): Promise<ExternalReviewType> => {
invariant(reviewId, 'reviewId is required');
return new Promise((resolve) => {
resolve(

Просмотреть файл

@ -53,9 +53,9 @@ type InternalProps = {|
export const getDownloadCampaign = ({
addonId,
}: {|
}: {
addonId?: number,
|} = {}): string => {
} = {}): string => {
let campaign = DOWNLOAD_FIREFOX_UTM_CAMPAIGN;
if (addonId) {

Просмотреть файл

@ -113,9 +113,9 @@ export class RatingManagerBase extends React.Component<InternalProps> {
{ addonType }: {| addonType: string |},
{
validAddonTypes = defaultValidAddonTypes,
}: {|
}: {
validAddonTypes: typeof defaultValidAddonTypes,
|} = {},
} = {},
): string {
const { i18n } = this.props;
switch (addonType) {

Просмотреть файл

@ -37,9 +37,9 @@ import ReviewGuide from 'amo/pages/StaticPages/ReviewGuide';
import TagPage from 'amo/pages/TagPage';
import type { ConfigType } from 'amo/types/config';
type Props = {|
type Props = {
_config?: ConfigType,
|};
};
// If you add a new route here, check the nginx rules maintained by ops.
const Routes = ({ _config = config }: Props = {}): React.Node => (

Просмотреть файл

@ -106,7 +106,7 @@ export class SearchBase extends React.Component<InternalProps> {
}: {|
newFilters: SearchFiltersType | null,
oldFilters: SearchFiltersType | null,
|} = {}) {
|}) {
const { context, dispatch, errorHandler } = this.props;
const fixedNewFilters = newFilters || {};
const { addonType } = fixedNewFilters;

Просмотреть файл

@ -77,9 +77,9 @@ export function normalizeLocale(locale: string): void | string {
return langToLocale(localeToLang(locale));
}
type IsSupportedLangOptions = {|
type IsSupportedLangOptions = {
_supportedLangs?: typeof supportedLangs,
|};
};
export function isSupportedLang(
lang?: string,
@ -88,9 +88,9 @@ export function isSupportedLang(
return _supportedLangs.includes(lang);
}
type IsValidLangOptions = {|
type IsValidLangOptions = {
_langs: typeof langs,
|};
};
export function isValidLang(
lang?: string,
@ -162,9 +162,9 @@ export function parseAcceptLanguage(
return langList;
}
type GetLangFromHeaderOptions = {|
type GetLangFromHeaderOptions = {
_supportedLangs?: Object,
|};
};
/*
* Given an accept-language header and a list of currently
@ -198,10 +198,10 @@ export function getLangFromHeader(
return normalizeLang(userLang);
}
type GetLanguageParams = {|
lang: string,
acceptLanguage: string,
|};
type GetLanguageParams = {
lang?: string,
acceptLanguage?: string,
};
/*
* Check validity of language:
@ -312,9 +312,9 @@ type I18nConfig = {|
_momentDefineLocale?: Function,
|};
type makeI18nOptions = {|
type makeI18nOptions = {
_Intl?: typeof Intl,
|};
};
// Create an i18n object with a translated moment object available we can
// use for translated dates across the app.

Просмотреть файл

@ -6,9 +6,9 @@ import { normalizeFileNameId } from 'amo/utils';
export function configureLocalForage({
localForage = defaultLocalForage,
}: {|
}: {
localForage: typeof defaultLocalForage,
|} = {}) {
} = {}) {
localForage.config({
name: 'addons-frontend',
version: '1.0',
@ -16,9 +16,9 @@ export function configureLocalForage({
});
}
type LocalStateOptions = {|
type LocalStateOptions = {
localForage: typeof defaultLocalForage,
|};
};
export class LocalState {
id: string;

Просмотреть файл

@ -15,7 +15,7 @@ const requestId = (
req: typeof $Request,
res: typeof $Response,
next: typeof NextFunction,
{ _httpContext = httpContext }: {| _httpContext: typeof httpContext |} = {},
{ _httpContext = httpContext }: { _httpContext: typeof httpContext } = {},
): typeof Middleware => {
const amoRequestId = req.headers[AMO_REQUEST_ID_HEADER] || uuidv4();
// Make sure a request header is always set.

Просмотреть файл

@ -105,10 +105,7 @@ export type LoadAddonAction = {|
type: typeof LOAD_ADDON,
|};
export function loadAddon({
addon,
slug,
}: LoadAddonParams = {}): LoadAddonAction {
export function loadAddon({ addon, slug }: LoadAddonParams): LoadAddonAction {
invariant(addon, 'addon is required');
invariant(slug, 'slug is required');
@ -154,7 +151,7 @@ type LoadAddonInfoAction = {|
export const loadAddonInfo = ({
info,
slug,
}: LoadAddonInfoParams = {}): LoadAddonInfoAction => {
}: LoadAddonInfoParams): LoadAddonInfoAction => {
invariant(info, 'info is required');
invariant(slug, 'slug is required');

Просмотреть файл

@ -147,7 +147,7 @@ export const fetchCurrentCollection = ({
filters,
slug,
userId,
}: FetchCurrentCollectionParams = {}): FetchCurrentCollectionAction => {
}: FetchCurrentCollectionParams): FetchCurrentCollectionAction => {
invariant(errorHandlerId, 'errorHandlerId is required');
invariant(slug, 'slug is required');
invariant(userId, 'userId is required');
@ -171,7 +171,7 @@ export type FetchUserCollectionsAction = {|
export const fetchUserCollections = ({
errorHandlerId,
userId,
}: FetchUserCollectionsParams = {}): FetchUserCollectionsAction => {
}: FetchUserCollectionsParams): FetchUserCollectionsAction => {
invariant(errorHandlerId, 'errorHandlerId is required');
invariant(userId, 'userId is required');
@ -192,7 +192,7 @@ type AbortFetchUserCollectionsAction = {|
export const abortFetchUserCollections = ({
userId,
}: AbortFetchUserCollectionsParams = {}): AbortFetchUserCollectionsAction => {
}: AbortFetchUserCollectionsParams): AbortFetchUserCollectionsAction => {
invariant(userId, 'userId is required');
return {
@ -214,7 +214,7 @@ type AbortAddAddonToCollectionAction = {|
export const abortAddAddonToCollection = ({
addonId,
userId,
}: AbortAddAddonToCollectionParams = {}): AbortAddAddonToCollectionAction => {
}: AbortAddAddonToCollectionParams): AbortAddAddonToCollectionAction => {
invariant(userId, 'userId is required');
invariant(addonId, 'addonId is required');
@ -234,7 +234,7 @@ export const fetchCurrentCollectionPage = ({
filters,
slug,
userId,
}: FetchCurrentCollectionParams = {}): FetchCurrentCollectionPageAction => {
}: FetchCurrentCollectionParams): FetchCurrentCollectionPageAction => {
invariant(errorHandlerId, 'errorHandlerId is required');
invariant(slug, 'slug is required');
invariant(userId, 'userId is required');
@ -292,7 +292,7 @@ type LoadCurrentCollectionAction = {|
export const loadCurrentCollection = ({
addonsResponse,
detail,
}: LoadCurrentCollectionParams = {}): LoadCurrentCollectionAction => {
}: LoadCurrentCollectionParams): LoadCurrentCollectionAction => {
invariant(detail, 'detail is required');
return {
@ -312,7 +312,7 @@ type LoadCurrentCollectionPageAction = {|
export const loadCurrentCollectionPage = ({
addonsResponse,
}: LoadCurrentCollectionPageParams = {}): LoadCurrentCollectionPageAction => {
}: LoadCurrentCollectionPageParams): LoadCurrentCollectionPageAction => {
invariant(addonsResponse, 'The addonsResponse parameter is required');
return {
@ -334,7 +334,7 @@ type LoadCollectionAddonsAction = {|
export const loadCollectionAddons = ({
addons,
slug,
}: LoadCollectionAddonsParams = {}): LoadCollectionAddonsAction => {
}: LoadCollectionAddonsParams): LoadCollectionAddonsAction => {
if (!addons) {
throw new Error('The addons parameter is required');
}
@ -361,7 +361,7 @@ type LoadUserCollectionsAction = {|
export const loadUserCollections = ({
collections,
userId,
}: LoadUserCollectionsParams = {}): LoadUserCollectionsAction => {
}: LoadUserCollectionsParams): LoadUserCollectionsAction => {
invariant(userId, 'userId is required');
invariant(collections, 'collections are required');
@ -386,7 +386,7 @@ export const addonAddedToCollection = ({
addonId,
collectionId,
userId,
}: AddonAddedToCollectionParams = {}): AddonAddedToCollectionAction => {
}: AddonAddedToCollectionParams): AddonAddedToCollectionAction => {
invariant(addonId, 'addonId is required');
invariant(userId, 'userId is required');
invariant(collectionId, 'collectionId is required');
@ -430,7 +430,7 @@ export const addAddonToCollection = ({
notes,
slug,
userId,
}: AddAddonToCollectionParams = {}): AddAddonToCollectionAction => {
}: AddAddonToCollectionParams): AddAddonToCollectionAction => {
invariant(addonId, 'The addonId parameter is required');
invariant(collectionId, 'The collectionId parameter is required');
invariant(slug, 'The slug parameter is required');
@ -501,7 +501,7 @@ export const createCollection = ({
name,
slug,
userId,
}: CreateCollectionParams = {}): CreateCollectionAction => {
}: CreateCollectionParams): CreateCollectionAction => {
invariant(errorHandlerId, 'errorHandlerId is required');
invariant(userId, 'userId is required');
invariant(name, 'name is required when creating a collection');
@ -530,7 +530,7 @@ export const updateCollection = ({
name,
slug,
userId,
}: UpdateCollectionParams = {}): UpdateCollectionAction => {
}: UpdateCollectionParams): UpdateCollectionAction => {
invariant(collectionSlug, 'collectionSlug is required when updating');
invariant(errorHandlerId, 'errorHandlerId is required');
invariant(filters, 'filters is required');
@ -614,7 +614,7 @@ export const removeAddonFromCollection = ({
filters,
slug,
userId,
}: RemoveAddonFromCollectionParams = {}): RemoveAddonFromCollectionAction => {
}: RemoveAddonFromCollectionParams): RemoveAddonFromCollectionAction => {
invariant(addonId, 'The addonId parameter is required');
invariant(errorHandlerId, 'The errorHandlerId parameter is required');
invariant(filters, 'The filters parameter is required');
@ -659,7 +659,7 @@ export const deleteCollection = ({
errorHandlerId,
slug,
userId,
}: DeleteCollectionParams = {}): DeleteCollectionAction => {
}: DeleteCollectionParams): DeleteCollectionAction => {
invariant(errorHandlerId, 'The errorHandlerId parameter is required');
invariant(slug, 'The slug parameter is required');
invariant(userId, 'The userId parameter is required');
@ -695,7 +695,7 @@ export const updateCollectionAddon = ({
filters,
slug,
userId,
}: UpdateCollectionAddonParams = {}): UpdateCollectionAddonAction => {
}: UpdateCollectionAddonParams): UpdateCollectionAddonAction => {
invariant(addonId, 'The addonId parameter is required');
invariant(errorHandlerId, 'The errorHandlerId parameter is required');
invariant(
@ -740,7 +740,7 @@ export const deleteCollectionAddonNotes = ({
lang,
slug,
userId,
}: DeleteCollectionAddonNotesParams = {}): DeleteCollectionAddonNotesAction => {
}: DeleteCollectionAddonNotesParams): DeleteCollectionAddonNotesAction => {
invariant(addonId, 'The addonId parameter is required');
invariant(errorHandlerId, 'The errorHandlerId parameter is required');
invariant(filters, 'The filters parameter is required');
@ -909,7 +909,7 @@ export const changeAddonCollectionsLoadingFlag = ({
loading,
state,
userId,
}: ChangeAddonCollectionsLoadingFlagParams = {}): CollectionsState => {
}: ChangeAddonCollectionsLoadingFlagParams): CollectionsState => {
const userState = state.addonInCollections[userId];
const addonState = userState && userState[addonId];
@ -936,7 +936,7 @@ type UnloadUserCollectionsParams = {|
const unloadUserCollections = ({
state,
userId,
}: UnloadUserCollectionsParams = {}): CollectionsState => {
}: UnloadUserCollectionsParams): CollectionsState => {
return {
...state,
userCollections: {

Просмотреть файл

@ -1,5 +1,6 @@
/* @flow */
import { LOCATION_CHANGE } from 'connected-react-router';
import invariant from 'invariant';
const LOAD_ERROR_PAGE: 'LOAD_ERROR_PAGE' = 'LOAD_ERROR_PAGE';
@ -35,10 +36,8 @@ type LoadErrorPageAction = {|
export const loadErrorPage = ({
error,
}: LoadErrorPageParams = {}): LoadErrorPageAction => {
if (!error) {
throw new Error('error is required');
}
}: LoadErrorPageParams): LoadErrorPageAction => {
invariant(error, 'error is required');
return {
type: LOAD_ERROR_PAGE,

Просмотреть файл

@ -1,4 +1,6 @@
/* @flow */
import invariant from 'invariant';
import { SET_LANG } from 'amo/reducers/api';
import { selectLocalizedContent } from 'amo/reducers/utils';
import type { AppState } from 'amo/store';
@ -34,10 +36,8 @@ export type FetchLanguageToolsAction = {|
export const fetchLanguageTools = ({
errorHandlerId,
}: FetchLanguageToolsParams = {}): FetchLanguageToolsAction => {
if (!errorHandlerId) {
throw new Error('errorHandlerId is required');
}
}: FetchLanguageToolsParams): FetchLanguageToolsAction => {
invariant(errorHandlerId, 'errorHandlerId is required');
return {
type: FETCH_LANGUAGE_TOOLS,
@ -56,10 +56,8 @@ type LoadLanguageToolsAction = {|
export const loadLanguageTools = ({
languageTools,
}: LoadLanguageToolsParams = {}): LoadLanguageToolsAction => {
if (!languageTools) {
throw new Error('languageTools are required');
}
}: LoadLanguageToolsParams): LoadLanguageToolsAction => {
invariant(languageTools, 'languageTools are required');
return {
type: LOAD_LANGUAGE_TOOLS,

Просмотреть файл

@ -273,7 +273,7 @@ export const changeViewState = ({
state,
reviewId,
stateChange,
}: ChangeViewStateParams = {}): ReviewsState => {
}: ChangeViewStateParams): ReviewsState => {
const change = { ...stateChange };
const existingFlag = state.view[reviewId] ? state.view[reviewId].flag : {};
@ -434,7 +434,7 @@ export default function reviewsReducer(
action: ReviewActionType,
{
_addReviewToState = addReviewToState,
}: {| _addReviewToState: typeof addReviewToState |} = {},
}: { _addReviewToState: typeof addReviewToState } = {},
): ReviewsState {
switch (action.type) {
case BEGIN_DELETE_ADDON_REVIEW:

Просмотреть файл

@ -26,7 +26,7 @@ type AbortUserAbuseReportAction = {|
export function abortUserAbuseReport({
userId,
}: AbortUserAbuseReportParams = {}): AbortUserAbuseReportAction {
}: AbortUserAbuseReportParams): AbortUserAbuseReportAction {
invariant(userId, 'userId is required');
return {
@ -46,7 +46,7 @@ type HideUserAbuseReportUIAction = {|
export function hideUserAbuseReportUI({
userId,
}: HideUserAbuseReportUIParams = {}): HideUserAbuseReportUIAction {
}: HideUserAbuseReportUIParams): HideUserAbuseReportUIAction {
invariant(userId, 'userId is required');
return {
@ -74,7 +74,7 @@ export function loadUserAbuseReport({
message,
reporter,
userId,
}: LoadUserAbuseReportParams = {}): LoadUserAbuseReportAction {
}: LoadUserAbuseReportParams): LoadUserAbuseReportAction {
invariant(message, 'message is required');
invariant(reporter !== undefined, 'reporter cannot be undefined');
invariant(userId, 'userId is required');
@ -102,7 +102,7 @@ export function sendUserAbuseReport({
errorHandlerId,
message,
userId,
}: SendUserAbuseReportParams = {}): SendUserAbuseReportAction {
}: SendUserAbuseReportParams): SendUserAbuseReportAction {
invariant(errorHandlerId, 'errorHandlerId is required');
invariant(message, 'message is required');
invariant(userId, 'userId is required');
@ -124,7 +124,7 @@ type ShowUserAbuseReportUIActions = {|
export function showUserAbuseReportUI({
userId,
}: ShowUserAbuseReportUIParams = {}): ShowUserAbuseReportUIActions {
}: ShowUserAbuseReportUIParams): ShowUserAbuseReportUIActions {
invariant(userId, 'userId is required');
return {

Просмотреть файл

@ -218,7 +218,7 @@ type LoadVersionsAction = {|
export const loadVersions = ({
slug,
versions,
}: LoadVersionsParams = {}): LoadVersionsAction => {
}: LoadVersionsParams): LoadVersionsAction => {
invariant(slug, 'slug is required');
invariant(versions, 'versions is required');

Просмотреть файл

@ -75,9 +75,9 @@ import type { Saga } from 'amo/types/sagas';
// Number of millesconds that a message should be flashed on screen.
export const FLASH_SAVED_MESSAGE_DURATION = 2000;
type Options = {|
type Options = {
_delay?: typeof delay,
|};
};
function* fetchReviews({
payload: { errorHandlerId, addonSlug, page, score },
@ -246,6 +246,7 @@ function* manageAddonReview(
}
try {
// $FlowIgnore: Flow can't tell what redux-saga's `select` returns.
const state: AppState = yield select(getState);
const baseParams = {
apiState: state.api,
@ -278,6 +279,7 @@ function* manageAddonReview(
);
const submitParams: SubmitReviewParams = params;
// $FlowIgnore: Flow can't tell what redux-saga's `call` returns.
const reviewFromResponse: SubmitReviewResponse = yield call(
submitReview,
submitParams,

Просмотреть файл

@ -3,7 +3,7 @@ import { ErrorHandler } from 'amo/errorHandler';
import defaultLog from 'amo/logger';
import type { AppState } from 'amo/store';
type CreateErrorHandlerType = {| log: typeof defaultLog |};
type CreateErrorHandlerType = { log: typeof defaultLog };
export function createErrorHandler(
id: string,

Просмотреть файл

@ -91,7 +91,7 @@ export function middleware({
_window = typeof window !== 'undefined' ? window : null,
sagaMiddleware = null,
routerMiddleware = null,
}: {|
}: {
_applyMiddleware?: typeof applyMiddleware,
_config?: typeof config,
_createLogger?: typeof createLogger,
@ -99,7 +99,7 @@ export function middleware({
_window?: typeof window | null,
sagaMiddleware?: Object | null,
routerMiddleware?: Object | null,
|} = {}): React.ComponentType<any> {
} = {}): React.ComponentType<any> {
const isDev = _config.get('isDevelopment');
const callbacks = [];

Просмотреть файл

@ -47,11 +47,11 @@ export type SendTrackingEventParams = {|
...MakeTrackingEventDataParams,
|};
type IsDoNoTrackEnabledParams = {|
type IsDoNoTrackEnabledParams = {
_log: typeof log,
_navigator: ?typeof navigator,
_window: ?typeof window,
|};
};
export function isDoNotTrackEnabled({
_log = log,
@ -78,13 +78,13 @@ export function isDoNotTrackEnabled({
return false;
}
type TrackingParams = {|
type TrackingParams = {
_config: typeof config,
_isDoNotTrackEnabled: typeof isDoNotTrackEnabled,
_getCLS: typeof getCLS,
_getFID: typeof getFID,
_getLCP: typeof getLCP,
|};
};
const makeTrackingEventData = ({
action,
@ -253,7 +253,7 @@ export class Tracking {
label,
sendSecondEventWithOverrides,
value,
}: SendTrackingEventParams = {}) {
}: SendTrackingEventParams) {
if (!category) {
throw new Error('sendEvent: category is required');
}

Просмотреть файл

@ -9,7 +9,7 @@ export type CreateReducerType = <AnyState>(
) => (AnyState, action: Object) => AnyState;
/* eslint-enable no-undef */
export type CreateStoreParams = {|
export type CreateStoreParams = {
history: ReactRouterHistoryType,
initialState: Object,
|};
};

Просмотреть файл

@ -46,7 +46,7 @@ export function getCompatibleVersions({
addon,
clientApp,
currentVersion,
}: GetCompatibleVersionsParams = {}): CompatibleVersionsType {
}: GetCompatibleVersionsParams): CompatibleVersionsType {
let maxVersion = null;
let minVersion = null;
// Assume the add-on is incompatible until we see explicit support.
@ -149,7 +149,7 @@ export function isCompatibleWithUserAgent({
maxVersion,
minVersion,
userAgentInfo,
}: IsCompatibleWithUserAgentParams = {}): UserAgentCompatibilityType {
}: IsCompatibleWithUserAgentParams): UserAgentCompatibilityType {
// If the userAgent is false there was likely a programming error.
invariant(userAgentInfo, 'userAgentInfo is required');
@ -245,7 +245,7 @@ export function getClientCompatibility({
currentVersion,
userAgentInfo,
_window = typeof window !== 'undefined' ? window : {},
}: GetClientCompatibilityParams = {}): ClientCompatibilityType {
}: GetClientCompatibilityParams): ClientCompatibilityType {
// Check compatibility with client app.
const { supportsClientApp, maxVersion, minVersion } = getCompatibleVersions({
addon,

Просмотреть файл

@ -28,7 +28,7 @@ import type { ConfigType } from 'amo/types/config';
*/
export function render404IfConfigKeyIsFalse(
configKey: string,
{ _config = config }: {| _config: ConfigType |} = {},
{ _config = config }: { _config: ConfigType } = {},
): (Component: React.ComponentType<any>) => (props: mixed) => React.Node {
if (!configKey) {
throw new TypeError('configKey cannot be empty');

Просмотреть файл

@ -188,7 +188,7 @@ export function getClientApp(userAgentString: string): string {
export function isValidClientApp(
value: string,
{ _config = config }: {| _config: typeof config |} = {},
{ _config = config }: { _config: typeof config } = {},
): boolean {
return _config.get('validClientApplications').includes(value);
}

Просмотреть файл

@ -15,16 +15,16 @@ type ExpressHandler = (
res: typeof $Response,
) => void | Promise<void>;
type ViewFrontendVersionHandlerParams = {|
type ViewFrontendVersionHandlerParams = {
_config?: typeof config,
_log?: typeof log,
versionFilename?: string,
|};
};
type ViewHeartbeatHandlerParams = {|
type ViewHeartbeatHandlerParams = {
_config?: typeof config,
_fetch?: typeof fetch,
|};
};
export const viewFrontendVersionHandler = ({
_config = config,

Просмотреть файл

@ -191,14 +191,6 @@ describe(__filename, () => {
});
mockApi.verify();
});
it('requires a user or addon', async () => {
mockApi.expects('callApi').returns(Promise.resolve(getReviewsResponse()));
await getReviews().then(unexpectedSuccess, (error) => {
expect(error.message).toMatch(/user or addon must be specified/);
});
});
});
describe('getLatestUserReview', () => {

Просмотреть файл

@ -37,12 +37,6 @@ describe(__filename, () => {
});
describe('loadErrorPage', () => {
it('requires an error', () => {
expect(() => {
loadErrorPage();
}).toThrow('error is required');
});
it('sets an error on load fail; is cleared after the next request', () => {
store.dispatch({ type: 'unrelated', payload: {} });
let state = getErrorPageState(store);

Просмотреть файл

@ -1,7 +1,6 @@
import { setLang } from 'amo/reducers/api';
import reducer, {
createInternalLanguageTool,
fetchLanguageTools,
getAllLanguageTools,
initialState,
loadLanguageTools,
@ -54,22 +53,6 @@ describe(__filename, () => {
);
});
describe('fetchLanguageTools', () => {
it('requires an errorHandlerId', () => {
expect(() => {
fetchLanguageTools();
}).toThrow('errorHandlerId is required');
});
});
describe('loadLanguageTools', () => {
it('requires language tools', () => {
expect(() => {
loadLanguageTools();
}).toThrow('languageTools are required');
});
});
describe('getAllLanguageTools', () => {
it('returns an empty array when no languages are stored', () => {
const { state } = dispatchClientMetadata();

Просмотреть файл

@ -221,7 +221,9 @@ describe(__filename, () => {
it('should throw if category not set', () => {
const tracking = createTracking();
expect(() => {
tracking.sendEvent();
tracking.sendEvent({
action: 'whatever',
});
}).toThrowError(/category is required/);
});

Просмотреть файл

@ -5281,10 +5281,10 @@ flatted@^3.1.0:
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.1.1.tgz#c4b489e80096d9df1dfc97c79871aea7c617c469"
integrity sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==
flow-bin@^0.176.0:
version "0.176.0"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.176.0.tgz#581419d683474dafa0c837c10d030665695ad1f8"
integrity sha512-wJvHjsv5nUXnL7aumLdpwDxnCtNG4ysSnGgUHoqKPwHbbLx9Of/7NGK54g3Wi82WsPk9wnSmSDFv0neItHAYug==
flow-bin@^0.183.0:
version "0.183.0"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.183.0.tgz#17f37c94edd04b705a897b5890dd6cdc02e0c94e"
integrity sha512-7IJHUnMPYgNEZU8t9M4vJII/G+fJft9C/INm2+HRSXx5KDF2j+vD2iap6+Yg2FWgXTnNLUvk7kr1QdO5Fk/8/Q==
focus-visible@5.2.0:
version "5.2.0"