refactor: introduce type-only imports (#5462)

This commit is contained in:
Vladislav Shkodin
2021-05-31 14:23:16 +02:00
committed by GitHub
parent e4a29d5991
commit fc07ce6854
81 changed files with 398 additions and 362 deletions

View File

@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
declare module 'netlify-cms-core' {
import React, { ComponentType } from 'react';
import { List, Map } from 'immutable';
import type { ComponentType } from 'react';
import type { List, Map } from 'immutable';
export type CmsBackendType =
| 'azure'

View File

@ -1,11 +1,12 @@
import { Map } from 'immutable';
import configureMockStore from 'redux-mock-store';
import thunk, { ThunkDispatch } from 'redux-thunk';
import { AnyAction } from 'redux';
import type { ThunkDispatch } from 'redux-thunk';
import thunk from 'redux-thunk';
import type { AnyAction } from 'redux';
import { mocked } from 'ts-jest/utils';
import { getAsset, ADD_ASSET, LOAD_ASSET_REQUEST } from '../media';
import { selectMediaFilePath } from '../../reducers/entries';
import { State } from '../../types/redux';
import type { State } from '../../types/redux';
import AssetProxy from '../../valueObjects/AssetProxy';
const middlewares = [thunk];
@ -25,7 +26,7 @@ describe('media', () => {
});
describe('getAsset', () => {
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
global.URL = { createObjectURL: jest.fn() };
@ -40,7 +41,7 @@ describe('media', () => {
// TODO change to proper payload when immutable is removed
// from 'collections' and 'entries' state slices
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const result = store.dispatch(getAsset(payload));
const actions = store.getActions();
@ -54,7 +55,7 @@ describe('media', () => {
const store = mockStore({
// TODO change to proper store data when immutable is removed
// from 'config' state slice
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
config: Map(),
medias: {
@ -67,7 +68,7 @@ describe('media', () => {
// TODO change to proper payload when immutable is removed
// from 'collections' and 'entries' state slices
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const result = store.dispatch(getAsset(payload));
const actions = store.getActions();
@ -97,7 +98,7 @@ describe('media', () => {
// TODO change to proper payload when immutable is removed
// from 'collections' state slice
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const result = store.dispatch(getAsset(payload));
const actions = store.getActions();
@ -120,7 +121,7 @@ describe('media', () => {
// TODO change to proper payload when immutable is removed
// from 'collections' and 'entries' state slices
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const result = store.dispatch(getAsset(payload));
const actions = store.getActions();
@ -150,7 +151,7 @@ describe('media', () => {
// TODO change to proper payload when immutable is removed
// from 'collections' and 'entries' state slices
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const result = store.dispatch(getAsset(payload));
const actions = store.getActions();

View File

@ -1,9 +1,9 @@
import { actions as notifActions } from 'redux-notifications';
import { Credentials, User } from 'netlify-cms-lib-util';
import { ThunkDispatch } from 'redux-thunk';
import { AnyAction } from 'redux';
import type { Credentials, User } from 'netlify-cms-lib-util';
import type { ThunkDispatch } from 'redux-thunk';
import type { AnyAction } from 'redux';
import { currentBackend } from '../backend';
import { State } from '../types/redux';
import type { State } from '../types/redux';
const { notifSend, notifClear } = notifActions;

View File

@ -3,8 +3,8 @@ import { fromJS } from 'immutable';
import deepmerge from 'deepmerge';
import { produce } from 'immer';
import { trimStart, trim, isEmpty } from 'lodash';
import { AnyAction } from 'redux';
import { ThunkDispatch } from 'redux-thunk';
import type { AnyAction } from 'redux';
import type { ThunkDispatch } from 'redux-thunk';
import { SIMPLE as SIMPLE_PUBLISH_MODE } from '../constants/publishModes';
import { validateConfig } from '../constants/configSchema';
import { selectDefaultSortableFields } from '../reducers/collections';
@ -12,7 +12,7 @@ import { getIntegrations, selectIntegration } from '../reducers/integrations';
import { resolveBackend } from '../backend';
import { I18N, I18N_FIELD, I18N_STRUCTURE } from '../lib/i18n';
import { FILES, FOLDER } from '../constants/collectionTypes';
import {
import type {
CmsCollection,
CmsConfig,
CmsField,

View File

@ -1,9 +1,9 @@
import { actions as notifActions } from 'redux-notifications';
import { ThunkDispatch } from 'redux-thunk';
import { AnyAction } from 'redux';
import type { ThunkDispatch } from 'redux-thunk';
import type { AnyAction } from 'redux';
import { currentBackend } from '../backend';
import { selectDeployPreview } from '../reducers';
import { Collection, Entry, State } from '../types/redux';
import type { Collection, Entry, State } from '../types/redux';
const { notifSend } = notifActions;

View File

@ -1,6 +1,6 @@
import { get } from 'lodash';
import { actions as notifActions } from 'redux-notifications';
import { ThunkDispatch } from 'redux-thunk';
import type { ThunkDispatch } from 'redux-thunk';
import { Map, List } from 'immutable';
import { currentBackend, slugFromCustomPath } from '../backend';
import {
@ -10,7 +10,8 @@ import {
selectUnpublishedEntry,
} from '../reducers';
import { selectEditingDraft } from '../reducers/entries';
import { EDITORIAL_WORKFLOW, status, Status } from '../constants/publishModes';
import type { Status } from '../constants/publishModes';
import { EDITORIAL_WORKFLOW, status } from '../constants/publishModes';
import { EDITORIAL_WORKFLOW_ERROR } from 'netlify-cms-lib-util';
import {
loadEntry,
@ -24,9 +25,16 @@ import { createAssetProxy } from '../valueObjects/AssetProxy';
import { addAssets } from './media';
import { loadMedia } from './mediaLibrary';
import ValidationErrorTypes from '../constants/validationErrorTypes';
import { Collection, EntryMap, State, Collections, EntryDraft, MediaFile } from '../types/redux';
import { AnyAction } from 'redux';
import { EntryValue } from '../valueObjects/Entry';
import type {
Collection,
EntryMap,
State,
Collections,
EntryDraft,
MediaFile,
} from '../types/redux';
import type { AnyAction } from 'redux';
import type { EntryValue } from '../valueObjects/Entry';
import { navigateToEntry } from '../routing/history';
const { notifSend } = notifActions;

View File

@ -1,31 +1,36 @@
import { fromJS, List, Map, Set } from 'immutable';
import type { Set } from 'immutable';
import { fromJS, List, Map } from 'immutable';
import { isEqual } from 'lodash';
import { actions as notifActions } from 'redux-notifications';
import { serializeValues } from '../lib/serializeEntryValues';
import { currentBackend, Backend } from '../backend';
import type { Backend } from '../backend';
import { currentBackend } from '../backend';
import { getIntegrationProvider } from '../integrations';
import { selectIntegration, selectPublishedSlugs } from '../reducers';
import { selectFields, updateFieldByKey } from '../reducers/collections';
import { selectCollectionEntriesCursor } from '../reducers/cursors';
import { Cursor, ImplementationMediaFile } from 'netlify-cms-lib-util';
import { createEntry, EntryValue } from '../valueObjects/Entry';
import AssetProxy, { createAssetProxy } from '../valueObjects/AssetProxy';
import type { ImplementationMediaFile } from 'netlify-cms-lib-util';
import { Cursor } from 'netlify-cms-lib-util';
import type { EntryValue } from '../valueObjects/Entry';
import { createEntry } from '../valueObjects/Entry';
import type AssetProxy from '../valueObjects/AssetProxy';
import { createAssetProxy } from '../valueObjects/AssetProxy';
import ValidationErrorTypes from '../constants/validationErrorTypes';
import { addAssets, getAsset } from './media';
import {
import type {
Collection,
EntryMap,
State,
EntryFields,
EntryField,
SortDirection,
ViewFilter,
ViewGroup,
Entry,
} from '../types/redux';
import { SortDirection } from '../types/redux';
import { ThunkDispatch } from 'redux-thunk';
import { AnyAction } from 'redux';
import type { ThunkDispatch } from 'redux-thunk';
import type { AnyAction } from 'redux';
import { waitForMediaLibraryToLoad, loadMedia } from './mediaLibrary';
import { waitUntil } from './waitUntil';
import { selectIsFetching, selectEntriesSortFields, selectEntryByPath } from '../reducers/entries';

View File

@ -1,7 +1,8 @@
import AssetProxy, { createAssetProxy } from '../valueObjects/AssetProxy';
import { Collection, State, EntryMap, EntryField } from '../types/redux';
import { ThunkDispatch } from 'redux-thunk';
import { AnyAction } from 'redux';
import type AssetProxy from '../valueObjects/AssetProxy';
import { createAssetProxy } from '../valueObjects/AssetProxy';
import type { Collection, State, EntryMap, EntryField } from '../types/redux';
import type { ThunkDispatch } from 'redux-thunk';
import type { AnyAction } from 'redux';
import { isAbsolutePath } from 'netlify-cms-lib-util';
import { selectMediaFilePath } from '../reducers/entries';
import { selectMediaFileByPath } from '../reducers/mediaLibrary';

View File

@ -1,8 +1,10 @@
import { Map } from 'immutable';
import { actions as notifActions } from 'redux-notifications';
import { basename, getBlobSHA, ImplementationMediaFile } from 'netlify-cms-lib-util';
import type { ImplementationMediaFile } from 'netlify-cms-lib-util';
import { basename, getBlobSHA } from 'netlify-cms-lib-util';
import { currentBackend } from '../backend';
import AssetProxy, { createAssetProxy } from '../valueObjects/AssetProxy';
import type AssetProxy from '../valueObjects/AssetProxy';
import { createAssetProxy } from '../valueObjects/AssetProxy';
import { selectIntegration } from '../reducers';
import {
selectMediaFilePath,
@ -14,15 +16,15 @@ import { getIntegrationProvider } from '../integrations';
import { addAsset, removeAsset } from './media';
import { addDraftEntryMediaFile, removeDraftEntryMediaFile } from './entries';
import { sanitizeSlug } from '../lib/urlHelper';
import {
import type {
State,
MediaFile,
DisplayURLState,
MediaLibraryInstance,
EntryField,
} from '../types/redux';
import { AnyAction } from 'redux';
import { ThunkDispatch } from 'redux-thunk';
import type { AnyAction } from 'redux';
import type { ThunkDispatch } from 'redux-thunk';
import { waitUntilWithTimeout } from './waitUntil';
const { notifSend } = notifActions;

View File

@ -1,11 +1,11 @@
import { ThunkDispatch } from 'redux-thunk';
import { AnyAction } from 'redux';
import type { ThunkDispatch } from 'redux-thunk';
import type { AnyAction } from 'redux';
import { isEqual } from 'lodash';
import { State } from '../types/redux';
import type { State } from '../types/redux';
import { currentBackend } from '../backend';
import { getIntegrationProvider } from '../integrations';
import { selectIntegration } from '../reducers';
import { EntryValue } from '../valueObjects/Entry';
import type { EntryValue } from '../valueObjects/Entry';
/*
* Constant Declarations

View File

@ -1,7 +1,7 @@
import { ThunkDispatch } from 'redux-thunk';
import { AnyAction } from 'redux';
import type { ThunkDispatch } from 'redux-thunk';
import type { AnyAction } from 'redux';
import { actions as notifActions } from 'redux-notifications';
import { State } from '../types/redux';
import type { State } from '../types/redux';
import { currentBackend } from '../backend';
const { notifSend, notifDismiss } = notifActions;

View File

@ -1,7 +1,8 @@
import { WAIT_UNTIL_ACTION, WaitActionArgs } from '../redux/middleware/waitUntilAction';
import { ThunkDispatch } from 'redux-thunk';
import { AnyAction } from 'redux';
import { State } from '../types/redux';
import type { WaitActionArgs } from '../redux/middleware/waitUntilAction';
import { WAIT_UNTIL_ACTION } from '../redux/middleware/waitUntilAction';
import type { ThunkDispatch } from 'redux-thunk';
import type { AnyAction } from 'redux';
import type { State } from '../types/redux';
export function waitUntil({ predicate, run }: WaitActionArgs) {
return {

View File

@ -1,24 +1,27 @@
import { attempt, flatten, isError, uniq, trim, sortBy, get, set } from 'lodash';
import { List, Map, fromJS, Set } from 'immutable';
import type { Map } from 'immutable';
import { List, fromJS, Set } from 'immutable';
import * as fuzzy from 'fuzzy';
import {
localForage,
Cursor,
CURSOR_COMPATIBILITY_SYMBOL,
EditorialWorkflowError,
import type {
Implementation as BackendImplementation,
DisplayURL,
ImplementationEntry,
Credentials,
User,
getPathDepth,
blobToFileObj,
asyncLock,
AsyncLock,
UnpublishedEntry,
DataFile,
UnpublishedEntryDiff,
} from 'netlify-cms-lib-util';
import {
localForage,
Cursor,
CURSOR_COMPATIBILITY_SYMBOL,
EditorialWorkflowError,
getPathDepth,
blobToFileObj,
asyncLock,
} from 'netlify-cms-lib-util';
import { basename, join, extname, dirname } from 'path';
import { stringTemplate } from 'netlify-cms-lib-widgets';
import { resolveFormat } from './formats/formats';
@ -37,12 +40,13 @@ import {
selectFieldsComments,
selectHasMetaPath,
} from './reducers/collections';
import { createEntry, EntryValue } from './valueObjects/Entry';
import type { EntryValue } from './valueObjects/Entry';
import { createEntry } from './valueObjects/Entry';
import { sanitizeChar } from './lib/urlHelper';
import { getBackend, invokeEvent } from './lib/registry';
import { commitMessageFormatter, slugFormatter, previewUrlFormatter } from './lib/formatters';
import { status } from './constants/publishModes';
import {
import type {
CmsConfig,
EntryMap,
FilterRule,
@ -53,7 +57,7 @@ import {
State,
EntryField,
} from './types/redux';
import AssetProxy from './valueObjects/AssetProxy';
import type AssetProxy from './valueObjects/AssetProxy';
import { FOLDER, FILES } from './constants/collectionTypes';
import { selectCustomPath } from './reducers/entryDraft';
import {
@ -523,7 +527,7 @@ export class Backend {
from. This is done to prevent traverseCursor from requiring a
`collection` argument.
*/
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const cursor = Cursor.create(loadedEntries[CURSOR_COMPATIBILITY_SYMBOL]).wrapData({
cursorType: 'collectionEntries',
@ -611,7 +615,7 @@ export class Backend {
const entries = await Promise.all(collectionEntriesRequests).then(arrays => flatten(arrays));
if (errors.length > 0) {
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
throw new Error({ message: 'Errors ocurred while searching entries locally!', errors });
}

View File

@ -3,15 +3,10 @@ import { get } from 'lodash';
import yamlFormatter from './yaml';
import tomlFormatter from './toml';
import jsonFormatter from './json';
import {
FrontmatterInfer,
frontmatterJSON,
frontmatterTOML,
frontmatterYAML,
Delimiter,
} from './frontmatter';
import { Collection, EntryObject, Format } from '../types/redux';
import { EntryValue } from '../valueObjects/Entry';
import type { Delimiter } from './frontmatter';
import { FrontmatterInfer, frontmatterJSON, frontmatterTOML, frontmatterYAML } from './frontmatter';
import type { Collection, EntryObject, Format } from '../types/redux';
import type { EntryValue } from '../valueObjects/Entry';
export const frontmatterFormats = ['yaml-frontmatter', 'toml-frontmatter', 'json-frontmatter'];

View File

@ -123,7 +123,7 @@ export class FrontmatterFormatter {
const trimLastLineBreak = body.slice(-1) !== '\n';
const file = matter.stringify(body, meta, {
engines: parsers,
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore `sortedKeys` is not recognized by gray-matter, so it gets passed through to the parser
sortedKeys,
comments,

View File

@ -6,7 +6,7 @@ import { sortKeys } from './helpers';
function outputReplacer(_key: string, value: unknown) {
if (moment.isMoment(value)) {
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
return value.format(value._f);
}

View File

@ -1,6 +1,6 @@
import yaml from 'yaml';
import { sortKeys } from './helpers';
import { YAMLMap, YAMLSeq, Pair, Node } from 'yaml/types';
import type { YAMLMap, YAMLSeq, Pair, Node } from 'yaml/types';
function addComments(items: Array<Pair>, comments: Record<string, string>, prefix = '') {
items.forEach(item => {

View File

@ -1,4 +1,4 @@
import { Map } from 'immutable';
import type { Map } from 'immutable';
import { flow, partialRight, trimEnd, trimStart } from 'lodash';
import { sanitizeSlug } from './urlHelper';
import { stringTemplate } from 'netlify-cms-lib-widgets';
@ -8,7 +8,7 @@ import {
selectInferedField,
getFileFromSlug,
} from '../reducers/collections';
import { Collection, CmsConfig, CmsSlug, EntryMap } from '../types/redux';
import type { Collection, CmsConfig, CmsSlug, EntryMap } from '../types/redux';
import { stripIndent } from 'common-tags';
import { FILES } from '../constants/collectionTypes';
import { COMMIT_AUTHOR, COMMIT_DATE } from '../constants/commitProps';

View File

@ -1,8 +1,8 @@
import { Map, List } from 'immutable';
import { set, trimEnd, groupBy, escapeRegExp } from 'lodash';
import { Collection, Entry, EntryDraft, EntryField, EntryMap } from '../types/redux';
import type { Collection, Entry, EntryDraft, EntryField, EntryMap } from '../types/redux';
import { selectEntrySlug } from '../reducers/collections';
import { EntryValue } from '../valueObjects/Entry';
import type { EntryValue } from '../valueObjects/Entry';
export const I18N = 'i18n';

View File

@ -3,7 +3,7 @@ import urlJoin from 'url-join';
import diacritics from 'diacritics';
import sanitizeFilename from 'sanitize-filename';
import { isString, escapeRegExp, flow, partialRight } from 'lodash';
import { CmsSlug } from '../types/redux';
import type { CmsSlug } from '../types/redux';
function getUrl(urlString: string, direct?: boolean) {
return `${direct ? '/#' : ''}${urlString}`;

View File

@ -7,7 +7,7 @@ import { getMediaLibrary } from './lib/registry';
import { store } from './redux';
import { configFailed } from './actions/config';
import { createMediaLibrary, insertMedia } from './actions/mediaLibrary';
import { MediaLibraryInstance } from './types/redux';
import type { MediaLibraryInstance } from './types/redux';
type MediaLibraryOptions = {};
@ -19,7 +19,7 @@ interface MediaLibrary {
}
function handleInsert(url: string) {
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
return store.dispatch(insertMedia(url, undefined));
}

View File

@ -3,7 +3,7 @@ import auth, { defaultState } from '../auth';
describe('auth', () => {
it('should handle an empty state', () => {
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore auth reducer doesn't accept empty action
expect(auth(undefined, {})).toEqual(defaultState);
});

View File

@ -3,7 +3,7 @@ import config, { selectLocale } from '../config';
describe('config', () => {
it('should handle an empty state', () => {
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore config reducer doesn't accept empty action
expect(config(undefined, {})).toEqual({ isFetching: true });
});

View File

@ -1,5 +1,6 @@
import integrations from '../integrations';
import { CONFIG_SUCCESS, ConfigAction } from '../../actions/config';
import type { ConfigAction } from '../../actions/config';
import { CONFIG_SUCCESS } from '../../actions/config';
import { FOLDER } from '../../constants/collectionTypes';
describe('integrations', () => {

View File

@ -1,12 +1,12 @@
import { produce } from 'immer';
import { User } from 'netlify-cms-lib-util';
import type { User } from 'netlify-cms-lib-util';
import type { AuthAction } from '../actions/auth';
import {
AUTH_REQUEST,
AUTH_SUCCESS,
AUTH_FAILURE,
AUTH_REQUEST_DONE,
LOGOUT,
AuthAction,
} from '../actions/auth';
export type Auth = {

View File

@ -1,12 +1,13 @@
import { List, Set, fromJS, OrderedMap } from 'immutable';
import { get, escapeRegExp } from 'lodash';
import consoleError from '../lib/consoleError';
import { CONFIG_SUCCESS, ConfigAction } from '../actions/config';
import type { ConfigAction } from '../actions/config';
import { CONFIG_SUCCESS } from '../actions/config';
import { FILES, FOLDER } from '../constants/collectionTypes';
import { COMMIT_DATE, COMMIT_AUTHOR } from '../constants/commitProps';
import { INFERABLE_FIELDS, IDENTIFIER_FIELDS, SORTABLE_FIELDS } from '../constants/fieldInference';
import { formatExtensions } from '../formats/formats';
import {
import type {
Collection,
Collections,
CollectionFiles,
@ -19,7 +20,7 @@ import {
import { selectMediaFolder } from './entries';
import { stringTemplate } from 'netlify-cms-lib-widgets';
import { summaryFormatter } from '../lib/formatters';
import { Backend } from '../backend';
import type { Backend } from '../backend';
const { keyToPathArray } = stringTemplate;

View File

@ -1,7 +1,8 @@
import { produce } from 'immer';
import { CONFIG_REQUEST, CONFIG_SUCCESS, CONFIG_FAILURE, ConfigAction } from '../actions/config';
import type { ConfigAction } from '../actions/config';
import { CONFIG_REQUEST, CONFIG_SUCCESS, CONFIG_FAILURE } from '../actions/config';
import { EDITORIAL_WORKFLOW } from '../constants/publishModes';
import { CmsConfig } from '../types/redux';
import type { CmsConfig } from '../types/redux';
const defaultState = {
isFetching: true,

View File

@ -1,9 +1,9 @@
import { produce } from 'immer';
import type { DeploysAction } from '../actions/deploys';
import {
DEPLOY_PREVIEW_REQUEST,
DEPLOY_PREVIEW_SUCCESS,
DEPLOY_PREVIEW_FAILURE,
DeploysAction,
} from '../actions/deploys';
export type Deploys = {

View File

@ -19,7 +19,7 @@ import {
UNPUBLISHED_ENTRY_DELETE_SUCCESS,
} from '../actions/editorialWorkflow';
import { CONFIG_SUCCESS } from '../actions/config';
import { EditorialWorkflowAction, EditorialWorkflow, Entities } from '../types/redux';
import type { EditorialWorkflowAction, EditorialWorkflow, Entities } from '../types/redux';
function unpublishedEntries(state = Map(), action: EditorialWorkflowAction) {
switch (action.type) {

View File

@ -20,7 +20,7 @@ import {
CHANGE_VIEW_STYLE,
} from '../actions/entries';
import { SEARCH_ENTRIES_SUCCESS } from '../actions/search';
import {
import type {
EntriesAction,
EntryRequestPayload,
EntrySuccessPayload,
@ -41,7 +41,6 @@ import {
SortMap,
SortObject,
Sort,
SortDirection,
Filter,
Group,
FilterMap,
@ -53,6 +52,7 @@ import {
EntriesGroupFailurePayload,
GroupOfEntries,
} from '../types/redux';
import { SortDirection } from '../types/redux';
import { folderFormatter } from '../lib/formatters';
import { isAbsolutePath, basename } from 'netlify-cms-lib-util';
import { trim, once, sortBy, set, orderBy, groupBy } from 'lodash';

View File

@ -1,4 +1,4 @@
import { AnyAction } from 'redux';
import type { AnyAction } from 'redux';
import { produce } from 'immer';
import { USE_OPEN_AUTHORING } from '../actions/auth';

View File

@ -13,8 +13,8 @@ import mediaLibrary from './mediaLibrary';
import deploys, * as fromDeploys from './deploys';
import globalUI from './globalUI';
import status from './status';
import { Status } from '../constants/publishModes';
import { State, Collection } from '../types/redux';
import type { Status } from '../constants/publishModes';
import type { State, Collection } from '../types/redux';
const reducers = {
auth,

View File

@ -1,6 +1,7 @@
import { fromJS } from 'immutable';
import { CONFIG_SUCCESS, ConfigAction } from '../actions/config';
import { Integrations, CmsConfig } from '../types/redux';
import type { ConfigAction } from '../actions/config';
import { CONFIG_SUCCESS } from '../actions/config';
import type { Integrations, CmsConfig } from '../types/redux';
interface Acc {
providers: Record<string, {}>;

View File

@ -1,5 +1,6 @@
import { Map, List } from 'immutable';
import uuid from 'uuid/v4';
import type { MediaLibraryAction } from '../actions/mediaLibrary';
import {
MEDIA_LIBRARY_OPEN,
MEDIA_LIBRARY_CLOSE,
@ -18,11 +19,10 @@ import {
MEDIA_DISPLAY_URL_REQUEST,
MEDIA_DISPLAY_URL_SUCCESS,
MEDIA_DISPLAY_URL_FAILURE,
MediaLibraryAction,
} from '../actions/mediaLibrary';
import { selectEditingDraft, selectMediaFolder } from './entries';
import { selectIntegration } from './';
import {
import type {
State,
MediaLibraryInstance,
MediaFile,

View File

@ -1,4 +1,5 @@
import { produce } from 'immer';
import type { MediasAction } from '../actions/media';
import {
ADD_ASSETS,
ADD_ASSET,
@ -6,9 +7,8 @@ import {
LOAD_ASSET_REQUEST,
LOAD_ASSET_SUCCESS,
LOAD_ASSET_FAILURE,
MediasAction,
} from '../actions/media';
import AssetProxy from '../valueObjects/AssetProxy';
import type AssetProxy from '../valueObjects/AssetProxy';
export type Medias = {
[path: string]: { asset: AssetProxy | undefined; isLoading: boolean; error: Error | null };

View File

@ -1,5 +1,6 @@
import { produce } from 'immer';
import type { SearchAction } from '../actions/search';
import {
QUERY_FAILURE,
QUERY_REQUEST,
@ -8,9 +9,8 @@ import {
SEARCH_ENTRIES_FAILURE,
SEARCH_ENTRIES_REQUEST,
SEARCH_ENTRIES_SUCCESS,
SearchAction,
} from '../actions/search';
import { EntryValue } from '../valueObjects/Entry';
import type { EntryValue } from '../valueObjects/Entry';
export type Search = {
isFetching: boolean;

View File

@ -1,5 +1,6 @@
import { produce } from 'immer';
import { STATUS_REQUEST, STATUS_SUCCESS, STATUS_FAILURE, StatusAction } from '../actions/status';
import type { StatusAction } from '../actions/status';
import { STATUS_REQUEST, STATUS_SUCCESS, STATUS_FAILURE } from '../actions/status';
export type Status = {
isFetching: boolean;

View File

@ -1,10 +1,12 @@
import { createStore, applyMiddleware, AnyAction } from 'redux';
import type { AnyAction } from 'redux';
import { createStore, applyMiddleware } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension';
import thunkMiddleware, { ThunkMiddleware } from 'redux-thunk';
import type { ThunkMiddleware } from 'redux-thunk';
import thunkMiddleware from 'redux-thunk';
import { waitUntilAction } from './middleware/waitUntilAction';
import createRootReducer from '../reducers/combinedReducer';
import { State } from '../types/redux';
import { Reducer } from 'react';
import type { State } from '../types/redux';
import type { Reducer } from 'react';
const store = createStore<State | undefined, AnyAction, unknown, unknown>(
createRootReducer() as unknown as Reducer<State | undefined, AnyAction>,

View File

@ -7,8 +7,8 @@
* action coming through the system. Think of it as a thunk that
* blocks until the condition is met.
*/
import { Middleware, MiddlewareAPI, Dispatch, AnyAction } from 'redux';
import { State } from '../../types/redux';
import type { Middleware, MiddlewareAPI, Dispatch, AnyAction } from 'redux';
import type { State } from '../../types/redux';
export const WAIT_UNTIL_ACTION = 'WAIT_UNTIL_ACTION';

View File

@ -1,4 +1,5 @@
import { createHashHistory, History } from 'history';
import type { History } from 'history';
import { createHashHistory } from 'history';
import { mocked } from 'ts-jest/utils';
jest.mock('history');

View File

@ -1,4 +1,4 @@
import { CmsConfig } from './redux';
import type { CmsConfig } from './redux';
declare global {
interface Window {

View File

@ -1,15 +1,15 @@
import { Action } from 'redux';
import { StaticallyTypedRecord } from './immutable';
import { Map, List, OrderedMap, Set } from 'immutable';
import { FILES, FOLDER } from '../constants/collectionTypes';
import { MediaFile as BackendMediaFile } from '../backend';
import { Auth } from '../reducers/auth';
import { Status } from '../reducers/status';
import { Medias } from '../reducers/medias';
import { Deploys } from '../reducers/deploys';
import { Search } from '../reducers/search';
import { GlobalUI } from '../reducers/globalUI';
import { formatExtensions } from '../formats/formats';
import type { Action } from 'redux';
import type { StaticallyTypedRecord } from './immutable';
import type { Map, List, OrderedMap, Set } from 'immutable';
import type { FILES, FOLDER } from '../constants/collectionTypes';
import type { MediaFile as BackendMediaFile } from '../backend';
import type { Auth } from '../reducers/auth';
import type { Status } from '../reducers/status';
import type { Medias } from '../reducers/medias';
import type { Deploys } from '../reducers/deploys';
import type { Search } from '../reducers/search';
import type { GlobalUI } from '../reducers/globalUI';
import type { formatExtensions } from '../formats/formats';
export type CmsBackendType =
| 'azure'

View File

@ -1,4 +1,4 @@
import { EntryField } from '../types/redux';
import type { EntryField } from '../types/redux';
interface AssetProxyArgs {
path: string;

View File

@ -1,5 +1,5 @@
import { isBoolean } from 'lodash';
import { MediaFile } from '../backend';
import type { MediaFile } from '../backend';
interface Options {
partial?: boolean;