diff --git a/.eslintrc.js b/.eslintrc.js index 5f9e974a..780ff299 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -31,6 +31,13 @@ module.exports = { 'no-console': [0], 'react/prop-types': [0], 'import/no-named-as-default': 0, + 'import/order': [ + 'error', + { + 'newlines-between': 'always', + groups: [['builtin', 'external'], ['internal', 'parent', 'sibling', 'index'], ['type']], + }, + ], 'no-duplicate-imports': 'error', '@emotion/no-vanilla': 'error', '@emotion/import-from-emotion': 'error', diff --git a/packages/netlify-cms-app/src/extensions.js b/packages/netlify-cms-app/src/extensions.js index e7b484c3..9a71b254 100644 --- a/packages/netlify-cms-app/src/extensions.js +++ b/packages/netlify-cms-app/src/extensions.js @@ -1,6 +1,5 @@ // Core import { NetlifyCmsCore as CMS } from 'netlify-cms-core'; - // Backends import { AzureBackend } from 'netlify-cms-backend-azure'; import { GitHubBackend } from 'netlify-cms-backend-github'; @@ -9,7 +8,6 @@ import { GitGatewayBackend } from 'netlify-cms-backend-git-gateway'; import { BitbucketBackend } from 'netlify-cms-backend-bitbucket'; import { TestBackend } from 'netlify-cms-backend-test'; import { ProxyBackend } from 'netlify-cms-backend-proxy'; - // Widgets import NetlifyCmsWidgetString from 'netlify-cms-widget-string'; import NetlifyCmsWidgetNumber from 'netlify-cms-widget-number'; @@ -27,10 +25,8 @@ import NetlifyCmsWidgetDate from 'netlify-cms-widget-date'; import NetlifyCmsWidgetDatetime from 'netlify-cms-widget-datetime'; import NetlifyCmsWidgetCode from 'netlify-cms-widget-code'; import NetlifyCmsWidgetColorString from 'netlify-cms-widget-colorstring'; - // Editor Components import image from 'netlify-cms-editor-component-image'; - // Locales import * as locales from 'netlify-cms-locales'; diff --git a/packages/netlify-cms-app/webpack.config.js b/packages/netlify-cms-app/webpack.config.js index 9f7dd152..511a53ae 100644 --- a/packages/netlify-cms-app/webpack.config.js +++ b/packages/netlify-cms-app/webpack.config.js @@ -1,4 +1,5 @@ const webpack = require('webpack'); + const pkg = require('./package.json'); const { getConfig, plugins } = require('../../scripts/webpack'); const baseWebpackConfig = getConfig({ baseOnly: true }); diff --git a/packages/netlify-cms-backend-azure/src/API.ts b/packages/netlify-cms-backend-azure/src/API.ts index 10f83f2f..c32d3e7c 100644 --- a/packages/netlify-cms-backend-azure/src/API.ts +++ b/packages/netlify-cms-backend-azure/src/API.ts @@ -1,6 +1,5 @@ import { Base64 } from 'js-base64'; import { partial, result, trim, trimStart } from 'lodash'; -import type { ApiRequest, AssetProxy, PersistOptions, DataFile } from 'netlify-cms-lib-util'; import { localForage, APIError, @@ -20,9 +19,11 @@ import { readFileMetadata, branchFromContentKey, } from 'netlify-cms-lib-util'; -import type { Map } from 'immutable'; import { dirname, basename } from 'path'; +import type { ApiRequest, AssetProxy, PersistOptions, DataFile } from 'netlify-cms-lib-util'; +import type { Map } from 'immutable'; + export const API_NAME = 'Azure DevOps'; const API_VERSION = 'api-version'; diff --git a/packages/netlify-cms-backend-azure/src/implementation.ts b/packages/netlify-cms-backend-azure/src/implementation.ts index 9391437c..b80ad80e 100644 --- a/packages/netlify-cms-backend-azure/src/implementation.ts +++ b/packages/netlify-cms-backend-azure/src/implementation.ts @@ -1,22 +1,5 @@ import { trimStart, trim } from 'lodash'; -import type { Semaphore } from 'semaphore'; import semaphore from 'semaphore'; -import AuthenticationPage from './AuthenticationPage'; -import API, { API_NAME } from './API'; -import type { - Credentials, - Implementation, - ImplementationFile, - ImplementationMediaFile, - DisplayURL, - Entry, - AssetProxy, - PersistOptions, - Config, - AsyncLock, - User, - UnpublishedEntryMediaFile, -} from 'netlify-cms-lib-util'; import { basename, getMediaDisplayURL, @@ -34,6 +17,25 @@ import { getBlobSHA, } from 'netlify-cms-lib-util'; +import AuthenticationPage from './AuthenticationPage'; +import API, { API_NAME } from './API'; + +import type { Semaphore } from 'semaphore'; +import type { + Credentials, + Implementation, + ImplementationFile, + ImplementationMediaFile, + DisplayURL, + Entry, + AssetProxy, + PersistOptions, + Config, + AsyncLock, + User, + UnpublishedEntryMediaFile, +} from 'netlify-cms-lib-util'; + const MAX_CONCURRENT_DOWNLOADS = 10; function parseAzureRepo(config: Config) { diff --git a/packages/netlify-cms-backend-bitbucket/src/API.ts b/packages/netlify-cms-backend-bitbucket/src/API.ts index 70a2d5be..56597836 100644 --- a/packages/netlify-cms-backend-bitbucket/src/API.ts +++ b/packages/netlify-cms-backend-bitbucket/src/API.ts @@ -1,11 +1,4 @@ import { flow, get } from 'lodash'; -import type { - ApiRequest, - AssetProxy, - PersistOptions, - FetchError, - DataFile, -} from 'netlify-cms-lib-util'; import { localForage, unsentRequest, @@ -34,6 +27,14 @@ import { dirname } from 'path'; import { oneLine } from 'common-tags'; import { parse } from 'what-the-diff'; +import type { + ApiRequest, + AssetProxy, + PersistOptions, + FetchError, + DataFile, +} from 'netlify-cms-lib-util'; + interface Config { apiRoot?: string; token?: string; diff --git a/packages/netlify-cms-backend-bitbucket/src/git-lfs-client.ts b/packages/netlify-cms-backend-bitbucket/src/git-lfs-client.ts index 2cff9702..ab4963c8 100644 --- a/packages/netlify-cms-backend-bitbucket/src/git-lfs-client.ts +++ b/packages/netlify-cms-backend-bitbucket/src/git-lfs-client.ts @@ -1,7 +1,8 @@ import minimatch from 'minimatch'; -import type { ApiRequest, PointerFile } from 'netlify-cms-lib-util'; import { unsentRequest } from 'netlify-cms-lib-util'; +import type { ApiRequest, PointerFile } from 'netlify-cms-lib-util'; + type MakeAuthorizedRequest = (req: ApiRequest) => Promise; interface LfsBatchAction { diff --git a/packages/netlify-cms-backend-bitbucket/src/implementation.ts b/packages/netlify-cms-backend-bitbucket/src/implementation.ts index 4b55e766..30375ad6 100644 --- a/packages/netlify-cms-backend-bitbucket/src/implementation.ts +++ b/packages/netlify-cms-backend-bitbucket/src/implementation.ts @@ -1,22 +1,6 @@ -import type { Semaphore } from 'semaphore'; import semaphore from 'semaphore'; import { trimStart } from 'lodash'; import { stripIndent } from 'common-tags'; -import type { - Entry, - ApiRequest, - Cursor, - AssetProxy, - PersistOptions, - DisplayURL, - Implementation, - User, - Credentials, - Config, - ImplementationFile, - AsyncLock, - FetchError, -} from 'netlify-cms-lib-util'; import { CURSOR_COMPATIBILITY_SYMBOL, filterByExtension, @@ -43,10 +27,28 @@ import { branchFromContentKey, } from 'netlify-cms-lib-util'; import { NetlifyAuthenticator } from 'netlify-cms-lib-auth'; + import AuthenticationPage from './AuthenticationPage'; import API, { API_NAME } from './API'; import { GitLfsClient } from './git-lfs-client'; +import type { + Entry, + ApiRequest, + Cursor, + AssetProxy, + PersistOptions, + DisplayURL, + Implementation, + User, + Credentials, + Config, + ImplementationFile, + AsyncLock, + FetchError, +} from 'netlify-cms-lib-util'; +import type { Semaphore } from 'semaphore'; + const MAX_CONCURRENT_DOWNLOADS = 10; const STATUS_PAGE = 'https://bitbucket.status.atlassian.com'; diff --git a/packages/netlify-cms-backend-git-gateway/src/GitHubAPI.ts b/packages/netlify-cms-backend-git-gateway/src/GitHubAPI.ts index e0e194d2..cc5a71e0 100644 --- a/packages/netlify-cms-backend-git-gateway/src/GitHubAPI.ts +++ b/packages/netlify-cms-backend-git-gateway/src/GitHubAPI.ts @@ -1,7 +1,8 @@ import { API as GithubAPI } from 'netlify-cms-backend-github'; +import { APIError } from 'netlify-cms-lib-util'; + import type { Config as GitHubConfig, Diff } from 'netlify-cms-backend-github/src/API'; import type { FetchError } from 'netlify-cms-lib-util'; -import { APIError } from 'netlify-cms-lib-util'; import type { Octokit } from '@octokit/rest'; type Config = GitHubConfig & { diff --git a/packages/netlify-cms-backend-git-gateway/src/GitLabAPI.ts b/packages/netlify-cms-backend-git-gateway/src/GitLabAPI.ts index 7fa554b6..f737e6fe 100644 --- a/packages/netlify-cms-backend-git-gateway/src/GitLabAPI.ts +++ b/packages/netlify-cms-backend-git-gateway/src/GitLabAPI.ts @@ -1,7 +1,8 @@ import { API as GitlabAPI } from 'netlify-cms-backend-gitlab'; +import { unsentRequest } from 'netlify-cms-lib-util'; + import type { Config as GitHubConfig, CommitAuthor } from 'netlify-cms-backend-gitlab/src/API'; import type { ApiRequest } from 'netlify-cms-lib-util'; -import { unsentRequest } from 'netlify-cms-lib-util'; type Config = GitHubConfig & { tokenPromise: () => Promise; commitAuthor: CommitAuthor }; diff --git a/packages/netlify-cms-backend-git-gateway/src/implementation.ts b/packages/netlify-cms-backend-git-gateway/src/implementation.ts index 8ad7f588..158124d3 100644 --- a/packages/netlify-cms-backend-git-gateway/src/implementation.ts +++ b/packages/netlify-cms-backend-git-gateway/src/implementation.ts @@ -2,20 +2,6 @@ import GoTrue from 'gotrue-js'; import jwtDecode from 'jwt-decode'; import { get, pick, intersection } from 'lodash'; import ini from 'ini'; -import type { - ApiRequest, - AssetProxy, - PersistOptions, - Entry, - Cursor, - Implementation, - DisplayURL, - User, - Credentials, - Config, - ImplementationFile, - DisplayURLObject, -} from 'netlify-cms-lib-util'; import { APIError, unsentRequest, @@ -31,12 +17,28 @@ import { import { GitHubBackend } from 'netlify-cms-backend-github'; import { GitLabBackend } from 'netlify-cms-backend-gitlab'; import { BitbucketBackend, API as BitBucketAPI } from 'netlify-cms-backend-bitbucket'; + import GitHubAPI from './GitHubAPI'; import GitLabAPI from './GitLabAPI'; import AuthenticationPage from './AuthenticationPage'; -import type { Client } from './netlify-lfs-client'; import { getClient } from './netlify-lfs-client'; +import type { Client } from './netlify-lfs-client'; +import type { + ApiRequest, + AssetProxy, + PersistOptions, + Entry, + Cursor, + Implementation, + DisplayURL, + User, + Credentials, + Config, + ImplementationFile, + DisplayURLObject, +} from 'netlify-cms-lib-util'; + const STATUS_PAGE = 'https://www.netlifystatus.com'; const GIT_GATEWAY_STATUS_ENDPOINT = `${STATUS_PAGE}/api/v2/components.json`; const GIT_GATEWAY_OPERATIONAL_UNITS = ['Git Gateway']; diff --git a/packages/netlify-cms-backend-git-gateway/src/netlify-lfs-client.ts b/packages/netlify-cms-backend-git-gateway/src/netlify-lfs-client.ts index fd8c99d0..4255bcb5 100644 --- a/packages/netlify-cms-backend-git-gateway/src/netlify-lfs-client.ts +++ b/packages/netlify-cms-backend-git-gateway/src/netlify-lfs-client.ts @@ -1,9 +1,10 @@ import { flow, fromPairs, map } from 'lodash/fp'; import { isPlainObject, isEmpty } from 'lodash'; import minimatch from 'minimatch'; -import type { ApiRequest, PointerFile } from 'netlify-cms-lib-util'; import { unsentRequest } from 'netlify-cms-lib-util'; +import type { ApiRequest, PointerFile } from 'netlify-cms-lib-util'; + type MakeAuthorizedRequest = (req: ApiRequest) => Promise; type ImageTransformations = { nf_resize: string; w: number; h: number }; diff --git a/packages/netlify-cms-backend-github/src/API.ts b/packages/netlify-cms-backend-github/src/API.ts index c57e40df..3472dd85 100644 --- a/packages/netlify-cms-backend-github/src/API.ts +++ b/packages/netlify-cms-backend-github/src/API.ts @@ -1,15 +1,7 @@ import { Base64 } from 'js-base64'; -import type { Semaphore } from 'semaphore'; import semaphore from 'semaphore'; import { initial, last, partial, result, trimStart, trim } from 'lodash'; import { oneLine } from 'common-tags'; -import type { - AssetProxy, - DataFile, - PersistOptions, - FetchError, - ApiRequest, -} from 'netlify-cms-lib-util'; import { getAllResponses, APIError, @@ -33,6 +25,15 @@ import { throwOnConflictingBranches, } from 'netlify-cms-lib-util'; import { dirname } from 'path'; + +import type { + AssetProxy, + DataFile, + PersistOptions, + FetchError, + ApiRequest, +} from 'netlify-cms-lib-util'; +import type { Semaphore } from 'semaphore'; import type { Octokit } from '@octokit/rest'; type GitHubUser = Octokit.UsersGetAuthenticatedResponse; diff --git a/packages/netlify-cms-backend-github/src/GraphQLAPI.ts b/packages/netlify-cms-backend-github/src/GraphQLAPI.ts index 5c79781c..d5f14872 100644 --- a/packages/netlify-cms-backend-github/src/GraphQLAPI.ts +++ b/packages/netlify-cms-backend-github/src/GraphQLAPI.ts @@ -1,6 +1,4 @@ -import type { QueryOptions, MutationOptions, OperationVariables } from 'apollo-client'; import { ApolloClient } from 'apollo-client'; -import type { NormalizedCacheObject } from 'apollo-cache-inmemory'; import { InMemoryCache, defaultDataIdFromObject, @@ -18,11 +16,15 @@ import { throwOnConflictingBranches, } from 'netlify-cms-lib-util'; import { trim, trimStart } from 'lodash'; + import introspectionQueryResultData from './fragmentTypes'; -import type { Config, BlobArgs } from './API'; import API, { API_NAME, PullRequestState, MOCK_PULL_REQUEST } from './API'; import * as queries from './queries'; import * as mutations from './mutations'; + +import type { Config, BlobArgs } from './API'; +import type { NormalizedCacheObject } from 'apollo-cache-inmemory'; +import type { QueryOptions, MutationOptions, OperationVariables } from 'apollo-client'; import type { GraphQLError } from 'graphql'; import type { Octokit } from '@octokit/rest'; diff --git a/packages/netlify-cms-backend-github/src/__tests__/API.spec.js b/packages/netlify-cms-backend-github/src/__tests__/API.spec.js index fc308c20..2537589e 100644 --- a/packages/netlify-cms-backend-github/src/__tests__/API.spec.js +++ b/packages/netlify-cms-backend-github/src/__tests__/API.spec.js @@ -1,4 +1,5 @@ import { Base64 } from 'js-base64'; + import API from '../API'; global.fetch = jest.fn().mockRejectedValue(new Error('should not call fetch inside tests')); diff --git a/packages/netlify-cms-backend-github/src/__tests__/implementation.spec.js b/packages/netlify-cms-backend-github/src/__tests__/implementation.spec.js index 4fda0974..6c7f3fd7 100644 --- a/packages/netlify-cms-backend-github/src/__tests__/implementation.spec.js +++ b/packages/netlify-cms-backend-github/src/__tests__/implementation.spec.js @@ -1,6 +1,7 @@ -import GitHubImplementation from '../implementation'; import { Cursor, CURSOR_COMPATIBILITY_SYMBOL } from 'netlify-cms-lib-util'; +import GitHubImplementation from '../implementation'; + jest.spyOn(console, 'error').mockImplementation(() => {}); describe('github backend implementation', () => { diff --git a/packages/netlify-cms-backend-github/src/implementation.tsx b/packages/netlify-cms-backend-github/src/implementation.tsx index d6f4273b..4b4e1b3c 100644 --- a/packages/netlify-cms-backend-github/src/implementation.tsx +++ b/packages/netlify-cms-backend-github/src/implementation.tsx @@ -1,21 +1,7 @@ import * as React from 'react'; -import type { Semaphore } from 'semaphore'; import semaphore from 'semaphore'; import trimStart from 'lodash/trimStart'; import { stripIndent } from 'common-tags'; -import type { - AsyncLock, - Implementation, - AssetProxy, - PersistOptions, - DisplayURL, - User, - Credentials, - Config, - ImplementationFile, - UnpublishedEntryMediaFile, - Entry, -} from 'netlify-cms-lib-util'; import { CURSOR_COMPATIBILITY_SYMBOL, Cursor, @@ -35,11 +21,27 @@ import { unsentRequest, branchFromContentKey, } from 'netlify-cms-lib-util'; + import AuthenticationPage from './AuthenticationPage'; -import type { Octokit } from '@octokit/rest'; import API, { API_NAME } from './API'; import GraphQLAPI from './GraphQLAPI'; +import type { Octokit } from '@octokit/rest'; +import type { + AsyncLock, + Implementation, + AssetProxy, + PersistOptions, + DisplayURL, + User, + Credentials, + Config, + ImplementationFile, + UnpublishedEntryMediaFile, + Entry, +} from 'netlify-cms-lib-util'; +import type { Semaphore } from 'semaphore'; + type GitHubUser = Octokit.UsersGetAuthenticatedResponse; const MAX_CONCURRENT_DOWNLOADS = 10; diff --git a/packages/netlify-cms-backend-github/src/mutations.ts b/packages/netlify-cms-backend-github/src/mutations.ts index b2ecb31d..6c0627c7 100644 --- a/packages/netlify-cms-backend-github/src/mutations.ts +++ b/packages/netlify-cms-backend-github/src/mutations.ts @@ -1,4 +1,5 @@ import { gql } from 'graphql-tag'; + import * as fragments from './fragments'; // updateRef only works for branches at the moment diff --git a/packages/netlify-cms-backend-github/src/queries.ts b/packages/netlify-cms-backend-github/src/queries.ts index 0be653cb..9e54ecd4 100644 --- a/packages/netlify-cms-backend-github/src/queries.ts +++ b/packages/netlify-cms-backend-github/src/queries.ts @@ -1,5 +1,6 @@ import { gql } from 'graphql-tag'; import { oneLine } from 'common-tags'; + import * as fragments from './fragments'; export const repoPermission = gql` diff --git a/packages/netlify-cms-backend-gitlab/src/API.ts b/packages/netlify-cms-backend-gitlab/src/API.ts index f1c2af99..bee48570 100644 --- a/packages/netlify-cms-backend-gitlab/src/API.ts +++ b/packages/netlify-cms-backend-gitlab/src/API.ts @@ -1,10 +1,3 @@ -import type { - ApiRequest, - DataFile, - AssetProxy, - PersistOptions, - FetchError, -} from 'netlify-cms-lib-util'; import { localForage, parseLinkHeader, @@ -34,6 +27,14 @@ import { Map } from 'immutable'; import { flow, partial, result, trimStart } from 'lodash'; import { dirname } from 'path'; +import type { + ApiRequest, + DataFile, + AssetProxy, + PersistOptions, + FetchError, +} from 'netlify-cms-lib-util'; + export const API_NAME = 'GitLab'; export interface Config { diff --git a/packages/netlify-cms-backend-gitlab/src/__tests__/gitlab.spec.js b/packages/netlify-cms-backend-gitlab/src/__tests__/gitlab.spec.js index 597d1c86..f5c361d1 100644 --- a/packages/netlify-cms-backend-gitlab/src/__tests__/gitlab.spec.js +++ b/packages/netlify-cms-backend-gitlab/src/__tests__/gitlab.spec.js @@ -3,6 +3,7 @@ import { fromJS } from 'immutable'; import { oneLine, stripIndent } from 'common-tags'; import nock from 'nock'; import { Cursor } from 'netlify-cms-lib-util'; + import Gitlab from '../implementation'; import AuthenticationPage from '../AuthenticationPage'; diff --git a/packages/netlify-cms-backend-gitlab/src/implementation.ts b/packages/netlify-cms-backend-gitlab/src/implementation.ts index ef7e971c..b6b9127c 100644 --- a/packages/netlify-cms-backend-gitlab/src/implementation.ts +++ b/packages/netlify-cms-backend-gitlab/src/implementation.ts @@ -1,22 +1,7 @@ import trimStart from 'lodash/trimStart'; -import type { Semaphore } from 'semaphore'; import semaphore from 'semaphore'; import { trim } from 'lodash'; import { stripIndent } from 'common-tags'; -import type { - Entry, - AssetProxy, - PersistOptions, - Cursor, - Implementation, - DisplayURL, - User, - Credentials, - Config, - ImplementationFile, - UnpublishedEntryMediaFile, - AsyncLock, -} from 'netlify-cms-lib-util'; import { CURSOR_COMPATIBILITY_SYMBOL, basename, @@ -37,9 +22,26 @@ import { filterByExtension, branchFromContentKey, } from 'netlify-cms-lib-util'; + import AuthenticationPage from './AuthenticationPage'; import API, { API_NAME } from './API'; +import type { + Entry, + AssetProxy, + PersistOptions, + Cursor, + Implementation, + DisplayURL, + User, + Credentials, + Config, + ImplementationFile, + UnpublishedEntryMediaFile, + AsyncLock, +} from 'netlify-cms-lib-util'; +import type { Semaphore } from 'semaphore'; + const MAX_CONCURRENT_DOWNLOADS = 10; export default class GitLab implements Implementation { diff --git a/packages/netlify-cms-backend-proxy/src/implementation.ts b/packages/netlify-cms-backend-proxy/src/implementation.ts index 2bd9423f..53b9e9cb 100644 --- a/packages/netlify-cms-backend-proxy/src/implementation.ts +++ b/packages/netlify-cms-backend-proxy/src/implementation.ts @@ -1,3 +1,12 @@ +import { + EditorialWorkflowError, + APIError, + unsentRequest, + blobToFileObj, +} from 'netlify-cms-lib-util'; + +import AuthenticationPage from './AuthenticationPage'; + import type { Entry, AssetProxy, @@ -8,13 +17,6 @@ import type { ImplementationFile, UnpublishedEntry, } from 'netlify-cms-lib-util'; -import { - EditorialWorkflowError, - APIError, - unsentRequest, - blobToFileObj, -} from 'netlify-cms-lib-util'; -import AuthenticationPage from './AuthenticationPage'; async function serializeAsset(assetProxy: AssetProxy) { const base64content = await assetProxy.toBase64!(); diff --git a/packages/netlify-cms-backend-test/src/implementation.ts b/packages/netlify-cms-backend-test/src/implementation.ts index ede8c361..fd5df865 100644 --- a/packages/netlify-cms-backend-test/src/implementation.ts +++ b/packages/netlify-cms-backend-test/src/implementation.ts @@ -1,5 +1,15 @@ import { attempt, isError, take, unset, isEmpty } from 'lodash'; import uuid from 'uuid/v4'; +import { + EditorialWorkflowError, + Cursor, + CURSOR_COMPATIBILITY_SYMBOL, + basename, +} from 'netlify-cms-lib-util'; +import { extname, dirname } from 'path'; + +import AuthenticationPage from './AuthenticationPage'; + import type { Implementation, Entry, @@ -11,14 +21,6 @@ import type { ImplementationFile, DataFile, } from 'netlify-cms-lib-util'; -import { - EditorialWorkflowError, - Cursor, - CURSOR_COMPATIBILITY_SYMBOL, - basename, -} from 'netlify-cms-lib-util'; -import { extname, dirname } from 'path'; -import AuthenticationPage from './AuthenticationPage'; type RepoFile = { path: string; content: string | AssetProxy }; type RepoTree = { [key: string]: RepoFile | RepoTree }; diff --git a/packages/netlify-cms-core/src/__tests__/backend.spec.js b/packages/netlify-cms-core/src/__tests__/backend.spec.js index c0ee704a..8b7766ec 100644 --- a/packages/netlify-cms-core/src/__tests__/backend.spec.js +++ b/packages/netlify-cms-core/src/__tests__/backend.spec.js @@ -1,4 +1,5 @@ import { Map, List, fromJS } from 'immutable'; + import { resolveBackend, Backend, diff --git a/packages/netlify-cms-core/src/actions/__tests__/config.spec.js b/packages/netlify-cms-core/src/actions/__tests__/config.spec.js index e1d42e3c..6ba8e59d 100644 --- a/packages/netlify-cms-core/src/actions/__tests__/config.spec.js +++ b/packages/netlify-cms-core/src/actions/__tests__/config.spec.js @@ -1,4 +1,6 @@ import { stripIndent } from 'common-tags'; +import yaml from 'js-yaml'; + import { loadConfig, parseConfig, @@ -8,8 +10,6 @@ import { handleLocalBackend, } from '../config'; -import yaml from 'js-yaml'; - jest.spyOn(console, 'log').mockImplementation(() => {}); jest.spyOn(console, 'warn').mockImplementation(() => {}); jest.mock('../../backend', () => { diff --git a/packages/netlify-cms-core/src/actions/__tests__/editorialWorkflow.spec.js b/packages/netlify-cms-core/src/actions/__tests__/editorialWorkflow.spec.js index 0fd6b92d..b3240908 100644 --- a/packages/netlify-cms-core/src/actions/__tests__/editorialWorkflow.spec.js +++ b/packages/netlify-cms-core/src/actions/__tests__/editorialWorkflow.spec.js @@ -1,9 +1,10 @@ -import * as actions from '../editorialWorkflow'; -import { addAssets } from '../media'; import configureMockStore from 'redux-mock-store'; import thunk from 'redux-thunk'; import { fromJS } from 'immutable'; +import { addAssets } from '../media'; +import * as actions from '../editorialWorkflow'; + jest.mock('../../backend'); jest.mock('../../valueObjects/AssetProxy'); jest.mock('netlify-cms-lib-util'); diff --git a/packages/netlify-cms-core/src/actions/__tests__/entries.spec.js b/packages/netlify-cms-core/src/actions/__tests__/entries.spec.js index 55437e7a..a80aa2e8 100644 --- a/packages/netlify-cms-core/src/actions/__tests__/entries.spec.js +++ b/packages/netlify-cms-core/src/actions/__tests__/entries.spec.js @@ -1,4 +1,7 @@ import { fromJS, Map } from 'immutable'; +import configureMockStore from 'redux-mock-store'; +import thunk from 'redux-thunk'; + import { createEmptyDraft, createEmptyDraftData, @@ -7,8 +10,6 @@ import { getMediaAssets, validateMetaField, } from '../entries'; -import configureMockStore from 'redux-mock-store'; -import thunk from 'redux-thunk'; import AssetProxy from '../../valueObjects/AssetProxy'; jest.mock('../../backend'); diff --git a/packages/netlify-cms-core/src/actions/__tests__/media.spec.ts b/packages/netlify-cms-core/src/actions/__tests__/media.spec.ts index dcc57376..56b133d5 100644 --- a/packages/netlify-cms-core/src/actions/__tests__/media.spec.ts +++ b/packages/netlify-cms-core/src/actions/__tests__/media.spec.ts @@ -1,14 +1,16 @@ import { Map } from 'immutable'; import configureMockStore from 'redux-mock-store'; -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 type { State } from '../../types/redux'; import AssetProxy from '../../valueObjects/AssetProxy'; +import type { State } from '../../types/redux'; +import type { AnyAction } from 'redux'; +import type { ThunkDispatch } from 'redux-thunk'; + const middlewares = [thunk]; const mockStore = configureMockStore, ThunkDispatch>(middlewares); diff --git a/packages/netlify-cms-core/src/actions/__tests__/mediaLibrary.spec.js b/packages/netlify-cms-core/src/actions/__tests__/mediaLibrary.spec.js index fda935aa..4106368c 100644 --- a/packages/netlify-cms-core/src/actions/__tests__/mediaLibrary.spec.js +++ b/packages/netlify-cms-core/src/actions/__tests__/mediaLibrary.spec.js @@ -1,6 +1,7 @@ import configureMockStore from 'redux-mock-store'; import thunk from 'redux-thunk'; import { List, Map } from 'immutable'; + import { insertMedia, persistMedia, deleteMedia } from '../mediaLibrary'; jest.mock('../../backend'); diff --git a/packages/netlify-cms-core/src/actions/__tests__/search.spec.js b/packages/netlify-cms-core/src/actions/__tests__/search.spec.js index 3852afae..6fa0989f 100644 --- a/packages/netlify-cms-core/src/actions/__tests__/search.spec.js +++ b/packages/netlify-cms-core/src/actions/__tests__/search.spec.js @@ -1,8 +1,9 @@ import { fromJS } from 'immutable'; -import { searchEntries } from '../search'; import configureMockStore from 'redux-mock-store'; import thunk from 'redux-thunk'; +import { searchEntries } from '../search'; + const middlewares = [thunk]; const mockStore = configureMockStore(middlewares); diff --git a/packages/netlify-cms-core/src/actions/auth.ts b/packages/netlify-cms-core/src/actions/auth.ts index 079bbb2a..506fcd2c 100644 --- a/packages/netlify-cms-core/src/actions/auth.ts +++ b/packages/netlify-cms-core/src/actions/auth.ts @@ -1,8 +1,10 @@ import { actions as notifActions } from 'redux-notifications'; + +import { currentBackend } from '../backend'; + 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 type { State } from '../types/redux'; const { notifSend, notifClear } = notifActions; diff --git a/packages/netlify-cms-core/src/actions/config.ts b/packages/netlify-cms-core/src/actions/config.ts index b4b5cb8f..3bb3a1cb 100644 --- a/packages/netlify-cms-core/src/actions/config.ts +++ b/packages/netlify-cms-core/src/actions/config.ts @@ -3,8 +3,7 @@ import { fromJS } from 'immutable'; import deepmerge from 'deepmerge'; import { produce } from 'immer'; import { trimStart, trim, isEmpty } from 'lodash'; -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,6 +11,9 @@ 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 type { ThunkDispatch } from 'redux-thunk'; +import type { AnyAction } from 'redux'; import type { CmsCollection, CmsConfig, diff --git a/packages/netlify-cms-core/src/actions/deploys.ts b/packages/netlify-cms-core/src/actions/deploys.ts index 91904350..b14ee35f 100644 --- a/packages/netlify-cms-core/src/actions/deploys.ts +++ b/packages/netlify-cms-core/src/actions/deploys.ts @@ -1,8 +1,10 @@ import { actions as notifActions } from 'redux-notifications'; -import type { ThunkDispatch } from 'redux-thunk'; -import type { AnyAction } from 'redux'; + import { currentBackend } from '../backend'; import { selectDeployPreview } from '../reducers'; + +import type { ThunkDispatch } from 'redux-thunk'; +import type { AnyAction } from 'redux'; import type { Collection, Entry, State } from '../types/redux'; const { notifSend } = notifActions; diff --git a/packages/netlify-cms-core/src/actions/editorialWorkflow.ts b/packages/netlify-cms-core/src/actions/editorialWorkflow.ts index 273a6a54..52d9a8dd 100644 --- a/packages/netlify-cms-core/src/actions/editorialWorkflow.ts +++ b/packages/netlify-cms-core/src/actions/editorialWorkflow.ts @@ -1,7 +1,8 @@ import { get } from 'lodash'; import { actions as notifActions } from 'redux-notifications'; -import type { ThunkDispatch } from 'redux-thunk'; import { Map, List } from 'immutable'; +import { EDITORIAL_WORKFLOW_ERROR } from 'netlify-cms-lib-util'; + import { currentBackend, slugFromCustomPath } from '../backend'; import { selectPublishedSlugs, @@ -10,9 +11,7 @@ import { selectUnpublishedEntry, } from '../reducers'; import { selectEditingDraft } from '../reducers/entries'; -import type { Status } from '../constants/publishModes'; import { EDITORIAL_WORKFLOW, status } from '../constants/publishModes'; -import { EDITORIAL_WORKFLOW_ERROR } from 'netlify-cms-lib-util'; import { loadEntry, entryDeleted, @@ -25,6 +24,8 @@ import { createAssetProxy } from '../valueObjects/AssetProxy'; import { addAssets } from './media'; import { loadMedia } from './mediaLibrary'; import ValidationErrorTypes from '../constants/validationErrorTypes'; +import { navigateToEntry } from '../routing/history'; + import type { Collection, EntryMap, @@ -35,7 +36,8 @@ import type { } from '../types/redux'; import type { AnyAction } from 'redux'; import type { EntryValue } from '../valueObjects/Entry'; -import { navigateToEntry } from '../routing/history'; +import type { Status } from '../constants/publishModes'; +import type { ThunkDispatch } from 'redux-thunk'; const { notifSend } = notifActions; diff --git a/packages/netlify-cms-core/src/actions/entries.ts b/packages/netlify-cms-core/src/actions/entries.ts index ec608a44..83ce9285 100644 --- a/packages/netlify-cms-core/src/actions/entries.ts +++ b/packages/netlify-cms-core/src/actions/entries.ts @@ -1,22 +1,30 @@ -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 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 type { ImplementationMediaFile } from 'netlify-cms-lib-util'; import { Cursor } from 'netlify-cms-lib-util'; -import type { EntryValue } from '../valueObjects/Entry'; + +import { selectCollectionEntriesCursor } from '../reducers/cursors'; +import { selectFields, updateFieldByKey } from '../reducers/collections'; +import { selectIntegration, selectPublishedSlugs } from '../reducers'; +import { getIntegrationProvider } from '../integrations'; +import { currentBackend } from '../backend'; +import { serializeValues } from '../lib/serializeEntryValues'; 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 { SortDirection } from '../types/redux'; +import { waitForMediaLibraryToLoad, loadMedia } from './mediaLibrary'; +import { waitUntil } from './waitUntil'; +import { selectIsFetching, selectEntriesSortFields, selectEntryByPath } from '../reducers/entries'; +import { selectCustomPath } from '../reducers/entryDraft'; +import { navigateToEntry } from '../routing/history'; +import { getProcessSegment } from '../lib/formatters'; +import { hasI18n, duplicateDefaultI18nFields, serializeI18n, I18N, I18N_FIELD } from '../lib/i18n'; + +import type { ImplementationMediaFile } from 'netlify-cms-lib-util'; +import type { AnyAction } from 'redux'; +import type { ThunkDispatch } from 'redux-thunk'; import type { Collection, EntryMap, @@ -27,17 +35,10 @@ import type { ViewGroup, Entry, } from '../types/redux'; -import { SortDirection } from '../types/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'; -import { selectCustomPath } from '../reducers/entryDraft'; -import { navigateToEntry } from '../routing/history'; -import { getProcessSegment } from '../lib/formatters'; -import { hasI18n, duplicateDefaultI18nFields, serializeI18n, I18N, I18N_FIELD } from '../lib/i18n'; +import type { EntryValue } from '../valueObjects/Entry'; +import type { Backend } from '../backend'; +import type AssetProxy from '../valueObjects/AssetProxy'; +import type { Set } from 'immutable'; const { notifSend } = notifActions; diff --git a/packages/netlify-cms-core/src/actions/media.ts b/packages/netlify-cms-core/src/actions/media.ts index 9e2d9bd2..0aa0c724 100644 --- a/packages/netlify-cms-core/src/actions/media.ts +++ b/packages/netlify-cms-core/src/actions/media.ts @@ -1,13 +1,15 @@ -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 { createAssetProxy } from '../valueObjects/AssetProxy'; import { selectMediaFilePath } from '../reducers/entries'; import { selectMediaFileByPath } from '../reducers/mediaLibrary'; import { getMediaFile, waitForMediaLibraryToLoad, getMediaDisplayURL } from './mediaLibrary'; +import type AssetProxy from '../valueObjects/AssetProxy'; +import type { Collection, State, EntryMap, EntryField } from '../types/redux'; +import type { ThunkDispatch } from 'redux-thunk'; +import type { AnyAction } from 'redux'; + export const ADD_ASSETS = 'ADD_ASSETS'; export const ADD_ASSET = 'ADD_ASSET'; export const REMOVE_ASSET = 'REMOVE_ASSET'; diff --git a/packages/netlify-cms-core/src/actions/mediaLibrary.ts b/packages/netlify-cms-core/src/actions/mediaLibrary.ts index 423bcb45..144068a2 100644 --- a/packages/netlify-cms-core/src/actions/mediaLibrary.ts +++ b/packages/netlify-cms-core/src/actions/mediaLibrary.ts @@ -1,9 +1,8 @@ import { Map } from 'immutable'; import { actions as notifActions } from 'redux-notifications'; -import type { ImplementationMediaFile } from 'netlify-cms-lib-util'; import { basename, getBlobSHA } from 'netlify-cms-lib-util'; + import { currentBackend } from '../backend'; -import type AssetProxy from '../valueObjects/AssetProxy'; import { createAssetProxy } from '../valueObjects/AssetProxy'; import { selectIntegration } from '../reducers'; import { @@ -16,6 +15,8 @@ import { getIntegrationProvider } from '../integrations'; import { addAsset, removeAsset } from './media'; import { addDraftEntryMediaFile, removeDraftEntryMediaFile } from './entries'; import { sanitizeSlug } from '../lib/urlHelper'; +import { waitUntilWithTimeout } from './waitUntil'; + import type { State, MediaFile, @@ -25,7 +26,8 @@ import type { } from '../types/redux'; import type { AnyAction } from 'redux'; import type { ThunkDispatch } from 'redux-thunk'; -import { waitUntilWithTimeout } from './waitUntil'; +import type AssetProxy from '../valueObjects/AssetProxy'; +import type { ImplementationMediaFile } from 'netlify-cms-lib-util'; const { notifSend } = notifActions; diff --git a/packages/netlify-cms-core/src/actions/search.ts b/packages/netlify-cms-core/src/actions/search.ts index 7a2f3590..f1064e21 100644 --- a/packages/netlify-cms-core/src/actions/search.ts +++ b/packages/netlify-cms-core/src/actions/search.ts @@ -1,10 +1,12 @@ -import type { ThunkDispatch } from 'redux-thunk'; -import type { AnyAction } from 'redux'; import { isEqual } from 'lodash'; -import type { State } from '../types/redux'; + import { currentBackend } from '../backend'; import { getIntegrationProvider } from '../integrations'; import { selectIntegration } from '../reducers'; + +import type { State } from '../types/redux'; +import type { AnyAction } from 'redux'; +import type { ThunkDispatch } from 'redux-thunk'; import type { EntryValue } from '../valueObjects/Entry'; /* diff --git a/packages/netlify-cms-core/src/actions/status.ts b/packages/netlify-cms-core/src/actions/status.ts index 9b9f89d2..2d171448 100644 --- a/packages/netlify-cms-core/src/actions/status.ts +++ b/packages/netlify-cms-core/src/actions/status.ts @@ -1,8 +1,10 @@ +import { actions as notifActions } from 'redux-notifications'; + +import { currentBackend } from '../backend'; + import type { ThunkDispatch } from 'redux-thunk'; import type { AnyAction } from 'redux'; -import { actions as notifActions } from 'redux-notifications'; import type { State } from '../types/redux'; -import { currentBackend } from '../backend'; const { notifSend, notifDismiss } = notifActions; diff --git a/packages/netlify-cms-core/src/actions/waitUntil.ts b/packages/netlify-cms-core/src/actions/waitUntil.ts index 7186c462..d0a51b1d 100644 --- a/packages/netlify-cms-core/src/actions/waitUntil.ts +++ b/packages/netlify-cms-core/src/actions/waitUntil.ts @@ -1,5 +1,6 @@ -import type { WaitActionArgs } from '../redux/middleware/waitUntilAction'; import { WAIT_UNTIL_ACTION } from '../redux/middleware/waitUntilAction'; + +import type { WaitActionArgs } from '../redux/middleware/waitUntilAction'; import type { ThunkDispatch } from 'redux-thunk'; import type { AnyAction } from 'redux'; import type { State } from '../types/redux'; diff --git a/packages/netlify-cms-core/src/backend.ts b/packages/netlify-cms-core/src/backend.ts index 5e1840b3..0b7680c8 100644 --- a/packages/netlify-cms-core/src/backend.ts +++ b/packages/netlify-cms-core/src/backend.ts @@ -1,18 +1,6 @@ import { attempt, flatten, isError, uniq, trim, sortBy, get, set } from 'lodash'; -import type { Map } from 'immutable'; import { List, fromJS, Set } from 'immutable'; import * as fuzzy from 'fuzzy'; -import type { - Implementation as BackendImplementation, - DisplayURL, - ImplementationEntry, - Credentials, - User, - AsyncLock, - UnpublishedEntry, - DataFile, - UnpublishedEntryDiff, -} from 'netlify-cms-lib-util'; import { localForage, Cursor, @@ -24,6 +12,7 @@ import { } from 'netlify-cms-lib-util'; import { basename, join, extname, dirname } from 'path'; import { stringTemplate } from 'netlify-cms-lib-widgets'; + import { resolveFormat } from './formats/formats'; import { selectUseWorkflow } from './reducers/config'; import { selectMediaFilePath, selectEntry } from './reducers/entries'; @@ -40,24 +29,11 @@ import { selectFieldsComments, selectHasMetaPath, } from './reducers/collections'; -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 type { - CmsConfig, - EntryMap, - FilterRule, - EntryDraft, - Collection, - Collections, - CollectionFile, - State, - EntryField, -} from './types/redux'; -import type AssetProxy from './valueObjects/AssetProxy'; import { FOLDER, FILES } from './constants/collectionTypes'; import { selectCustomPath } from './reducers/entryDraft'; import { @@ -72,6 +48,32 @@ import { formatI18nBackup, } from './lib/i18n'; +import type AssetProxy from './valueObjects/AssetProxy'; +import type { + CmsConfig, + EntryMap, + FilterRule, + EntryDraft, + Collection, + Collections, + CollectionFile, + State, + EntryField, +} from './types/redux'; +import type { EntryValue } from './valueObjects/Entry'; +import type { + Implementation as BackendImplementation, + DisplayURL, + ImplementationEntry, + Credentials, + User, + AsyncLock, + UnpublishedEntry, + DataFile, + UnpublishedEntryDiff, +} from 'netlify-cms-lib-util'; +import type { Map } from 'immutable'; + const { extractTemplateVars, dateParsers, expandPath } = stringTemplate; function updateAssetProxies( diff --git a/packages/netlify-cms-core/src/bootstrap.js b/packages/netlify-cms-core/src/bootstrap.js index a83c7ade..5533013a 100644 --- a/packages/netlify-cms-core/src/bootstrap.js +++ b/packages/netlify-cms-core/src/bootstrap.js @@ -4,6 +4,7 @@ import { Provider, connect } from 'react-redux'; import { Route, Router } from 'react-router-dom'; import { GlobalStyles } from 'netlify-cms-ui-default'; import { I18n } from 'react-polyglot'; + import { store } from './redux'; import { history } from './routing/history'; import { loadConfig } from './actions/config'; diff --git a/packages/netlify-cms-core/src/components/App/App.js b/packages/netlify-cms-core/src/components/App/App.js index 23e45950..e9555b3c 100644 --- a/packages/netlify-cms-core/src/components/App/App.js +++ b/packages/netlify-cms-core/src/components/App/App.js @@ -8,13 +8,14 @@ import { connect } from 'react-redux'; import { Route, Switch, Redirect } from 'react-router-dom'; import { Notifs } from 'redux-notifications'; import TopBarProgress from 'react-topbar-progress-indicator'; +import { Loader, colors } from 'netlify-cms-ui-default'; + import { loginUser, logoutUser } from '../../actions/auth'; import { currentBackend } from '../../backend'; import { createNewEntry } from '../../actions/collections'; import { openMediaLibrary } from '../../actions/mediaLibrary'; import MediaLibrary from '../MediaLibrary/MediaLibrary'; import { Toast } from '../UI'; -import { Loader, colors } from 'netlify-cms-ui-default'; import { history } from '../../routing/history'; import { SIMPLE, EDITORIAL_WORKFLOW } from '../../constants/publishModes'; import Collection from '../Collection/Collection'; diff --git a/packages/netlify-cms-core/src/components/App/Header.js b/packages/netlify-cms-core/src/components/App/Header.js index d210d1a8..21ea2c91 100644 --- a/packages/netlify-cms-core/src/components/App/Header.js +++ b/packages/netlify-cms-core/src/components/App/Header.js @@ -16,8 +16,9 @@ import { buttons, zIndex, } from 'netlify-cms-ui-default'; -import { SettingsDropdown } from '../UI'; import { connect } from 'react-redux'; + +import { SettingsDropdown } from '../UI'; import { checkBackendStatus } from '../../actions/status'; const styles = { diff --git a/packages/netlify-cms-core/src/components/Collection/Collection.js b/packages/netlify-cms-core/src/components/Collection/Collection.js index 80958957..b314426f 100644 --- a/packages/netlify-cms-core/src/components/Collection/Collection.js +++ b/packages/netlify-cms-core/src/components/Collection/Collection.js @@ -5,6 +5,7 @@ import styled from '@emotion/styled'; import { connect } from 'react-redux'; import { translate } from 'react-polyglot'; import { lengths, components } from 'netlify-cms-ui-default'; + import { getNewEntryUrl } from '../../lib/urlHelper'; import Sidebar from './Sidebar'; import CollectionTop from './CollectionTop'; diff --git a/packages/netlify-cms-core/src/components/Collection/CollectionControls.js b/packages/netlify-cms-core/src/components/Collection/CollectionControls.js index 9e912113..a301ab34 100644 --- a/packages/netlify-cms-core/src/components/Collection/CollectionControls.js +++ b/packages/netlify-cms-core/src/components/Collection/CollectionControls.js @@ -1,9 +1,10 @@ import React from 'react'; import styled from '@emotion/styled'; +import { lengths } from 'netlify-cms-ui-default'; + import ViewStyleControl from './ViewStyleControl'; import SortControl from './SortControl'; import FilterControl from './FilterControl'; -import { lengths } from 'netlify-cms-ui-default'; import GroupControl from './GroupControl'; const CollectionControlsContainer = styled.div` diff --git a/packages/netlify-cms-core/src/components/Collection/Entries/Entries.js b/packages/netlify-cms-core/src/components/Collection/Entries/Entries.js index 17b39485..aba9f0e1 100644 --- a/packages/netlify-cms-core/src/components/Collection/Entries/Entries.js +++ b/packages/netlify-cms-core/src/components/Collection/Entries/Entries.js @@ -4,6 +4,7 @@ import styled from '@emotion/styled'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { translate } from 'react-polyglot'; import { Loader, lengths } from 'netlify-cms-ui-default'; + import EntryListing from './EntryListing'; const PaginationMessage = styled.div` diff --git a/packages/netlify-cms-core/src/components/Collection/Entries/EntriesCollection.js b/packages/netlify-cms-core/src/components/Collection/Entries/EntriesCollection.js index f2dc8ddc..07e6aa2e 100644 --- a/packages/netlify-cms-core/src/components/Collection/Entries/EntriesCollection.js +++ b/packages/netlify-cms-core/src/components/Collection/Entries/EntriesCollection.js @@ -7,6 +7,7 @@ import { translate } from 'react-polyglot'; import { partial } from 'lodash'; import { Cursor } from 'netlify-cms-lib-util'; import { colors } from 'netlify-cms-ui-default'; + import { loadEntries as actionLoadEntries, traverseCollectionCursor as actionTraverseCollectionCursor, diff --git a/packages/netlify-cms-core/src/components/Collection/Entries/EntriesSearch.js b/packages/netlify-cms-core/src/components/Collection/Entries/EntriesSearch.js index ce3b546f..4789ced8 100644 --- a/packages/netlify-cms-core/src/components/Collection/Entries/EntriesSearch.js +++ b/packages/netlify-cms-core/src/components/Collection/Entries/EntriesSearch.js @@ -4,6 +4,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import { connect } from 'react-redux'; import { isEqual } from 'lodash'; import { Cursor } from 'netlify-cms-lib-util'; + import { selectSearchedEntries } from '../../../reducers'; import { searchEntries as actionSearchEntries, diff --git a/packages/netlify-cms-core/src/components/Collection/Entries/EntryCard.js b/packages/netlify-cms-core/src/components/Collection/Entries/EntryCard.js index 973bb92f..35709cc4 100644 --- a/packages/netlify-cms-core/src/components/Collection/Entries/EntryCard.js +++ b/packages/netlify-cms-core/src/components/Collection/Entries/EntryCard.js @@ -1,9 +1,10 @@ import React from 'react'; import styled from '@emotion/styled'; import { connect } from 'react-redux'; -import { boundGetAsset } from '../../../actions/media'; import { Link } from 'react-router-dom'; import { colors, colorsRaw, components, lengths, zIndex } from 'netlify-cms-ui-default'; + +import { boundGetAsset } from '../../../actions/media'; import { VIEW_STYLE_LIST, VIEW_STYLE_GRID } from '../../../constants/collectionViews'; import { selectIsLoadingAsset } from '../../../reducers/medias'; import { selectEntryCollectionTitle } from '../../../reducers/collections'; diff --git a/packages/netlify-cms-core/src/components/Collection/Entries/EntryListing.js b/packages/netlify-cms-core/src/components/Collection/Entries/EntryListing.js index d22d5d95..3e206f51 100644 --- a/packages/netlify-cms-core/src/components/Collection/Entries/EntryListing.js +++ b/packages/netlify-cms-core/src/components/Collection/Entries/EntryListing.js @@ -4,6 +4,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import styled from '@emotion/styled'; import { Waypoint } from 'react-waypoint'; import { Map } from 'immutable'; + import { selectFields, selectInferedField } from '../../../reducers/collections'; import EntryCard from './EntryCard'; diff --git a/packages/netlify-cms-core/src/components/Collection/Entries/__tests__/EntriesCollection.spec.js b/packages/netlify-cms-core/src/components/Collection/Entries/__tests__/EntriesCollection.spec.js index 624dbca2..5afbd19b 100644 --- a/packages/netlify-cms-core/src/components/Collection/Entries/__tests__/EntriesCollection.spec.js +++ b/packages/netlify-cms-core/src/components/Collection/Entries/__tests__/EntriesCollection.spec.js @@ -1,13 +1,14 @@ import React from 'react'; -import ConnectedEntriesCollection, { - EntriesCollection, - filterNestedEntries, -} from '../EntriesCollection'; import { render } from '@testing-library/react'; import { fromJS } from 'immutable'; import configureStore from 'redux-mock-store'; import { Provider } from 'react-redux'; +import ConnectedEntriesCollection, { + EntriesCollection, + filterNestedEntries, +} from '../EntriesCollection'; + jest.mock('../Entries', () => 'mock-entries'); const middlewares = []; diff --git a/packages/netlify-cms-core/src/components/Collection/FilterControl.js b/packages/netlify-cms-core/src/components/Collection/FilterControl.js index 129554b9..a41bfd26 100644 --- a/packages/netlify-cms-core/src/components/Collection/FilterControl.js +++ b/packages/netlify-cms-core/src/components/Collection/FilterControl.js @@ -1,6 +1,7 @@ import React from 'react'; import { translate } from 'react-polyglot'; import { Dropdown, DropdownCheckedItem } from 'netlify-cms-ui-default'; + import { ControlButton } from './ControlButton'; function FilterControl({ viewFilters, t, onFilterClick, filter }) { diff --git a/packages/netlify-cms-core/src/components/Collection/GroupControl.js b/packages/netlify-cms-core/src/components/Collection/GroupControl.js index abcd3118..42e2881c 100644 --- a/packages/netlify-cms-core/src/components/Collection/GroupControl.js +++ b/packages/netlify-cms-core/src/components/Collection/GroupControl.js @@ -1,6 +1,7 @@ import React from 'react'; import { translate } from 'react-polyglot'; import { Dropdown, DropdownItem } from 'netlify-cms-ui-default'; + import { ControlButton } from './ControlButton'; function GroupControl({ viewGroups, t, onGroupClick, group }) { diff --git a/packages/netlify-cms-core/src/components/Collection/NestedCollection.js b/packages/netlify-cms-core/src/components/Collection/NestedCollection.js index 4047da72..c4b6029c 100644 --- a/packages/netlify-cms-core/src/components/Collection/NestedCollection.js +++ b/packages/netlify-cms-core/src/components/Collection/NestedCollection.js @@ -6,13 +6,14 @@ import { connect } from 'react-redux'; import { NavLink } from 'react-router-dom'; import { dirname, sep } from 'path'; import { stringTemplate } from 'netlify-cms-lib-widgets'; -import { selectEntryCollectionTitle } from '../../reducers/collections'; -import { selectEntries } from '../../reducers/entries'; import { Icon, colors, components } from 'netlify-cms-ui-default'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { sortBy } from 'lodash'; +import { selectEntries } from '../../reducers/entries'; +import { selectEntryCollectionTitle } from '../../reducers/collections'; + const { addFileTemplateFields } = stringTemplate; const NodeTitleContainer = styled.div` diff --git a/packages/netlify-cms-core/src/components/Collection/Sidebar.js b/packages/netlify-cms-core/src/components/Collection/Sidebar.js index 68cd6ba3..ae1e59b8 100644 --- a/packages/netlify-cms-core/src/components/Collection/Sidebar.js +++ b/packages/netlify-cms-core/src/components/Collection/Sidebar.js @@ -6,6 +6,7 @@ import { css } from '@emotion/core'; import { translate } from 'react-polyglot'; import { NavLink } from 'react-router-dom'; import { Icon, components, colors } from 'netlify-cms-ui-default'; + import { searchCollections } from '../../actions/collections'; import CollectionSearch from './CollectionSearch'; import NestedCollection from './NestedCollection'; diff --git a/packages/netlify-cms-core/src/components/Collection/SortControl.js b/packages/netlify-cms-core/src/components/Collection/SortControl.js index 5624ee32..978d44df 100644 --- a/packages/netlify-cms-core/src/components/Collection/SortControl.js +++ b/packages/netlify-cms-core/src/components/Collection/SortControl.js @@ -1,6 +1,7 @@ import React from 'react'; import { translate } from 'react-polyglot'; import { Dropdown, DropdownItem } from 'netlify-cms-ui-default'; + import { SortDirection } from '../../types/redux'; import { ControlButton } from './ControlButton'; diff --git a/packages/netlify-cms-core/src/components/Collection/ViewStyleControl.js b/packages/netlify-cms-core/src/components/Collection/ViewStyleControl.js index cc618944..234feedd 100644 --- a/packages/netlify-cms-core/src/components/Collection/ViewStyleControl.js +++ b/packages/netlify-cms-core/src/components/Collection/ViewStyleControl.js @@ -1,6 +1,7 @@ import React from 'react'; import styled from '@emotion/styled'; import { Icon, buttons, colors } from 'netlify-cms-ui-default'; + import { VIEW_STYLE_LIST, VIEW_STYLE_GRID } from '../../constants/collectionViews'; const ViewControlsSection = styled.div` diff --git a/packages/netlify-cms-core/src/components/Collection/__tests__/Collection.spec.js b/packages/netlify-cms-core/src/components/Collection/__tests__/Collection.spec.js index f40b76ee..eca5af8d 100644 --- a/packages/netlify-cms-core/src/components/Collection/__tests__/Collection.spec.js +++ b/packages/netlify-cms-core/src/components/Collection/__tests__/Collection.spec.js @@ -1,10 +1,11 @@ import React from 'react'; -import ConnectedCollection, { Collection } from '../Collection'; import { render } from '@testing-library/react'; import { fromJS } from 'immutable'; import configureStore from 'redux-mock-store'; import { Provider } from 'react-redux'; +import ConnectedCollection, { Collection } from '../Collection'; + jest.mock('../Entries/EntriesCollection', () => 'mock-entries-collection'); jest.mock('../CollectionTop', () => 'mock-collection-top'); jest.mock('../CollectionControls', () => 'mock-collection-controls'); diff --git a/packages/netlify-cms-core/src/components/Collection/__tests__/NestedCollection.spec.js b/packages/netlify-cms-core/src/components/Collection/__tests__/NestedCollection.spec.js index c9fdeb54..87aaa1a6 100644 --- a/packages/netlify-cms-core/src/components/Collection/__tests__/NestedCollection.spec.js +++ b/packages/netlify-cms-core/src/components/Collection/__tests__/NestedCollection.spec.js @@ -1,15 +1,16 @@ import React from 'react'; import { MemoryRouter } from 'react-router-dom'; +import { render, fireEvent } from '@testing-library/react'; +import { fromJS } from 'immutable'; +import configureStore from 'redux-mock-store'; +import { Provider } from 'react-redux'; + import ConnectedNestedCollection, { NestedCollection, getTreeData, walk, updateNode, } from '../NestedCollection'; -import { render, fireEvent } from '@testing-library/react'; -import { fromJS } from 'immutable'; -import configureStore from 'redux-mock-store'; -import { Provider } from 'react-redux'; jest.mock('netlify-cms-ui-default', () => { const actual = jest.requireActual('netlify-cms-ui-default'); diff --git a/packages/netlify-cms-core/src/components/Collection/__tests__/Sidebar.spec.js b/packages/netlify-cms-core/src/components/Collection/__tests__/Sidebar.spec.js index 4aa6037e..6fee99cf 100644 --- a/packages/netlify-cms-core/src/components/Collection/__tests__/Sidebar.spec.js +++ b/packages/netlify-cms-core/src/components/Collection/__tests__/Sidebar.spec.js @@ -1,9 +1,10 @@ import React from 'react'; import { MemoryRouter } from 'react-router-dom'; -import { Sidebar } from '../Sidebar'; import { render } from '@testing-library/react'; import { fromJS } from 'immutable'; +import { Sidebar } from '../Sidebar'; + jest.mock('netlify-cms-ui-default', () => { const actual = jest.requireActual('netlify-cms-ui-default'); return { diff --git a/packages/netlify-cms-core/src/components/Editor/Editor.js b/packages/netlify-cms-core/src/components/Editor/Editor.js index 706f06a8..47f3adea 100644 --- a/packages/netlify-cms-core/src/components/Editor/Editor.js +++ b/packages/netlify-cms-core/src/components/Editor/Editor.js @@ -5,6 +5,7 @@ import { connect } from 'react-redux'; import { Loader } from 'netlify-cms-ui-default'; import { translate } from 'react-polyglot'; import { debounce } from 'lodash'; + import { history, navigateToCollection, navigateToNewEntry } from '../../routing/history'; import { logoutUser } from '../../actions/auth'; import { diff --git a/packages/netlify-cms-core/src/components/Editor/EditorControlPane/EditorControl.js b/packages/netlify-cms-core/src/components/Editor/EditorControlPane/EditorControl.js index cb745595..f123ca5d 100644 --- a/packages/netlify-cms-core/src/components/Editor/EditorControlPane/EditorControl.js +++ b/packages/netlify-cms-core/src/components/Editor/EditorControlPane/EditorControl.js @@ -8,6 +8,7 @@ import styled from '@emotion/styled'; import { partial, uniqueId } from 'lodash'; import { connect } from 'react-redux'; import { FieldLabel, colors, transitions, lengths, borders } from 'netlify-cms-ui-default'; + import { resolveWidget, getEditorComponents } from '../../../lib/registry'; import { clearFieldErrors, tryLoadEntry, validateMetaField } from '../../../actions/entries'; import { addAsset, boundGetAsset } from '../../../actions/media'; diff --git a/packages/netlify-cms-core/src/components/Editor/EditorControlPane/EditorControlPane.js b/packages/netlify-cms-core/src/components/Editor/EditorControlPane/EditorControlPane.js index 7eb39199..aafe394b 100644 --- a/packages/netlify-cms-core/src/components/Editor/EditorControlPane/EditorControlPane.js +++ b/packages/netlify-cms-core/src/components/Editor/EditorControlPane/EditorControlPane.js @@ -3,7 +3,6 @@ import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { css } from '@emotion/core'; import styled from '@emotion/styled'; -import EditorControl from './EditorControl'; import { colors, Dropdown, @@ -12,6 +11,8 @@ import { buttons, text, } from 'netlify-cms-ui-default'; + +import EditorControl from './EditorControl'; import { getI18nInfo, isFieldTranslatable, diff --git a/packages/netlify-cms-core/src/components/Editor/EditorControlPane/Widget.js b/packages/netlify-cms-core/src/components/Editor/EditorControlPane/Widget.js index f5c96f70..2493930b 100644 --- a/packages/netlify-cms-core/src/components/Editor/EditorControlPane/Widget.js +++ b/packages/netlify-cms-core/src/components/Editor/EditorControlPane/Widget.js @@ -3,6 +3,7 @@ import React, { Component } from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { Map, List } from 'immutable'; import { oneLine } from 'common-tags'; + import ValidationErrorTypes from '../../../constants/validationErrorTypes'; function truthy() { diff --git a/packages/netlify-cms-core/src/components/Editor/EditorInterface.js b/packages/netlify-cms-core/src/components/Editor/EditorInterface.js index a8ba42a5..003bea62 100644 --- a/packages/netlify-cms-core/src/components/Editor/EditorInterface.js +++ b/packages/netlify-cms-core/src/components/Editor/EditorInterface.js @@ -13,6 +13,7 @@ import { zIndex, } from 'netlify-cms-ui-default'; import { ScrollSync, ScrollSyncPane } from 'react-scroll-sync'; + import EditorControlPane from './EditorControlPane/EditorControlPane'; import EditorPreviewPane from './EditorPreviewPane/EditorPreviewPane'; import EditorToolbar from './EditorToolbar'; diff --git a/packages/netlify-cms-core/src/components/Editor/EditorPreviewPane/EditorPreviewPane.js b/packages/netlify-cms-core/src/components/Editor/EditorPreviewPane/EditorPreviewPane.js index e14dc8b3..3d7ccad9 100644 --- a/packages/netlify-cms-core/src/components/Editor/EditorPreviewPane/EditorPreviewPane.js +++ b/packages/netlify-cms-core/src/components/Editor/EditorPreviewPane/EditorPreviewPane.js @@ -5,10 +5,11 @@ import { List, Map } from 'immutable'; import ImmutablePropTypes from 'react-immutable-proptypes'; import Frame, { FrameContextConsumer } from 'react-frame-component'; import { lengths } from 'netlify-cms-ui-default'; +import { connect } from 'react-redux'; + import { resolveWidget, getPreviewTemplate, getPreviewStyles } from '../../../lib/registry'; import { ErrorBoundary } from '../../UI'; import { selectTemplateName, selectInferedField, selectField } from '../../../reducers/collections'; -import { connect } from 'react-redux'; import { boundGetAsset } from '../../../actions/media'; import { selectIsLoadingAsset } from '../../../reducers/medias'; import { INFERABLE_FIELDS } from '../../../constants/fieldInference'; diff --git a/packages/netlify-cms-core/src/components/Editor/EditorToolbar.js b/packages/netlify-cms-core/src/components/Editor/EditorToolbar.js index 7bd0fe1b..483ff4de 100644 --- a/packages/netlify-cms-core/src/components/Editor/EditorToolbar.js +++ b/packages/netlify-cms-core/src/components/Editor/EditorToolbar.js @@ -16,6 +16,7 @@ import { buttons, zIndex, } from 'netlify-cms-ui-default'; + import { status } from '../../constants/publishModes'; import { SettingsDropdown } from '../UI'; diff --git a/packages/netlify-cms-core/src/components/Editor/__tests__/Editor.spec.js b/packages/netlify-cms-core/src/components/Editor/__tests__/Editor.spec.js index 6b9b81b5..cecfc254 100644 --- a/packages/netlify-cms-core/src/components/Editor/__tests__/Editor.spec.js +++ b/packages/netlify-cms-core/src/components/Editor/__tests__/Editor.spec.js @@ -1,8 +1,9 @@ import React from 'react'; -import { Editor } from '../Editor'; import { render } from '@testing-library/react'; import { fromJS } from 'immutable'; +import { Editor } from '../Editor'; + jest.mock('lodash/debounce', () => { const flush = jest.fn(); return func => { diff --git a/packages/netlify-cms-core/src/components/Editor/withWorkflow.js b/packages/netlify-cms-core/src/components/Editor/withWorkflow.js index e78cc3ba..47fb52c0 100644 --- a/packages/netlify-cms-core/src/components/Editor/withWorkflow.js +++ b/packages/netlify-cms-core/src/components/Editor/withWorkflow.js @@ -1,5 +1,6 @@ import React from 'react'; import { connect } from 'react-redux'; + import { EDITORIAL_WORKFLOW } from '../../constants/publishModes'; import { selectUnpublishedEntry } from '../../reducers'; import { selectAllowDeletion } from '../../reducers/collections'; diff --git a/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibrary.js b/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibrary.js index f33f39e8..efe357e5 100644 --- a/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibrary.js +++ b/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibrary.js @@ -6,6 +6,7 @@ import { orderBy, map } from 'lodash'; import { translate } from 'react-polyglot'; import fuzzy from 'fuzzy'; import { fileExtension } from 'netlify-cms-lib-util'; + import { loadMedia as loadMediaAction, persistMedia as persistMediaAction, diff --git a/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibraryButtons.js b/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibraryButtons.js index 452f5569..8e894625 100644 --- a/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibraryButtons.js +++ b/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibraryButtons.js @@ -2,11 +2,12 @@ import React from 'react'; import PropTypes from 'prop-types'; import { css } from '@emotion/core'; import styled from '@emotion/styled'; -import { FileUploadButton } from '../UI'; import copyToClipboard from 'copy-text-to-clipboard'; import { isAbsolutePath } from 'netlify-cms-lib-util'; import { buttons, shadows, zIndex } from 'netlify-cms-ui-default'; +import { FileUploadButton } from '../UI'; + const styles = { button: css` ${buttons.button}; diff --git a/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibraryCardGrid.js b/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibraryCardGrid.js index 5aeae896..8d13b12e 100644 --- a/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibraryCardGrid.js +++ b/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibraryCardGrid.js @@ -2,12 +2,13 @@ import React from 'react'; import PropTypes from 'prop-types'; import styled from '@emotion/styled'; import { Waypoint } from 'react-waypoint'; -import MediaLibraryCard from './MediaLibraryCard'; import { Map } from 'immutable'; import { colors } from 'netlify-cms-ui-default'; import { FixedSizeGrid as Grid } from 'react-window'; import AutoSizer from 'react-virtualized-auto-sizer'; +import MediaLibraryCard from './MediaLibraryCard'; + function CardWrapper(props) { const { rowIndex, diff --git a/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibraryModal.js b/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibraryModal.js index 6482ac4e..d2499400 100644 --- a/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibraryModal.js +++ b/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibraryModal.js @@ -4,11 +4,12 @@ import styled from '@emotion/styled'; import { Map } from 'immutable'; import { isEmpty } from 'lodash'; import { translate } from 'react-polyglot'; +import { colors } from 'netlify-cms-ui-default'; + import { Modal } from '../UI'; import MediaLibraryTop from './MediaLibraryTop'; import MediaLibraryCardGrid from './MediaLibraryCardGrid'; import EmptyMessage from './EmptyMessage'; -import { colors } from 'netlify-cms-ui-default'; /** * Responsive styling needs to be overhauled. Current setup requires specifying diff --git a/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibraryTop.js b/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibraryTop.js index f9e9b6cd..00b3ed06 100644 --- a/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibraryTop.js +++ b/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibraryTop.js @@ -1,6 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import styled from '@emotion/styled'; + import MediaLibrarySearch from './MediaLibrarySearch'; import MediaLibraryHeader from './MediaLibraryHeader'; import { diff --git a/packages/netlify-cms-core/src/components/MediaLibrary/__tests__/MediaLibraryButtons.spec.js b/packages/netlify-cms-core/src/components/MediaLibrary/__tests__/MediaLibraryButtons.spec.js index 1c806c11..97619332 100644 --- a/packages/netlify-cms-core/src/components/MediaLibrary/__tests__/MediaLibraryButtons.spec.js +++ b/packages/netlify-cms-core/src/components/MediaLibrary/__tests__/MediaLibraryButtons.spec.js @@ -1,7 +1,8 @@ import React from 'react'; -import { CopyToClipBoardButton } from '../MediaLibraryButtons'; import { render } from '@testing-library/react'; +import { CopyToClipBoardButton } from '../MediaLibraryButtons'; + describe('CopyToClipBoardButton', () => { const props = { disabled: false, diff --git a/packages/netlify-cms-core/src/components/MediaLibrary/__tests__/MediaLibraryCard.spec.js b/packages/netlify-cms-core/src/components/MediaLibrary/__tests__/MediaLibraryCard.spec.js index 550ddb4b..d0516c87 100644 --- a/packages/netlify-cms-core/src/components/MediaLibrary/__tests__/MediaLibraryCard.spec.js +++ b/packages/netlify-cms-core/src/components/MediaLibrary/__tests__/MediaLibraryCard.spec.js @@ -1,8 +1,9 @@ import React from 'react'; import { Map } from 'immutable'; -import MediaLibraryCard from '../MediaLibraryCard'; import { render } from '@testing-library/react'; +import MediaLibraryCard from '../MediaLibraryCard'; + describe('MediaLibraryCard', () => { const props = { displayURL: Map({ url: 'url' }), diff --git a/packages/netlify-cms-core/src/components/UI/SettingsDropdown.js b/packages/netlify-cms-core/src/components/UI/SettingsDropdown.js index d8e50288..0df8938a 100644 --- a/packages/netlify-cms-core/src/components/UI/SettingsDropdown.js +++ b/packages/netlify-cms-core/src/components/UI/SettingsDropdown.js @@ -4,6 +4,7 @@ import { css } from '@emotion/core'; import styled from '@emotion/styled'; import { translate } from 'react-polyglot'; import { Icon, Dropdown, DropdownItem, DropdownButton, colors } from 'netlify-cms-ui-default'; + import { stripProtocol } from '../../lib/urlHelper'; const styles = { diff --git a/packages/netlify-cms-core/src/components/UI/__tests__/ErrorBoundary.spec.js b/packages/netlify-cms-core/src/components/UI/__tests__/ErrorBoundary.spec.js index 3783a0bc..caac15f1 100644 --- a/packages/netlify-cms-core/src/components/UI/__tests__/ErrorBoundary.spec.js +++ b/packages/netlify-cms-core/src/components/UI/__tests__/ErrorBoundary.spec.js @@ -1,8 +1,9 @@ import React from 'react'; -import { ErrorBoundary } from '../ErrorBoundary'; import { render } from '@testing-library/react'; import { oneLineTrim } from 'common-tags'; +import { ErrorBoundary } from '../ErrorBoundary'; + function WithError() { throw new Error('Some unknown error'); } diff --git a/packages/netlify-cms-core/src/components/Workflow/Workflow.js b/packages/netlify-cms-core/src/components/Workflow/Workflow.js index 706f9e4d..eaf261fa 100644 --- a/packages/netlify-cms-core/src/components/Workflow/Workflow.js +++ b/packages/netlify-cms-core/src/components/Workflow/Workflow.js @@ -14,6 +14,7 @@ import { components, shadows, } from 'netlify-cms-ui-default'; + import { createNewEntry } from '../../actions/collections'; import { loadUnpublishedEntries, diff --git a/packages/netlify-cms-core/src/components/Workflow/WorkflowList.js b/packages/netlify-cms-core/src/components/Workflow/WorkflowList.js index a1e59703..c24f5293 100644 --- a/packages/netlify-cms-core/src/components/Workflow/WorkflowList.js +++ b/packages/netlify-cms-core/src/components/Workflow/WorkflowList.js @@ -6,6 +6,7 @@ import styled from '@emotion/styled'; import moment from 'moment'; import { translate } from 'react-polyglot'; import { colors, lengths } from 'netlify-cms-ui-default'; + import { status } from '../../constants/publishModes'; import { DragSource, DropTarget, HTML5DragDrop } from '../UI'; import WorkflowCard from './WorkflowCard'; diff --git a/packages/netlify-cms-core/src/constants/__tests__/configSchema.spec.js b/packages/netlify-cms-core/src/constants/__tests__/configSchema.spec.js index 6d6a460d..117e7f09 100644 --- a/packages/netlify-cms-core/src/constants/__tests__/configSchema.spec.js +++ b/packages/netlify-cms-core/src/constants/__tests__/configSchema.spec.js @@ -1,4 +1,5 @@ import { merge } from 'lodash'; + import { validateConfig } from '../configSchema'; jest.mock('../../lib/registry'); diff --git a/packages/netlify-cms-core/src/constants/configSchema.js b/packages/netlify-cms-core/src/constants/configSchema.js index 8ba157ef..31e3711f 100644 --- a/packages/netlify-cms-core/src/constants/configSchema.js +++ b/packages/netlify-cms-core/src/constants/configSchema.js @@ -6,9 +6,10 @@ import { prohibited, } from 'ajv-keywords/dist/keywords'; import ajvErrors from 'ajv-errors'; +import uuid from 'uuid/v4'; + import { formatExtensions, frontmatterFormats, extensionFormatters } from '../formats/formats'; import { getWidgets } from '../lib/registry'; -import uuid from 'uuid/v4'; import { I18N_STRUCTURE, I18N_FIELD } from '../lib/i18n'; const localeType = { type: 'string', minLength: 2, maxLength: 10, pattern: '^[a-zA-Z-_]+$' }; diff --git a/packages/netlify-cms-core/src/formats/__tests__/yaml.spec.js b/packages/netlify-cms-core/src/formats/__tests__/yaml.spec.js index 123bcbdf..bff71d7c 100644 --- a/packages/netlify-cms-core/src/formats/__tests__/yaml.spec.js +++ b/packages/netlify-cms-core/src/formats/__tests__/yaml.spec.js @@ -1,6 +1,7 @@ -import yaml from '../yaml'; import { stripIndent } from 'common-tags'; +import yaml from '../yaml'; + describe('yaml', () => { describe('fromFile', () => { test('loads valid yaml', () => { diff --git a/packages/netlify-cms-core/src/formats/formats.ts b/packages/netlify-cms-core/src/formats/formats.ts index f3c98c41..3508986b 100644 --- a/packages/netlify-cms-core/src/formats/formats.ts +++ b/packages/netlify-cms-core/src/formats/formats.ts @@ -1,10 +1,12 @@ import { List } from 'immutable'; import { get } from 'lodash'; + import yamlFormatter from './yaml'; import tomlFormatter from './toml'; import jsonFormatter from './json'; -import type { Delimiter } from './frontmatter'; import { FrontmatterInfer, frontmatterJSON, frontmatterTOML, frontmatterYAML } from './frontmatter'; + +import type { Delimiter } from './frontmatter'; import type { Collection, EntryObject, Format } from '../types/redux'; import type { EntryValue } from '../valueObjects/Entry'; diff --git a/packages/netlify-cms-core/src/formats/frontmatter.ts b/packages/netlify-cms-core/src/formats/frontmatter.ts index 5865b19d..5c6715ed 100644 --- a/packages/netlify-cms-core/src/formats/frontmatter.ts +++ b/packages/netlify-cms-core/src/formats/frontmatter.ts @@ -1,4 +1,5 @@ import matter from 'gray-matter'; + import tomlFormatter from './toml'; import yamlFormatter from './yaml'; import jsonFormatter from './json'; diff --git a/packages/netlify-cms-core/src/formats/toml.ts b/packages/netlify-cms-core/src/formats/toml.ts index 65745795..a1b8a141 100644 --- a/packages/netlify-cms-core/src/formats/toml.ts +++ b/packages/netlify-cms-core/src/formats/toml.ts @@ -1,6 +1,7 @@ import toml from '@iarna/toml'; import tomlify from 'tomlify-j0.4'; import moment from 'moment'; + import AssetProxy from '../valueObjects/AssetProxy'; import { sortKeys } from './helpers'; diff --git a/packages/netlify-cms-core/src/formats/yaml.ts b/packages/netlify-cms-core/src/formats/yaml.ts index 0979381c..923945b1 100644 --- a/packages/netlify-cms-core/src/formats/yaml.ts +++ b/packages/netlify-cms-core/src/formats/yaml.ts @@ -1,5 +1,7 @@ import yaml from 'yaml'; + import { sortKeys } from './helpers'; + import type { YAMLMap, YAMLSeq, Pair, Node } from 'yaml/types'; function addComments(items: Array, comments: Record, prefix = '') { diff --git a/packages/netlify-cms-core/src/integrations/index.js b/packages/netlify-cms-core/src/integrations/index.js index 3546c7af..9439d874 100644 --- a/packages/netlify-cms-core/src/integrations/index.js +++ b/packages/netlify-cms-core/src/integrations/index.js @@ -1,6 +1,7 @@ +import { Map } from 'immutable'; + import Algolia from './providers/algolia/implementation'; import AssetStore from './providers/assetStore/implementation'; -import { Map } from 'immutable'; export function resolveIntegrations(interationsConfig, getToken) { let integrationInstances = Map({}); diff --git a/packages/netlify-cms-core/src/integrations/providers/algolia/implementation.js b/packages/netlify-cms-core/src/integrations/providers/algolia/implementation.js index b006aa6d..9d4331b3 100644 --- a/packages/netlify-cms-core/src/integrations/providers/algolia/implementation.js +++ b/packages/netlify-cms-core/src/integrations/providers/algolia/implementation.js @@ -1,7 +1,8 @@ import _ from 'lodash'; +import { unsentRequest } from 'netlify-cms-lib-util'; + import { createEntry } from '../../../valueObjects/Entry'; import { selectEntrySlug } from '../../../reducers/collections'; -import { unsentRequest } from 'netlify-cms-lib-util'; const { fetchWithTimeout: fetch } = unsentRequest; diff --git a/packages/netlify-cms-core/src/integrations/providers/assetStore/implementation.js b/packages/netlify-cms-core/src/integrations/providers/assetStore/implementation.js index 9a7e70a0..52929498 100644 --- a/packages/netlify-cms-core/src/integrations/providers/assetStore/implementation.js +++ b/packages/netlify-cms-core/src/integrations/providers/assetStore/implementation.js @@ -1,7 +1,8 @@ import { pickBy, trimEnd } from 'lodash'; -import { addParams } from '../../../lib/urlHelper'; import { unsentRequest } from 'netlify-cms-lib-util'; +import { addParams } from '../../../lib/urlHelper'; + const { fetchWithTimeout: fetch } = unsentRequest; export default class AssetStore { diff --git a/packages/netlify-cms-core/src/lib/__tests__/formatters.spec.js b/packages/netlify-cms-core/src/lib/__tests__/formatters.spec.js index cdb62bc9..283f5d49 100644 --- a/packages/netlify-cms-core/src/lib/__tests__/formatters.spec.js +++ b/packages/netlify-cms-core/src/lib/__tests__/formatters.spec.js @@ -1,4 +1,5 @@ import { List, Map, fromJS } from 'immutable'; + import { commitMessageFormatter, prepareSlug, diff --git a/packages/netlify-cms-core/src/lib/__tests__/i18n.spec.js b/packages/netlify-cms-core/src/lib/__tests__/i18n.spec.js index 984fc6bd..040cfa4b 100644 --- a/packages/netlify-cms-core/src/lib/__tests__/i18n.spec.js +++ b/packages/netlify-cms-core/src/lib/__tests__/i18n.spec.js @@ -1,4 +1,5 @@ import { fromJS } from 'immutable'; + import * as i18n from '../i18n'; jest.mock('../../reducers/collections', () => { diff --git a/packages/netlify-cms-core/src/lib/__tests__/serializeEntryValues.spec.js b/packages/netlify-cms-core/src/lib/__tests__/serializeEntryValues.spec.js index 85c54592..755ce698 100644 --- a/packages/netlify-cms-core/src/lib/__tests__/serializeEntryValues.spec.js +++ b/packages/netlify-cms-core/src/lib/__tests__/serializeEntryValues.spec.js @@ -1,6 +1,7 @@ -import { serializeValues, deserializeValues } from '../serializeEntryValues'; import { fromJS } from 'immutable'; +import { serializeValues, deserializeValues } from '../serializeEntryValues'; + const values = fromJS({ title: 'New Post', unknown: 'Unknown Field' }); const fields = fromJS([{ name: 'title', widget: 'string' }]); diff --git a/packages/netlify-cms-core/src/lib/formatters.ts b/packages/netlify-cms-core/src/lib/formatters.ts index fedac195..369268d6 100644 --- a/packages/netlify-cms-core/src/lib/formatters.ts +++ b/packages/netlify-cms-core/src/lib/formatters.ts @@ -1,18 +1,20 @@ -import type { Map } from 'immutable'; import { flow, partialRight, trimEnd, trimStart } from 'lodash'; -import { sanitizeSlug } from './urlHelper'; import { stringTemplate } from 'netlify-cms-lib-widgets'; +import { stripIndent } from 'common-tags'; + import { selectIdentifier, selectField, selectInferedField, getFileFromSlug, } from '../reducers/collections'; -import type { Collection, CmsConfig, CmsSlug, EntryMap } from '../types/redux'; -import { stripIndent } from 'common-tags'; +import { sanitizeSlug } from './urlHelper'; import { FILES } from '../constants/collectionTypes'; import { COMMIT_AUTHOR, COMMIT_DATE } from '../constants/commitProps'; +import type { Collection, CmsConfig, CmsSlug, EntryMap } from '../types/redux'; +import type { Map } from 'immutable'; + const { compileStringTemplate, parseDateFromEntry, diff --git a/packages/netlify-cms-core/src/lib/i18n.ts b/packages/netlify-cms-core/src/lib/i18n.ts index 49e27b54..cdb112ce 100644 --- a/packages/netlify-cms-core/src/lib/i18n.ts +++ b/packages/netlify-cms-core/src/lib/i18n.ts @@ -1,7 +1,9 @@ import { Map, List } from 'immutable'; import { set, trimEnd, groupBy, escapeRegExp } from 'lodash'; -import type { Collection, Entry, EntryDraft, EntryField, EntryMap } from '../types/redux'; + import { selectEntrySlug } from '../reducers/collections'; + +import type { Collection, Entry, EntryDraft, EntryField, EntryMap } from '../types/redux'; import type { EntryValue } from '../valueObjects/Entry'; export const I18N = 'i18n'; diff --git a/packages/netlify-cms-core/src/lib/phrases.js b/packages/netlify-cms-core/src/lib/phrases.js index 2e98e5a2..0b1f06e7 100644 --- a/packages/netlify-cms-core/src/lib/phrases.js +++ b/packages/netlify-cms-core/src/lib/phrases.js @@ -1,4 +1,5 @@ import { merge } from 'lodash'; + import { getLocale } from './registry'; export function getPhrases(locale) { diff --git a/packages/netlify-cms-core/src/lib/registry.js b/packages/netlify-cms-core/src/lib/registry.js index 84321f35..b3f9056c 100644 --- a/packages/netlify-cms-core/src/lib/registry.js +++ b/packages/netlify-cms-core/src/lib/registry.js @@ -1,6 +1,7 @@ import { Map } from 'immutable'; import produce from 'immer'; import { oneLine } from 'common-tags'; + import EditorComponent from '../valueObjects/EditorComponent'; const allowedEvents = [ diff --git a/packages/netlify-cms-core/src/lib/serializeEntryValues.js b/packages/netlify-cms-core/src/lib/serializeEntryValues.js index e7fd4248..578ffa38 100644 --- a/packages/netlify-cms-core/src/lib/serializeEntryValues.js +++ b/packages/netlify-cms-core/src/lib/serializeEntryValues.js @@ -1,5 +1,6 @@ import { isNil } from 'lodash'; import { Map, List } from 'immutable'; + import { getWidgetValueSerializer } from './registry'; /** diff --git a/packages/netlify-cms-core/src/lib/urlHelper.ts b/packages/netlify-cms-core/src/lib/urlHelper.ts index 81ac3b55..1ffc35d5 100644 --- a/packages/netlify-cms-core/src/lib/urlHelper.ts +++ b/packages/netlify-cms-core/src/lib/urlHelper.ts @@ -3,6 +3,7 @@ import urlJoin from 'url-join'; import diacritics from 'diacritics'; import sanitizeFilename from 'sanitize-filename'; import { isString, escapeRegExp, flow, partialRight } from 'lodash'; + import type { CmsSlug } from '../types/redux'; function getUrl(urlString: string, direct?: boolean) { diff --git a/packages/netlify-cms-core/src/mediaLibrary.ts b/packages/netlify-cms-core/src/mediaLibrary.ts index 94e75b25..461d1928 100644 --- a/packages/netlify-cms-core/src/mediaLibrary.ts +++ b/packages/netlify-cms-core/src/mediaLibrary.ts @@ -3,10 +3,12 @@ * registered via `registerMediaLibrary`. */ import { once } from 'lodash'; + import { getMediaLibrary } from './lib/registry'; import { store } from './redux'; import { configFailed } from './actions/config'; import { createMediaLibrary, insertMedia } from './actions/mediaLibrary'; + import type { MediaLibraryInstance } from './types/redux'; type MediaLibraryOptions = {}; diff --git a/packages/netlify-cms-core/src/reducers/__tests__/collections.spec.js b/packages/netlify-cms-core/src/reducers/__tests__/collections.spec.js index 9bffd826..8c70aa59 100644 --- a/packages/netlify-cms-core/src/reducers/__tests__/collections.spec.js +++ b/packages/netlify-cms-core/src/reducers/__tests__/collections.spec.js @@ -1,4 +1,5 @@ import { fromJS, Map } from 'immutable'; + import { configLoaded } from '../../actions/config'; import collections, { selectAllowDeletion, diff --git a/packages/netlify-cms-core/src/reducers/__tests__/entries.spec.js b/packages/netlify-cms-core/src/reducers/__tests__/entries.spec.js index 02ccc312..45aed7c5 100644 --- a/packages/netlify-cms-core/src/reducers/__tests__/entries.spec.js +++ b/packages/netlify-cms-core/src/reducers/__tests__/entries.spec.js @@ -1,4 +1,5 @@ import { OrderedMap, fromJS } from 'immutable'; + import * as actions from '../../actions/entries'; import reducer, { selectMediaFolder, diff --git a/packages/netlify-cms-core/src/reducers/__tests__/entryDraft.spec.js b/packages/netlify-cms-core/src/reducers/__tests__/entryDraft.spec.js index 9230eefa..15dd8dda 100644 --- a/packages/netlify-cms-core/src/reducers/__tests__/entryDraft.spec.js +++ b/packages/netlify-cms-core/src/reducers/__tests__/entryDraft.spec.js @@ -1,4 +1,5 @@ import { Map, fromJS } from 'immutable'; + import * as actions from '../../actions/entries'; import reducer from '../entryDraft'; diff --git a/packages/netlify-cms-core/src/reducers/__tests__/integrations.spec.ts b/packages/netlify-cms-core/src/reducers/__tests__/integrations.spec.ts index e6eb36f3..3a86f28e 100644 --- a/packages/netlify-cms-core/src/reducers/__tests__/integrations.spec.ts +++ b/packages/netlify-cms-core/src/reducers/__tests__/integrations.spec.ts @@ -1,8 +1,9 @@ import integrations from '../integrations'; -import type { ConfigAction } from '../../actions/config'; import { CONFIG_SUCCESS } from '../../actions/config'; import { FOLDER } from '../../constants/collectionTypes'; +import type { ConfigAction } from '../../actions/config'; + describe('integrations', () => { it('should return default state when no integrations', () => { const result = integrations(null, { diff --git a/packages/netlify-cms-core/src/reducers/__tests__/mediaLibrary.spec.js b/packages/netlify-cms-core/src/reducers/__tests__/mediaLibrary.spec.js index c51398ab..628f0d16 100644 --- a/packages/netlify-cms-core/src/reducers/__tests__/mediaLibrary.spec.js +++ b/packages/netlify-cms-core/src/reducers/__tests__/mediaLibrary.spec.js @@ -1,4 +1,5 @@ import { Map, fromJS } from 'immutable'; + import { mediaDeleted } from '../../actions/mediaLibrary'; import mediaLibrary, { selectMediaFiles, diff --git a/packages/netlify-cms-core/src/reducers/auth.ts b/packages/netlify-cms-core/src/reducers/auth.ts index dcb92ab3..559398a7 100644 --- a/packages/netlify-cms-core/src/reducers/auth.ts +++ b/packages/netlify-cms-core/src/reducers/auth.ts @@ -1,6 +1,5 @@ import { produce } from 'immer'; -import type { User } from 'netlify-cms-lib-util'; -import type { AuthAction } from '../actions/auth'; + import { AUTH_REQUEST, AUTH_SUCCESS, @@ -9,6 +8,9 @@ import { LOGOUT, } from '../actions/auth'; +import type { User } from 'netlify-cms-lib-util'; +import type { AuthAction } from '../actions/auth'; + export type Auth = { isFetching: boolean; user: User | undefined; diff --git a/packages/netlify-cms-core/src/reducers/collections.ts b/packages/netlify-cms-core/src/reducers/collections.ts index 86f2ba3a..3bed5e9c 100644 --- a/packages/netlify-cms-core/src/reducers/collections.ts +++ b/packages/netlify-cms-core/src/reducers/collections.ts @@ -1,12 +1,16 @@ import { List, Set, fromJS, OrderedMap } from 'immutable'; import { get, escapeRegExp } from 'lodash'; +import { stringTemplate } from 'netlify-cms-lib-widgets'; + import consoleError from '../lib/consoleError'; -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 { selectMediaFolder } from './entries'; +import { summaryFormatter } from '../lib/formatters'; + import type { Collection, Collections, @@ -17,9 +21,7 @@ import type { ViewGroup, CmsConfig, } from '../types/redux'; -import { selectMediaFolder } from './entries'; -import { stringTemplate } from 'netlify-cms-lib-widgets'; -import { summaryFormatter } from '../lib/formatters'; +import type { ConfigAction } from '../actions/config'; import type { Backend } from '../backend'; const { keyToPathArray } = stringTemplate; diff --git a/packages/netlify-cms-core/src/reducers/combinedReducer.ts b/packages/netlify-cms-core/src/reducers/combinedReducer.ts index 389e72c4..3bcbeb98 100644 --- a/packages/netlify-cms-core/src/reducers/combinedReducer.ts +++ b/packages/netlify-cms-core/src/reducers/combinedReducer.ts @@ -1,5 +1,6 @@ import { combineReducers } from 'redux'; import { reducer as notifReducer } from 'redux-notifications'; + import reducers from './index'; function createRootReducer() { diff --git a/packages/netlify-cms-core/src/reducers/config.ts b/packages/netlify-cms-core/src/reducers/config.ts index 516f04d1..d98546a4 100644 --- a/packages/netlify-cms-core/src/reducers/config.ts +++ b/packages/netlify-cms-core/src/reducers/config.ts @@ -1,7 +1,9 @@ import { produce } from 'immer'; -import type { ConfigAction } from '../actions/config'; + import { CONFIG_REQUEST, CONFIG_SUCCESS, CONFIG_FAILURE } from '../actions/config'; import { EDITORIAL_WORKFLOW } from '../constants/publishModes'; + +import type { ConfigAction } from '../actions/config'; import type { CmsConfig } from '../types/redux'; const defaultState = { diff --git a/packages/netlify-cms-core/src/reducers/cursors.js b/packages/netlify-cms-core/src/reducers/cursors.js index dd857780..c3f596be 100644 --- a/packages/netlify-cms-core/src/reducers/cursors.js +++ b/packages/netlify-cms-core/src/reducers/cursors.js @@ -1,5 +1,6 @@ import { fromJS } from 'immutable'; import { Cursor } from 'netlify-cms-lib-util'; + import { ENTRIES_SUCCESS, SORT_ENTRIES_SUCCESS, diff --git a/packages/netlify-cms-core/src/reducers/deploys.ts b/packages/netlify-cms-core/src/reducers/deploys.ts index 07f92579..d8113e83 100644 --- a/packages/netlify-cms-core/src/reducers/deploys.ts +++ b/packages/netlify-cms-core/src/reducers/deploys.ts @@ -1,11 +1,13 @@ import { produce } from 'immer'; -import type { DeploysAction } from '../actions/deploys'; + import { DEPLOY_PREVIEW_REQUEST, DEPLOY_PREVIEW_SUCCESS, DEPLOY_PREVIEW_FAILURE, } from '../actions/deploys'; +import type { DeploysAction } from '../actions/deploys'; + export type Deploys = { [key: string]: { isFetching: boolean; diff --git a/packages/netlify-cms-core/src/reducers/editorialWorkflow.ts b/packages/netlify-cms-core/src/reducers/editorialWorkflow.ts index a0e4fc2b..c15b47b3 100644 --- a/packages/netlify-cms-core/src/reducers/editorialWorkflow.ts +++ b/packages/netlify-cms-core/src/reducers/editorialWorkflow.ts @@ -1,5 +1,6 @@ import { Map, List, fromJS } from 'immutable'; import { startsWith } from 'lodash'; + import { EDITORIAL_WORKFLOW } from '../constants/publishModes'; import { UNPUBLISHED_ENTRY_REQUEST, @@ -19,6 +20,7 @@ import { UNPUBLISHED_ENTRY_DELETE_SUCCESS, } from '../actions/editorialWorkflow'; import { CONFIG_SUCCESS } from '../actions/config'; + import type { EditorialWorkflowAction, EditorialWorkflow, Entities } from '../types/redux'; function unpublishedEntries(state = Map(), action: EditorialWorkflowAction) { diff --git a/packages/netlify-cms-core/src/reducers/entries.ts b/packages/netlify-cms-core/src/reducers/entries.ts index 1eae6fe5..5983f774 100644 --- a/packages/netlify-cms-core/src/reducers/entries.ts +++ b/packages/netlify-cms-core/src/reducers/entries.ts @@ -1,5 +1,13 @@ import { Map, List, fromJS, OrderedMap, Set } from 'immutable'; import { dirname, join } from 'path'; +import { isAbsolutePath, basename } from 'netlify-cms-lib-util'; +import { trim, once, sortBy, set, orderBy, groupBy } from 'lodash'; +import { stringTemplate } from 'netlify-cms-lib-widgets'; + +import { SortDirection } from '../types/redux'; +import { folderFormatter } from '../lib/formatters'; +import { selectSortDataPath } from './collections'; +import { SEARCH_ENTRIES_SUCCESS } from '../actions/search'; import { ENTRY_REQUEST, ENTRY_SUCCESS, @@ -19,7 +27,9 @@ import { GROUP_ENTRIES_FAILURE, CHANGE_VIEW_STYLE, } from '../actions/entries'; -import { SEARCH_ENTRIES_SUCCESS } from '../actions/search'; +import { VIEW_STYLE_LIST } from '../constants/collectionViews'; +import { joinUrlPath } from '../lib/urlHelper'; + import type { EntriesAction, EntryRequestPayload, @@ -52,14 +62,6 @@ import type { 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'; -import { selectSortDataPath } from './collections'; -import { stringTemplate } from 'netlify-cms-lib-widgets'; -import { VIEW_STYLE_LIST } from '../constants/collectionViews'; -import { joinUrlPath } from '../lib/urlHelper'; const { keyToPathArray } = stringTemplate; diff --git a/packages/netlify-cms-core/src/reducers/entryDraft.js b/packages/netlify-cms-core/src/reducers/entryDraft.js index 410c16f2..597785d6 100644 --- a/packages/netlify-cms-core/src/reducers/entryDraft.js +++ b/packages/netlify-cms-core/src/reducers/entryDraft.js @@ -1,5 +1,8 @@ import { Map, List, fromJS } from 'immutable'; import uuid from 'uuid/v4'; +import { get } from 'lodash'; +import { join } from 'path'; + import { DRAFT_CREATE_FROM_ENTRY, DRAFT_CREATE_EMPTY, @@ -22,9 +25,7 @@ import { UNPUBLISHED_ENTRY_PERSIST_SUCCESS, UNPUBLISHED_ENTRY_PERSIST_FAILURE, } from '../actions/editorialWorkflow'; -import { get } from 'lodash'; import { selectFolderEntryExtension, selectHasMetaPath } from './collections'; -import { join } from 'path'; import { getDataPath, duplicateI18nFields } from '../lib/i18n'; const initialState = Map({ diff --git a/packages/netlify-cms-core/src/reducers/globalUI.ts b/packages/netlify-cms-core/src/reducers/globalUI.ts index 02094559..4d82b779 100644 --- a/packages/netlify-cms-core/src/reducers/globalUI.ts +++ b/packages/netlify-cms-core/src/reducers/globalUI.ts @@ -1,7 +1,9 @@ -import type { AnyAction } from 'redux'; import { produce } from 'immer'; + import { USE_OPEN_AUTHORING } from '../actions/auth'; +import type { AnyAction } from 'redux'; + export type GlobalUI = { isFetching: boolean; useOpenAuthoring: boolean; diff --git a/packages/netlify-cms-core/src/reducers/index.ts b/packages/netlify-cms-core/src/reducers/index.ts index 5d9cfcc2..3955ace2 100644 --- a/packages/netlify-cms-core/src/reducers/index.ts +++ b/packages/netlify-cms-core/src/reducers/index.ts @@ -1,4 +1,5 @@ import { List } from 'immutable'; + import auth from './auth'; import config from './config'; import integrations, * as fromIntegrations from './integrations'; @@ -13,6 +14,7 @@ import mediaLibrary from './mediaLibrary'; import deploys, * as fromDeploys from './deploys'; import globalUI from './globalUI'; import status from './status'; + import type { Status } from '../constants/publishModes'; import type { State, Collection } from '../types/redux'; diff --git a/packages/netlify-cms-core/src/reducers/integrations.ts b/packages/netlify-cms-core/src/reducers/integrations.ts index 01ae4a0f..b09a5aa8 100644 --- a/packages/netlify-cms-core/src/reducers/integrations.ts +++ b/packages/netlify-cms-core/src/reducers/integrations.ts @@ -1,6 +1,8 @@ import { fromJS } from 'immutable'; -import type { ConfigAction } from '../actions/config'; + import { CONFIG_SUCCESS } from '../actions/config'; + +import type { ConfigAction } from '../actions/config'; import type { Integrations, CmsConfig } from '../types/redux'; interface Acc { diff --git a/packages/netlify-cms-core/src/reducers/mediaLibrary.ts b/packages/netlify-cms-core/src/reducers/mediaLibrary.ts index 43030550..373f27a2 100644 --- a/packages/netlify-cms-core/src/reducers/mediaLibrary.ts +++ b/packages/netlify-cms-core/src/reducers/mediaLibrary.ts @@ -1,6 +1,7 @@ import { Map, List } from 'immutable'; import uuid from 'uuid/v4'; -import type { MediaLibraryAction } from '../actions/mediaLibrary'; +import { dirname } from 'path'; + import { MEDIA_LIBRARY_OPEN, MEDIA_LIBRARY_CLOSE, @@ -22,6 +23,8 @@ import { } from '../actions/mediaLibrary'; import { selectEditingDraft, selectMediaFolder } from './entries'; import { selectIntegration } from './'; + +import type { MediaLibraryAction } from '../actions/mediaLibrary'; import type { State, MediaLibraryInstance, @@ -30,7 +33,6 @@ import type { DisplayURLState, EntryField, } from '../types/redux'; -import { dirname } from 'path'; const defaultState: { isVisible: boolean; diff --git a/packages/netlify-cms-core/src/reducers/medias.ts b/packages/netlify-cms-core/src/reducers/medias.ts index f86fafc2..778692da 100644 --- a/packages/netlify-cms-core/src/reducers/medias.ts +++ b/packages/netlify-cms-core/src/reducers/medias.ts @@ -1,5 +1,5 @@ import { produce } from 'immer'; -import type { MediasAction } from '../actions/media'; + import { ADD_ASSETS, ADD_ASSET, @@ -8,6 +8,8 @@ import { LOAD_ASSET_SUCCESS, LOAD_ASSET_FAILURE, } from '../actions/media'; + +import type { MediasAction } from '../actions/media'; import type AssetProxy from '../valueObjects/AssetProxy'; export type Medias = { diff --git a/packages/netlify-cms-core/src/reducers/search.ts b/packages/netlify-cms-core/src/reducers/search.ts index 125f7f57..9e469cc6 100644 --- a/packages/netlify-cms-core/src/reducers/search.ts +++ b/packages/netlify-cms-core/src/reducers/search.ts @@ -1,6 +1,5 @@ import { produce } from 'immer'; -import type { SearchAction } from '../actions/search'; import { QUERY_FAILURE, QUERY_REQUEST, @@ -10,6 +9,8 @@ import { SEARCH_ENTRIES_REQUEST, SEARCH_ENTRIES_SUCCESS, } from '../actions/search'; + +import type { SearchAction } from '../actions/search'; import type { EntryValue } from '../valueObjects/Entry'; export type Search = { diff --git a/packages/netlify-cms-core/src/reducers/status.ts b/packages/netlify-cms-core/src/reducers/status.ts index 185a185f..cabf74ed 100644 --- a/packages/netlify-cms-core/src/reducers/status.ts +++ b/packages/netlify-cms-core/src/reducers/status.ts @@ -1,7 +1,9 @@ import { produce } from 'immer'; -import type { StatusAction } from '../actions/status'; + import { STATUS_REQUEST, STATUS_SUCCESS, STATUS_FAILURE } from '../actions/status'; +import type { StatusAction } from '../actions/status'; + export type Status = { isFetching: boolean; status: { diff --git a/packages/netlify-cms-core/src/redux/index.ts b/packages/netlify-cms-core/src/redux/index.ts index 4becc6ef..cdb5ff63 100644 --- a/packages/netlify-cms-core/src/redux/index.ts +++ b/packages/netlify-cms-core/src/redux/index.ts @@ -1,10 +1,12 @@ -import type { AnyAction } from 'redux'; import { createStore, applyMiddleware } from 'redux'; import { composeWithDevTools } from 'redux-devtools-extension'; -import type { ThunkMiddleware } from 'redux-thunk'; import thunkMiddleware from 'redux-thunk'; + import { waitUntilAction } from './middleware/waitUntilAction'; import createRootReducer from '../reducers/combinedReducer'; + +import type { ThunkMiddleware } from 'redux-thunk'; +import type { AnyAction } from 'redux'; import type { State } from '../types/redux'; import type { Reducer } from 'react'; diff --git a/packages/netlify-cms-core/src/routing/__tests__/history.spec.ts b/packages/netlify-cms-core/src/routing/__tests__/history.spec.ts index cd936ecd..7caf6756 100644 --- a/packages/netlify-cms-core/src/routing/__tests__/history.spec.ts +++ b/packages/netlify-cms-core/src/routing/__tests__/history.spec.ts @@ -1,7 +1,8 @@ -import type { History } from 'history'; import { createHashHistory } from 'history'; import { mocked } from 'ts-jest/utils'; +import type { History } from 'history'; + jest.mock('history'); const history = { push: jest.fn(), replace: jest.fn() } as unknown as History; diff --git a/packages/netlify-cms-core/src/valueObjects/Entry.ts b/packages/netlify-cms-core/src/valueObjects/Entry.ts index ad9c2748..6507215e 100644 --- a/packages/netlify-cms-core/src/valueObjects/Entry.ts +++ b/packages/netlify-cms-core/src/valueObjects/Entry.ts @@ -1,4 +1,5 @@ import { isBoolean } from 'lodash'; + import type { MediaFile } from '../backend'; interface Options { diff --git a/packages/netlify-cms-core/webpack.config.js b/packages/netlify-cms-core/webpack.config.js index 97a7c793..6dc835fa 100644 --- a/packages/netlify-cms-core/webpack.config.js +++ b/packages/netlify-cms-core/webpack.config.js @@ -1,4 +1,5 @@ const webpack = require('webpack'); + const pkg = require('./package.json'); const { getConfig } = require('../../scripts/webpack.js'); diff --git a/packages/netlify-cms-lib-auth/src/implicit-oauth.js b/packages/netlify-cms-lib-auth/src/implicit-oauth.js index e9966d3f..b62af51a 100644 --- a/packages/netlify-cms-lib-auth/src/implicit-oauth.js +++ b/packages/netlify-cms-lib-auth/src/implicit-oauth.js @@ -1,6 +1,7 @@ import { Map } from 'immutable'; import trim from 'lodash/trim'; import trimEnd from 'lodash/trimEnd'; + import { createNonce, validateNonce, isInsecureProtocol } from './utils'; export default class ImplicitAuthenticator { diff --git a/packages/netlify-cms-lib-auth/src/pkce-oauth.js b/packages/netlify-cms-lib-auth/src/pkce-oauth.js index 29ad47b6..e1eb1fcc 100644 --- a/packages/netlify-cms-lib-auth/src/pkce-oauth.js +++ b/packages/netlify-cms-lib-auth/src/pkce-oauth.js @@ -1,5 +1,6 @@ import trim from 'lodash/trim'; import trimEnd from 'lodash/trimEnd'; + import { createNonce, validateNonce, isInsecureProtocol } from './utils'; async function sha256(text) { diff --git a/packages/netlify-cms-lib-util/src/API.ts b/packages/netlify-cms-lib-util/src/API.ts index 81823f5b..f328cf78 100644 --- a/packages/netlify-cms-lib-util/src/API.ts +++ b/packages/netlify-cms-lib-util/src/API.ts @@ -1,8 +1,9 @@ -import type { AsyncLock } from './asyncLock'; import { asyncLock } from './asyncLock'; import unsentRequest from './unsentRequest'; import APIError from './APIError'; +import type { AsyncLock } from './asyncLock'; + export interface FetchError extends Error { status: number; } diff --git a/packages/netlify-cms-lib-util/src/__tests__/backendUtil.spec.js b/packages/netlify-cms-lib-util/src/__tests__/backendUtil.spec.js index f1ff88c7..2da2fbea 100644 --- a/packages/netlify-cms-lib-util/src/__tests__/backendUtil.spec.js +++ b/packages/netlify-cms-lib-util/src/__tests__/backendUtil.spec.js @@ -1,7 +1,8 @@ -import { parseLinkHeader, getAllResponses, getPathDepth, filterByExtension } from '../backendUtil'; import { oneLine } from 'common-tags'; import nock from 'nock'; +import { parseLinkHeader, getAllResponses, getPathDepth, filterByExtension } from '../backendUtil'; + describe('parseLinkHeader', () => { it('should return the right rel urls', () => { const url = 'https://api.github.com/resource'; diff --git a/packages/netlify-cms-lib-util/src/backendUtil.ts b/packages/netlify-cms-lib-util/src/backendUtil.ts index 3778686c..7e550320 100644 --- a/packages/netlify-cms-lib-util/src/backendUtil.ts +++ b/packages/netlify-cms-lib-util/src/backendUtil.ts @@ -1,6 +1,7 @@ import { flow, fromPairs } from 'lodash'; import { map } from 'lodash/fp'; import { fromJS } from 'immutable'; + import unsentRequest from './unsentRequest'; import APIError from './APIError'; diff --git a/packages/netlify-cms-lib-util/src/git-lfs.ts b/packages/netlify-cms-lib-util/src/git-lfs.ts index 10301a05..1ad54ffb 100644 --- a/packages/netlify-cms-lib-util/src/git-lfs.ts +++ b/packages/netlify-cms-lib-util/src/git-lfs.ts @@ -2,7 +2,9 @@ // Pointer file parsing import { filter, flow, fromPairs, map } from 'lodash/fp'; + import getBlobSHA from './getBlobSHA'; + import type { AssetProxy } from './implementation'; export interface PointerFile { diff --git a/packages/netlify-cms-lib-util/src/implementation.ts b/packages/netlify-cms-lib-util/src/implementation.ts index eb80a8c0..15f908b2 100644 --- a/packages/netlify-cms-lib-util/src/implementation.ts +++ b/packages/netlify-cms-lib-util/src/implementation.ts @@ -1,10 +1,12 @@ -import type { Semaphore } from 'semaphore'; import semaphore from 'semaphore'; import { unionBy, sortBy } from 'lodash'; + +import { basename } from './path'; + +import type { Semaphore } from 'semaphore'; import type Cursor from './Cursor'; import type { AsyncLock } from './asyncLock'; import type { FileMetadata } from './API'; -import { basename } from './path'; export type DisplayURLObject = { id: string; path: string }; diff --git a/packages/netlify-cms-lib-util/src/index.ts b/packages/netlify-cms-lib-util/src/index.ts index a0e3cd45..a5c5c101 100644 --- a/packages/netlify-cms-lib-util/src/index.ts +++ b/packages/netlify-cms-lib-util/src/index.ts @@ -16,26 +16,7 @@ import { } from './backendUtil'; import loadScript from './loadScript'; import getBlobSHA from './getBlobSHA'; -import type { AsyncLock as AL } from './asyncLock'; import { asyncLock } from './asyncLock'; -import type { - Implementation as I, - ImplementationEntry as IE, - UnpublishedEntryDiff as UED, - UnpublishedEntry as UE, - ImplementationMediaFile as IMF, - ImplementationFile as IF, - DisplayURLObject as DUO, - DisplayURL as DU, - Credentials as Cred, - User as U, - Entry as E, - PersistOptions as PO, - AssetProxy as AP, - Config as C, - UnpublishedEntryMediaFile as UEMF, - DataFile as DF, -} from './implementation'; import { entriesByFiles, entriesByFolder, @@ -46,7 +27,6 @@ import { blobToFileObj, allEntriesByFolder, } from './implementation'; -import type { FetchError as FE, ApiRequest as AR } from './API'; import { readFile, readFileMetadata, @@ -68,7 +48,6 @@ import { branchFromContentKey, contentKeyFromBranch, } from './APIUtils'; -import type { PointerFile as PF } from './git-lfs'; import { createPointerFile, getLargeMediaFilteredMediaFiles, @@ -77,6 +56,28 @@ import { getPointerFileForMediaFileObj, } from './git-lfs'; +import type { PointerFile as PF } from './git-lfs'; +import type { FetchError as FE, ApiRequest as AR } from './API'; +import type { + Implementation as I, + ImplementationEntry as IE, + UnpublishedEntryDiff as UED, + UnpublishedEntry as UE, + ImplementationMediaFile as IMF, + ImplementationFile as IF, + DisplayURLObject as DUO, + DisplayURL as DU, + Credentials as Cred, + User as U, + Entry as E, + PersistOptions as PO, + AssetProxy as AP, + Config as C, + UnpublishedEntryMediaFile as UEMF, + DataFile as DF, +} from './implementation'; +import type { AsyncLock as AL } from './asyncLock'; + export type AsyncLock = AL; export type Implementation = I; export type ImplementationEntry = IE; diff --git a/packages/netlify-cms-lib-widgets/src/__tests__/stringTemplate.spec.js b/packages/netlify-cms-lib-widgets/src/__tests__/stringTemplate.spec.js index 350d3232..5d38e242 100644 --- a/packages/netlify-cms-lib-widgets/src/__tests__/stringTemplate.spec.js +++ b/packages/netlify-cms-lib-widgets/src/__tests__/stringTemplate.spec.js @@ -1,4 +1,5 @@ import { fromJS } from 'immutable'; + import { keyToPathArray, compileStringTemplate, diff --git a/packages/netlify-cms-lib-widgets/src/validations.ts b/packages/netlify-cms-lib-widgets/src/validations.ts index fee3b014..4903bc70 100644 --- a/packages/netlify-cms-lib-widgets/src/validations.ts +++ b/packages/netlify-cms-lib-widgets/src/validations.ts @@ -1,4 +1,5 @@ import { isNumber } from 'lodash'; + import type { List } from 'immutable'; export function validateMinMax( diff --git a/packages/netlify-cms-media-library-cloudinary/src/__tests__/index.spec.js b/packages/netlify-cms-media-library-cloudinary/src/__tests__/index.spec.js index b1526ae4..d19038cb 100644 --- a/packages/netlify-cms-media-library-cloudinary/src/__tests__/index.spec.js +++ b/packages/netlify-cms-media-library-cloudinary/src/__tests__/index.spec.js @@ -1,4 +1,5 @@ import { queryHelpers, waitForElement } from '@testing-library/dom'; + import cloudinary from '../index'; describe('cloudinary media library', () => { diff --git a/packages/netlify-cms-media-library-uploadcare/src/__tests__/index.spec.js b/packages/netlify-cms-media-library-uploadcare/src/__tests__/index.spec.js index b2742eab..14a8d26e 100644 --- a/packages/netlify-cms-media-library-uploadcare/src/__tests__/index.spec.js +++ b/packages/netlify-cms-media-library-uploadcare/src/__tests__/index.spec.js @@ -1,8 +1,9 @@ import uuid from 'uuid/v4'; -import uploadcareMediaLibrary from '../index'; import uploadcare from 'uploadcare-widget'; import uploadcareTabEffects from 'uploadcare-widget-tab-effects'; +import uploadcareMediaLibrary from '../index'; + function generateMockUrl({ count = 1, cdnUrl } = {}) { const baseUrl = 'https://ucarecdn.com'; const url = `${baseUrl}/${uuid()}~${count}/`; diff --git a/packages/netlify-cms-proxy-server/src/index.ts b/packages/netlify-cms-proxy-server/src/index.ts index f8173f20..136075de 100644 --- a/packages/netlify-cms-proxy-server/src/index.ts +++ b/packages/netlify-cms-proxy-server/src/index.ts @@ -1,6 +1,7 @@ // eslint-disable-next-line @typescript-eslint/no-var-requires require('dotenv').config(); import express from 'express'; + import { registerCommonMiddlewares } from './middlewares/common'; import { registerMiddleware as registerLocalGit } from './middlewares/localGit'; import { registerMiddleware as registerLocalFs } from './middlewares/localFs'; diff --git a/packages/netlify-cms-proxy-server/src/middlewares.ts b/packages/netlify-cms-proxy-server/src/middlewares.ts index 386e9d3d..bae15c9a 100644 --- a/packages/netlify-cms-proxy-server/src/middlewares.ts +++ b/packages/netlify-cms-proxy-server/src/middlewares.ts @@ -1,9 +1,10 @@ -import type express from 'express'; import { registerCommonMiddlewares } from './middlewares/common'; import { registerMiddleware as localGit } from './middlewares/localGit'; import { registerMiddleware as localFs } from './middlewares/localFs'; import { createLogger } from './logger'; +import type express from 'express'; + type Options = { logLevel?: string; }; diff --git a/packages/netlify-cms-proxy-server/src/middlewares/common/index.ts b/packages/netlify-cms-proxy-server/src/middlewares/common/index.ts index 01c922f6..18ec4c46 100644 --- a/packages/netlify-cms-proxy-server/src/middlewares/common/index.ts +++ b/packages/netlify-cms-proxy-server/src/middlewares/common/index.ts @@ -1,8 +1,9 @@ -import type winston from 'winston'; import express from 'express'; import morgan from 'morgan'; import cors from 'cors'; +import type winston from 'winston'; + export type Options = { logger: winston.Logger; }; diff --git a/packages/netlify-cms-proxy-server/src/middlewares/joi/index.spec.ts b/packages/netlify-cms-proxy-server/src/middlewares/joi/index.spec.ts index b4f68c1f..174789dc 100644 --- a/packages/netlify-cms-proxy-server/src/middlewares/joi/index.spec.ts +++ b/packages/netlify-cms-proxy-server/src/middlewares/joi/index.spec.ts @@ -1,4 +1,5 @@ import { defaultSchema, joi } from '.'; + import type express from 'express'; import type Joi from '@hapi/joi'; diff --git a/packages/netlify-cms-proxy-server/src/middlewares/joi/index.ts b/packages/netlify-cms-proxy-server/src/middlewares/joi/index.ts index 02ee23ca..430816bc 100644 --- a/packages/netlify-cms-proxy-server/src/middlewares/joi/index.ts +++ b/packages/netlify-cms-proxy-server/src/middlewares/joi/index.ts @@ -1,6 +1,7 @@ -import type express from 'express'; import Joi from '@hapi/joi'; +import type express from 'express'; + const allowedActions = [ 'info', 'entriesByFolder', diff --git a/packages/netlify-cms-proxy-server/src/middlewares/localFs/index.spec.ts b/packages/netlify-cms-proxy-server/src/middlewares/localFs/index.spec.ts index 847b35b7..e04a9e51 100644 --- a/packages/netlify-cms-proxy-server/src/middlewares/localFs/index.spec.ts +++ b/packages/netlify-cms-proxy-server/src/middlewares/localFs/index.spec.ts @@ -1,7 +1,8 @@ /* eslint-disable @typescript-eslint/no-var-requires */ -import type Joi from '@hapi/joi'; import { getSchema } from '.'; +import type Joi from '@hapi/joi'; + function assetFailure(result: Joi.ValidationResult, expectedMessage: string) { const { error } = result; expect(error).not.toBeNull(); diff --git a/packages/netlify-cms-proxy-server/src/middlewares/localFs/index.ts b/packages/netlify-cms-proxy-server/src/middlewares/localFs/index.ts index 269ba294..1a608483 100644 --- a/packages/netlify-cms-proxy-server/src/middlewares/localFs/index.ts +++ b/packages/netlify-cms-proxy-server/src/middlewares/localFs/index.ts @@ -1,8 +1,10 @@ -import type winston from 'winston'; -import type express from 'express'; import path from 'path'; + import { defaultSchema, joi } from '../joi'; import { pathTraversal } from '../joi/customValidators'; +import { listRepoFiles, deleteFile, writeFile, move } from '../utils/fs'; +import { entriesFromFiles, readMediaFile } from '../utils/entries'; + import type { EntriesByFolderParams, EntriesByFilesParams, @@ -15,8 +17,8 @@ import type { DeleteFilesParams, DataFile, } from '../types'; -import { listRepoFiles, deleteFile, writeFile, move } from '../utils/fs'; -import { entriesFromFiles, readMediaFile } from '../utils/entries'; +import type express from 'express'; +import type winston from 'winston'; type FsOptions = { repoPath: string; diff --git a/packages/netlify-cms-proxy-server/src/middlewares/localGit/index.spec.ts b/packages/netlify-cms-proxy-server/src/middlewares/localGit/index.spec.ts index d6e28da2..01bea1b1 100644 --- a/packages/netlify-cms-proxy-server/src/middlewares/localGit/index.spec.ts +++ b/packages/netlify-cms-proxy-server/src/middlewares/localGit/index.spec.ts @@ -1,8 +1,10 @@ /* eslint-disable @typescript-eslint/no-var-requires */ +import winston from 'winston'; + +import { validateRepo, getSchema, localGitMiddleware } from '.'; + import type Joi from '@hapi/joi'; import type express from 'express'; -import winston from 'winston'; -import { validateRepo, getSchema, localGitMiddleware } from '.'; jest.mock('netlify-cms-lib-util', () => jest.fn()); jest.mock('simple-git/promise'); diff --git a/packages/netlify-cms-proxy-server/src/middlewares/localGit/index.ts b/packages/netlify-cms-proxy-server/src/middlewares/localGit/index.ts index 84df14c6..9a642aba 100644 --- a/packages/netlify-cms-proxy-server/src/middlewares/localGit/index.ts +++ b/packages/netlify-cms-proxy-server/src/middlewares/localGit/index.ts @@ -1,5 +1,3 @@ -import type winston from 'winston'; -import type express from 'express'; import path from 'path'; import { promises as fs } from 'fs'; import { @@ -12,7 +10,14 @@ import { parseContentKey, } from 'netlify-cms-lib-util/src/APIUtils'; import { parse } from 'what-the-diff'; +import simpleGit from 'simple-git/promise'; +import { Mutex, withTimeout } from 'async-mutex'; + import { defaultSchema, joi } from '../joi'; +import { pathTraversal } from '../joi/customValidators'; +import { listRepoFiles, writeFile, move, deleteFile, getUpdateDate } from '../utils/fs'; +import { entriesFromFiles, readMediaFile } from '../utils/entries'; + import type { EntriesByFolderParams, EntriesByFilesParams, @@ -33,12 +38,8 @@ import type { UnpublishedEntryDataFileParams, UnpublishedEntryMediaFileParams, } from '../types'; -// eslint-disable-next-line import/default -import simpleGit from 'simple-git/promise'; -import { Mutex, withTimeout } from 'async-mutex'; -import { pathTraversal } from '../joi/customValidators'; -import { listRepoFiles, writeFile, move, deleteFile, getUpdateDate } from '../utils/fs'; -import { entriesFromFiles, readMediaFile } from '../utils/entries'; +import type express from 'express'; +import type winston from 'winston'; async function commit(git: simpleGit.SimpleGit, commitMessage: string) { await git.add('.'); diff --git a/packages/netlify-cms-ui-default/src/AuthenticationPage.js b/packages/netlify-cms-ui-default/src/AuthenticationPage.js index 3c2bb551..18568372 100644 --- a/packages/netlify-cms-ui-default/src/AuthenticationPage.js +++ b/packages/netlify-cms-ui-default/src/AuthenticationPage.js @@ -1,6 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import styled from '@emotion/styled'; + import Icon from './Icon'; import { buttons, shadows } from './styles'; import GoBackButton from './GoBackButton'; diff --git a/packages/netlify-cms-ui-default/src/Dropdown.js b/packages/netlify-cms-ui-default/src/Dropdown.js index a0e74753..a1331ddb 100644 --- a/packages/netlify-cms-ui-default/src/Dropdown.js +++ b/packages/netlify-cms-ui-default/src/Dropdown.js @@ -3,6 +3,7 @@ import PropTypes from 'prop-types'; import { css } from '@emotion/core'; import styled from '@emotion/styled'; import { Wrapper, Button as DropdownButton, Menu, MenuItem } from 'react-aria-menubutton'; + import { colors, buttons, components, zIndex } from './styles'; import Icon from './Icon'; diff --git a/packages/netlify-cms-ui-default/src/FieldLabel.js b/packages/netlify-cms-ui-default/src/FieldLabel.js index e8d1a716..fc41c0c1 100644 --- a/packages/netlify-cms-ui-default/src/FieldLabel.js +++ b/packages/netlify-cms-ui-default/src/FieldLabel.js @@ -1,4 +1,5 @@ import styled from '@emotion/styled'; + import { colors, colorsRaw, transitions, text } from './styles'; const stateColors = { diff --git a/packages/netlify-cms-ui-default/src/Icon.js b/packages/netlify-cms-ui-default/src/Icon.js index 0eb68c60..11da3de5 100644 --- a/packages/netlify-cms-ui-default/src/Icon.js +++ b/packages/netlify-cms-ui-default/src/Icon.js @@ -1,6 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import styled from '@emotion/styled'; + import icons from './Icon/icons'; const IconWrapper = styled.span` diff --git a/packages/netlify-cms-ui-default/src/Icon/icons.js b/packages/netlify-cms-ui-default/src/Icon/icons.js index b6fd0a78..7704ff54 100644 --- a/packages/netlify-cms-ui-default/src/Icon/icons.js +++ b/packages/netlify-cms-ui-default/src/Icon/icons.js @@ -1,4 +1,5 @@ import mapValues from 'lodash/mapValues'; + import images from './images/_index'; /** diff --git a/packages/netlify-cms-ui-default/src/IconButton.js b/packages/netlify-cms-ui-default/src/IconButton.js index 29e6549c..1a87e1e7 100644 --- a/packages/netlify-cms-ui-default/src/IconButton.js +++ b/packages/netlify-cms-ui-default/src/IconButton.js @@ -1,5 +1,6 @@ import React from 'react'; import styled from '@emotion/styled'; + import Icon from './Icon'; import { buttons, colors, colorsRaw, shadows } from './styles'; diff --git a/packages/netlify-cms-ui-default/src/ListItemTopBar.js b/packages/netlify-cms-ui-default/src/ListItemTopBar.js index 055c9461..209876b7 100644 --- a/packages/netlify-cms-ui-default/src/ListItemTopBar.js +++ b/packages/netlify-cms-ui-default/src/ListItemTopBar.js @@ -1,6 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import styled from '@emotion/styled'; + import Icon from './Icon'; import { colors, lengths, buttons } from './styles'; diff --git a/packages/netlify-cms-ui-default/src/Loader.js b/packages/netlify-cms-ui-default/src/Loader.js index 66e13949..2b2b9f88 100644 --- a/packages/netlify-cms-ui-default/src/Loader.js +++ b/packages/netlify-cms-ui-default/src/Loader.js @@ -3,6 +3,7 @@ import PropTypes from 'prop-types'; import styled from '@emotion/styled'; import { css, keyframes } from '@emotion/core'; import { CSSTransition } from 'react-transition-group'; + import { colors, zIndex } from './styles'; const styles = { diff --git a/packages/netlify-cms-ui-default/src/ObjectWidgetTopBar.js b/packages/netlify-cms-ui-default/src/ObjectWidgetTopBar.js index 5b8d025c..ddc00d67 100644 --- a/packages/netlify-cms-ui-default/src/ObjectWidgetTopBar.js +++ b/packages/netlify-cms-ui-default/src/ObjectWidgetTopBar.js @@ -2,10 +2,11 @@ import React from 'react'; import PropTypes from 'prop-types'; import styled from '@emotion/styled'; import { css } from '@emotion/core'; +import ImmutablePropTypes from 'react-immutable-proptypes'; + import Icon from './Icon'; import { colors, buttons } from './styles'; import Dropdown, { StyledDropdownButton, DropdownItem } from './Dropdown'; -import ImmutablePropTypes from 'react-immutable-proptypes'; const TopBarContainer = styled.div` align-items: center; diff --git a/packages/netlify-cms-ui-default/src/Toggle.js b/packages/netlify-cms-ui-default/src/Toggle.js index ec9bdb97..1296c9e2 100644 --- a/packages/netlify-cms-ui-default/src/Toggle.js +++ b/packages/netlify-cms-ui-default/src/Toggle.js @@ -3,6 +3,7 @@ import PropTypes from 'prop-types'; import styled from '@emotion/styled'; import { css } from '@emotion/core'; import ReactToggled from 'react-toggled'; + import { colors, colorsRaw, shadows, transitions } from './styles'; const ToggleContainer = styled.button` diff --git a/packages/netlify-cms-widget-code/src/CodeControl.js b/packages/netlify-cms-widget-code/src/CodeControl.js index 08a4d2e3..ad5b0d27 100644 --- a/packages/netlify-cms-widget-code/src/CodeControl.js +++ b/packages/netlify-cms-widget-code/src/CodeControl.js @@ -12,6 +12,7 @@ import 'codemirror/keymap/sublime'; import 'codemirror/keymap/emacs'; import codeMirrorStyles from 'codemirror/lib/codemirror.css'; import materialTheme from 'codemirror/theme/material.css'; + import SettingsPane from './SettingsPane'; import SettingsButton from './SettingsButton'; import languageData from '../data/languages.json'; diff --git a/packages/netlify-cms-widget-code/src/SettingsPane.js b/packages/netlify-cms-widget-code/src/SettingsPane.js index 04df5f6c..c683afd9 100644 --- a/packages/netlify-cms-widget-code/src/SettingsPane.js +++ b/packages/netlify-cms-widget-code/src/SettingsPane.js @@ -3,6 +3,7 @@ import styled from '@emotion/styled'; import Select from 'react-select'; import isHotkey from 'is-hotkey'; import { text, shadows, zIndex } from 'netlify-cms-ui-default'; + import SettingsButton from './SettingsButton'; import languageSelectStyles from './languageSelectStyles'; diff --git a/packages/netlify-cms-widget-date/src/DateControl.js b/packages/netlify-cms-widget-date/src/DateControl.js index 953daf51..4ca31959 100644 --- a/packages/netlify-cms-widget-date/src/DateControl.js +++ b/packages/netlify-cms-widget-date/src/DateControl.js @@ -4,7 +4,6 @@ import { css } from '@emotion/core'; import reactDateTimeStyles from 'react-datetime/css/react-datetime.css'; import DateTime from 'react-datetime'; import moment from 'moment'; - import { once } from 'lodash'; import { oneLine } from 'common-tags'; diff --git a/packages/netlify-cms-widget-image/src/index.js b/packages/netlify-cms-widget-image/src/index.js index 48822017..2c34c221 100644 --- a/packages/netlify-cms-widget-image/src/index.js +++ b/packages/netlify-cms-widget-image/src/index.js @@ -1,4 +1,5 @@ import NetlifyCmsWidgetFile from 'netlify-cms-widget-file'; + import previewComponent from './ImagePreview'; import schema from './schema'; diff --git a/packages/netlify-cms-widget-list/src/ListControl.js b/packages/netlify-cms-widget-list/src/ListControl.js index e1bf47c6..23e6075f 100644 --- a/packages/netlify-cms-widget-list/src/ListControl.js +++ b/packages/netlify-cms-widget-list/src/ListControl.js @@ -8,14 +8,15 @@ import { partial, isEmpty } from 'lodash'; import uuid from 'uuid/v4'; import { SortableContainer, SortableElement, SortableHandle } from 'react-sortable-hoc'; import NetlifyCmsWidgetObject from 'netlify-cms-widget-object'; +import { ListItemTopBar, ObjectWidgetTopBar, colors, lengths } from 'netlify-cms-ui-default'; +import { stringTemplate, validations } from 'netlify-cms-lib-widgets'; + import { TYPES_KEY, getTypedFieldForValue, resolveFieldKeyType, getErrorMessageForTypedFieldAndValue, } from './typedListHelpers'; -import { ListItemTopBar, ObjectWidgetTopBar, colors, lengths } from 'netlify-cms-ui-default'; -import { stringTemplate, validations } from 'netlify-cms-lib-widgets'; function valueToString(value) { return value ? value.join(',').replace(/,([^\s]|$)/g, ', $1') : ''; diff --git a/packages/netlify-cms-widget-list/src/__tests__/ListControl.spec.js b/packages/netlify-cms-widget-list/src/__tests__/ListControl.spec.js index aed14b58..4db5680d 100644 --- a/packages/netlify-cms-widget-list/src/__tests__/ListControl.spec.js +++ b/packages/netlify-cms-widget-list/src/__tests__/ListControl.spec.js @@ -1,6 +1,7 @@ import React from 'react'; import { fireEvent, render } from '@testing-library/react'; import { fromJS } from 'immutable'; + import ListControl from '../ListControl'; jest.mock('netlify-cms-widget-object', () => { diff --git a/packages/netlify-cms-widget-list/src/index.js b/packages/netlify-cms-widget-list/src/index.js index dd8b03f6..57524dd7 100644 --- a/packages/netlify-cms-widget-list/src/index.js +++ b/packages/netlify-cms-widget-list/src/index.js @@ -1,5 +1,6 @@ -import controlComponent from './ListControl'; import NetlifyCmsWidgetObject from 'netlify-cms-widget-object'; + +import controlComponent from './ListControl'; import schema from './schema'; const previewComponent = NetlifyCmsWidgetObject.previewComponent; diff --git a/packages/netlify-cms-widget-markdown/src/MarkdownControl/RawEditor.js b/packages/netlify-cms-widget-markdown/src/MarkdownControl/RawEditor.js index 34c020e4..6cf84527 100644 --- a/packages/netlify-cms-widget-markdown/src/MarkdownControl/RawEditor.js +++ b/packages/netlify-cms-widget-markdown/src/MarkdownControl/RawEditor.js @@ -9,6 +9,7 @@ import { Editor as Slate, setEventTransfer } from 'slate-react'; import Plain from 'slate-plain-serializer'; import isHotkey from 'is-hotkey'; import { lengths, fonts } from 'netlify-cms-ui-default'; + import { markdownToHtml } from '../serializers'; import { editorStyleVars, EditorControlBar } from '../styles'; import Toolbar from './Toolbar'; diff --git a/packages/netlify-cms-widget-markdown/src/MarkdownControl/Toolbar.js b/packages/netlify-cms-widget-markdown/src/MarkdownControl/Toolbar.js index 5378fb34..fc887ec3 100644 --- a/packages/netlify-cms-widget-markdown/src/MarkdownControl/Toolbar.js +++ b/packages/netlify-cms-widget-markdown/src/MarkdownControl/Toolbar.js @@ -13,6 +13,7 @@ import { transitions, lengths, } from 'netlify-cms-ui-default'; + import ToolbarButton from './ToolbarButton'; const ToolbarContainer = styled.div` diff --git a/packages/netlify-cms-widget-markdown/src/MarkdownControl/VisualEditor.js b/packages/netlify-cms-widget-markdown/src/MarkdownControl/VisualEditor.js index 4f2b99fd..64c5b0aa 100644 --- a/packages/netlify-cms-widget-markdown/src/MarkdownControl/VisualEditor.js +++ b/packages/netlify-cms-widget-markdown/src/MarkdownControl/VisualEditor.js @@ -8,6 +8,7 @@ import { get, isEmpty, debounce } from 'lodash'; import { Value, Document, Block, Text } from 'slate'; import { Editor as Slate } from 'slate-react'; import { lengths, fonts, zIndex } from 'netlify-cms-ui-default'; + import { editorStyleVars, EditorControlBar } from '../styles'; import { slateToMarkdown, markdownToSlate } from '../serializers'; import Toolbar from '../MarkdownControl/Toolbar'; diff --git a/packages/netlify-cms-widget-markdown/src/MarkdownControl/__tests__/VisualEditor.spec.js b/packages/netlify-cms-widget-markdown/src/MarkdownControl/__tests__/VisualEditor.spec.js index 4b370c11..22905368 100644 --- a/packages/netlify-cms-widget-markdown/src/MarkdownControl/__tests__/VisualEditor.spec.js +++ b/packages/netlify-cms-widget-markdown/src/MarkdownControl/__tests__/VisualEditor.spec.js @@ -1,4 +1,5 @@ import { Map, fromJS } from 'immutable'; + import { mergeMediaConfig } from '../VisualEditor'; describe('VisualEditor', () => { diff --git a/packages/netlify-cms-widget-markdown/src/MarkdownControl/__tests__/slate.spec.js b/packages/netlify-cms-widget-markdown/src/MarkdownControl/__tests__/slate.spec.js index 4649bef6..2c4dc853 100644 --- a/packages/netlify-cms-widget-markdown/src/MarkdownControl/__tests__/slate.spec.js +++ b/packages/netlify-cms-widget-markdown/src/MarkdownControl/__tests__/slate.spec.js @@ -1,7 +1,8 @@ /** @jsx h */ -import h from '../../../test-helpers/h'; import { Editor } from 'slate'; + +import h from '../../../test-helpers/h'; import plugins from '../plugins/visual'; import schema from '../schema'; diff --git a/packages/netlify-cms-widget-markdown/src/MarkdownControl/components/Shortcode.js b/packages/netlify-cms-widget-markdown/src/MarkdownControl/components/Shortcode.js index 47c00f50..256f4ac3 100644 --- a/packages/netlify-cms-widget-markdown/src/MarkdownControl/components/Shortcode.js +++ b/packages/netlify-cms-widget-markdown/src/MarkdownControl/components/Shortcode.js @@ -3,6 +3,7 @@ import React from 'react'; import { css } from '@emotion/core'; import { Map, fromJS } from 'immutable'; import { omit } from 'lodash'; + import { getEditorControl, getEditorComponents } from '../index'; export default class Shortcode extends React.Component { diff --git a/packages/netlify-cms-widget-markdown/src/MarkdownControl/index.js b/packages/netlify-cms-widget-markdown/src/MarkdownControl/index.js index 87d58a22..06408d90 100644 --- a/packages/netlify-cms-widget-markdown/src/MarkdownControl/index.js +++ b/packages/netlify-cms-widget-markdown/src/MarkdownControl/index.js @@ -1,9 +1,10 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; +import { List } from 'immutable'; + import RawEditor from './RawEditor'; import VisualEditor from './VisualEditor'; -import { List } from 'immutable'; const MODE_STORAGE_KEY = 'cms.md-mode'; diff --git a/packages/netlify-cms-widget-markdown/src/MarkdownControl/plugins/CopyPasteVisual.js b/packages/netlify-cms-widget-markdown/src/MarkdownControl/plugins/CopyPasteVisual.js index afc3eb00..78f63e7b 100644 --- a/packages/netlify-cms-widget-markdown/src/MarkdownControl/plugins/CopyPasteVisual.js +++ b/packages/netlify-cms-widget-markdown/src/MarkdownControl/plugins/CopyPasteVisual.js @@ -2,6 +2,7 @@ import { Document } from 'slate'; import { setEventTransfer } from 'slate-react'; import base64 from 'slate-base64-serializer'; import isHotkey from 'is-hotkey'; + import { slateToMarkdown, markdownToSlate, htmlToSlate, markdownToHtml } from '../../serializers'; function CopyPasteVisual({ getAsset, resolveWidget }) { diff --git a/packages/netlify-cms-widget-markdown/src/MarkdownControl/plugins/List.js b/packages/netlify-cms-widget-markdown/src/MarkdownControl/plugins/List.js index 76a33b5f..c47b68ee 100644 --- a/packages/netlify-cms-widget-markdown/src/MarkdownControl/plugins/List.js +++ b/packages/netlify-cms-widget-markdown/src/MarkdownControl/plugins/List.js @@ -2,6 +2,7 @@ import { List } from 'immutable'; import { castArray, throttle, get } from 'lodash'; import { Range, Block } from 'slate'; import isHotkey from 'is-hotkey'; + import { assertType } from './util'; function ListPlugin({ defaultType, unorderedListType, orderedListType }) { diff --git a/packages/netlify-cms-widget-markdown/src/MarkdownControl/plugins/visual.js b/packages/netlify-cms-widget-markdown/src/MarkdownControl/plugins/visual.js index 28f6ece7..99b605c5 100644 --- a/packages/netlify-cms-widget-markdown/src/MarkdownControl/plugins/visual.js +++ b/packages/netlify-cms-widget-markdown/src/MarkdownControl/plugins/visual.js @@ -1,5 +1,6 @@ //import { Text, Inline } from 'slate'; import isHotkey from 'is-hotkey'; + import CommandsAndQueries from './CommandsAndQueries'; import ListPlugin from './List'; import LineBreak from './LineBreak'; diff --git a/packages/netlify-cms-widget-markdown/src/MarkdownControl/renderers.js b/packages/netlify-cms-widget-markdown/src/MarkdownControl/renderers.js index 2a5d3bd8..57fe1818 100644 --- a/packages/netlify-cms-widget-markdown/src/MarkdownControl/renderers.js +++ b/packages/netlify-cms-widget-markdown/src/MarkdownControl/renderers.js @@ -3,6 +3,7 @@ import React from 'react'; import { css } from '@emotion/core'; import styled from '@emotion/styled'; import { colors, lengths } from 'netlify-cms-ui-default'; + import VoidBlock from './components/VoidBlock'; import Shortcode from './components/Shortcode'; diff --git a/packages/netlify-cms-widget-markdown/src/MarkdownPreview.js b/packages/netlify-cms-widget-markdown/src/MarkdownPreview.js index 8f73c56d..b519f6f7 100644 --- a/packages/netlify-cms-widget-markdown/src/MarkdownPreview.js +++ b/packages/netlify-cms-widget-markdown/src/MarkdownPreview.js @@ -1,8 +1,9 @@ import React from 'react'; import PropTypes from 'prop-types'; import { WidgetPreviewContainer } from 'netlify-cms-ui-default'; -import { markdownToHtml } from './serializers'; import DOMPurify from 'dompurify'; + +import { markdownToHtml } from './serializers'; class MarkdownPreview extends React.Component { static propTypes = { getAsset: PropTypes.func.isRequired, diff --git a/packages/netlify-cms-widget-markdown/src/__tests__/renderer.spec.js b/packages/netlify-cms-widget-markdown/src/__tests__/renderer.spec.js index 48d4192c..079adced 100644 --- a/packages/netlify-cms-widget-markdown/src/__tests__/renderer.spec.js +++ b/packages/netlify-cms-widget-markdown/src/__tests__/renderer.spec.js @@ -2,6 +2,7 @@ import React from 'react'; import { create, act } from 'react-test-renderer'; import { padStart } from 'lodash'; import { Map } from 'immutable'; + import MarkdownPreview from '../MarkdownPreview'; import { markdownToHtml } from '../serializers'; diff --git a/packages/netlify-cms-widget-markdown/src/serializers/__tests__/commonmark.spec.js b/packages/netlify-cms-widget-markdown/src/serializers/__tests__/commonmark.spec.js index 1bc79524..59988210 100644 --- a/packages/netlify-cms-widget-markdown/src/serializers/__tests__/commonmark.spec.js +++ b/packages/netlify-cms-widget-markdown/src/serializers/__tests__/commonmark.spec.js @@ -1,6 +1,7 @@ import { flow } from 'lodash'; import { tests as commonmarkSpec } from 'commonmark-spec'; import * as commonmark from 'commonmark'; + import { markdownToSlate, slateToMarkdown } from '../index.js'; const skips = [ diff --git a/packages/netlify-cms-widget-markdown/src/serializers/__tests__/index.spec.js b/packages/netlify-cms-widget-markdown/src/serializers/__tests__/index.spec.js index c45f0d11..0605de95 100644 --- a/packages/netlify-cms-widget-markdown/src/serializers/__tests__/index.spec.js +++ b/packages/netlify-cms-widget-markdown/src/serializers/__tests__/index.spec.js @@ -1,5 +1,6 @@ import path from 'path'; import fs from 'fs'; + import { markdownToSlate, htmlToSlate } from '../'; describe('markdownToSlate', () => { diff --git a/packages/netlify-cms-widget-markdown/src/serializers/__tests__/remarkAllowHtmlEntities.spec.js b/packages/netlify-cms-widget-markdown/src/serializers/__tests__/remarkAllowHtmlEntities.spec.js index da9a6906..844137f0 100644 --- a/packages/netlify-cms-widget-markdown/src/serializers/__tests__/remarkAllowHtmlEntities.spec.js +++ b/packages/netlify-cms-widget-markdown/src/serializers/__tests__/remarkAllowHtmlEntities.spec.js @@ -1,5 +1,6 @@ import unified from 'unified'; import markdownToRemark from 'remark-parse'; + import remarkAllowHtmlEntities from '../remarkAllowHtmlEntities'; function process(markdown) { diff --git a/packages/netlify-cms-widget-markdown/src/serializers/__tests__/remarkAssertParents.spec.js b/packages/netlify-cms-widget-markdown/src/serializers/__tests__/remarkAssertParents.spec.js index 3ab404dd..e2dfa358 100644 --- a/packages/netlify-cms-widget-markdown/src/serializers/__tests__/remarkAssertParents.spec.js +++ b/packages/netlify-cms-widget-markdown/src/serializers/__tests__/remarkAssertParents.spec.js @@ -1,4 +1,5 @@ import u from 'unist-builder'; + import remarkAssertParents from '../remarkAssertParents'; const transform = remarkAssertParents(); diff --git a/packages/netlify-cms-widget-markdown/src/serializers/__tests__/remarkEscapeMarkdownEntities.spec.js b/packages/netlify-cms-widget-markdown/src/serializers/__tests__/remarkEscapeMarkdownEntities.spec.js index 6b666e6b..37ff0a85 100644 --- a/packages/netlify-cms-widget-markdown/src/serializers/__tests__/remarkEscapeMarkdownEntities.spec.js +++ b/packages/netlify-cms-widget-markdown/src/serializers/__tests__/remarkEscapeMarkdownEntities.spec.js @@ -1,5 +1,6 @@ import unified from 'unified'; import u from 'unist-builder'; + import remarkEscapeMarkdownEntities from '../remarkEscapeMarkdownEntities'; function process(text) { diff --git a/packages/netlify-cms-widget-markdown/src/serializers/__tests__/remarkPaddedLinks.spec.js b/packages/netlify-cms-widget-markdown/src/serializers/__tests__/remarkPaddedLinks.spec.js index 5955ab6c..0d5cf4ab 100644 --- a/packages/netlify-cms-widget-markdown/src/serializers/__tests__/remarkPaddedLinks.spec.js +++ b/packages/netlify-cms-widget-markdown/src/serializers/__tests__/remarkPaddedLinks.spec.js @@ -1,6 +1,7 @@ import unified from 'unified'; import markdownToRemark from 'remark-parse'; import remarkToMarkdown from 'remark-stringify'; + import remarkPaddedLinks from '../remarkPaddedLinks'; function input(markdown) { diff --git a/packages/netlify-cms-widget-markdown/src/serializers/__tests__/remarkStripTrailingBreaks.spec.js b/packages/netlify-cms-widget-markdown/src/serializers/__tests__/remarkStripTrailingBreaks.spec.js index ecf0a8d9..67ff12b9 100644 --- a/packages/netlify-cms-widget-markdown/src/serializers/__tests__/remarkStripTrailingBreaks.spec.js +++ b/packages/netlify-cms-widget-markdown/src/serializers/__tests__/remarkStripTrailingBreaks.spec.js @@ -1,5 +1,6 @@ import unified from 'unified'; import u from 'unist-builder'; + import remarkStripTrailingBreaks from '../remarkStripTrailingBreaks'; function process(children) { diff --git a/packages/netlify-cms-widget-markdown/src/serializers/__tests__/slate.spec.js b/packages/netlify-cms-widget-markdown/src/serializers/__tests__/slate.spec.js index 62617039..87c66455 100644 --- a/packages/netlify-cms-widget-markdown/src/serializers/__tests__/slate.spec.js +++ b/packages/netlify-cms-widget-markdown/src/serializers/__tests__/slate.spec.js @@ -1,6 +1,7 @@ /** @jsx h */ import { flow } from 'lodash'; + import h from '../../../test-helpers/h'; import { markdownToSlate, slateToMarkdown } from '../index'; diff --git a/packages/netlify-cms-widget-markdown/src/serializers/index.js b/packages/netlify-cms-widget-markdown/src/serializers/index.js index 0c4e2a71..c9155099 100644 --- a/packages/netlify-cms-widget-markdown/src/serializers/index.js +++ b/packages/netlify-cms-widget-markdown/src/serializers/index.js @@ -7,6 +7,7 @@ import remarkToRehype from 'remark-rehype'; import rehypeToHtml from 'rehype-stringify'; import htmlToRehype from 'rehype-parse'; import rehypeToRemark from 'rehype-remark'; + import remarkToRehypeShortcodes from './remarkRehypeShortcodes'; import rehypePaperEmoji from './rehypePaperEmoji'; import remarkAssertParents from './remarkAssertParents'; diff --git a/packages/netlify-cms-widget-markdown/src/serializers/remarkEscapeMarkdownEntities.js b/packages/netlify-cms-widget-markdown/src/serializers/remarkEscapeMarkdownEntities.js index 52956ce4..31a2e119 100644 --- a/packages/netlify-cms-widget-markdown/src/serializers/remarkEscapeMarkdownEntities.js +++ b/packages/netlify-cms-widget-markdown/src/serializers/remarkEscapeMarkdownEntities.js @@ -1,4 +1,5 @@ import { has, flow, partial, map } from 'lodash'; + import { joinPatternSegments, combinePatterns, replaceWhen } from '../regexHelper'; /** diff --git a/packages/netlify-cms-widget-number/src/__tests__/number.spec.js b/packages/netlify-cms-widget-number/src/__tests__/number.spec.js index b4ad8770..1823d02b 100644 --- a/packages/netlify-cms-widget-number/src/__tests__/number.spec.js +++ b/packages/netlify-cms-widget-number/src/__tests__/number.spec.js @@ -1,6 +1,7 @@ import React from 'react'; import { fromJS } from 'immutable'; import { render, fireEvent } from '@testing-library/react'; + import { NetlifyCmsWidgetNumber } from '../'; import { validateMinMax } from '../NumberControl'; diff --git a/packages/netlify-cms-widget-relation/src/__tests__/relation.spec.js b/packages/netlify-cms-widget-relation/src/__tests__/relation.spec.js index c341bff1..40cc5cf8 100644 --- a/packages/netlify-cms-widget-relation/src/__tests__/relation.spec.js +++ b/packages/netlify-cms-widget-relation/src/__tests__/relation.spec.js @@ -1,6 +1,7 @@ import React from 'react'; import { fromJS } from 'immutable'; import { render, fireEvent, waitFor } from '@testing-library/react'; + import { NetlifyCmsWidgetRelation } from '../'; jest.mock('react-window', () => { diff --git a/packages/netlify-cms-widget-select/src/__tests__/select.spec.js b/packages/netlify-cms-widget-select/src/__tests__/select.spec.js index 59474b92..da990152 100644 --- a/packages/netlify-cms-widget-select/src/__tests__/select.spec.js +++ b/packages/netlify-cms-widget-select/src/__tests__/select.spec.js @@ -1,6 +1,7 @@ import React from 'react'; import { fromJS, List } from 'immutable'; import { render, fireEvent } from '@testing-library/react'; + import { NetlifyCmsWidgetSelect } from '../'; const SelectControl = NetlifyCmsWidgetSelect.controlComponent; diff --git a/packages/netlify-cms/src/extensions.js b/packages/netlify-cms/src/extensions.js index 5d114b25..d11f0b75 100644 --- a/packages/netlify-cms/src/extensions.js +++ b/packages/netlify-cms/src/extensions.js @@ -1,5 +1,4 @@ import { NetlifyCmsApp as CMS } from 'netlify-cms-app/dist/esm'; - // Media libraries import uploadcare from 'netlify-cms-media-library-uploadcare'; import cloudinary from 'netlify-cms-media-library-cloudinary'; diff --git a/packages/netlify-cms/webpack.config.js b/packages/netlify-cms/webpack.config.js index b0773376..1b2415d9 100644 --- a/packages/netlify-cms/webpack.config.js +++ b/packages/netlify-cms/webpack.config.js @@ -3,6 +3,7 @@ require('dotenv').config({ path: path.join(__dirname, '..', '..', '.env') }); const webpack = require('webpack'); const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin'); const CopyWebpackPlugin = require('copy-webpack-plugin'); + const pkg = require('./package.json'); const { getConfig, plugins } = require('../../scripts/webpack'); const baseWebpackConfig = getConfig({ baseOnly: true }); diff --git a/scripts/webpack.js b/scripts/webpack.js index 06a03905..d3a1b9fc 100644 --- a/scripts/webpack.js +++ b/scripts/webpack.js @@ -2,6 +2,7 @@ const path = require('path'); const webpack = require('webpack'); const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin'); const { flatMap } = require('lodash'); + const { toGlobalName, externals } = require('./externals'); const pkg = require(path.join(process.cwd(), 'package.json')); diff --git a/website/gatsby-config.js b/website/gatsby-config.js index de3ea719..f3d1f481 100644 --- a/website/gatsby-config.js +++ b/website/gatsby-config.js @@ -1,7 +1,8 @@ -const pkg = require('./package.json'); const fs = require('fs'); const yaml = require('js-yaml'); +const pkg = require('./package.json'); + const staticConfig = yaml.load(fs.readFileSync('./site.yml', 'utf8')); module.exports = { diff --git a/website/src/cms/cms.js b/website/src/cms/cms.js index 5f81250a..8ab45069 100644 --- a/website/src/cms/cms.js +++ b/website/src/cms/cms.js @@ -4,6 +4,7 @@ import dayjs from 'dayjs'; import Prism from 'prismjs'; import { CacheProvider } from '@emotion/core'; import createCache from '@emotion/cache'; + import BlogPostTemplate from '../components/blog-post-template'; import { LayoutTemplate as Layout } from '../components/layout'; import DocsTemplate from '../components/docs-template'; diff --git a/website/src/components/community-channels-list.js b/website/src/components/community-channels-list.js index 00fe5a8a..5b8b22b7 100644 --- a/website/src/components/community-channels-list.js +++ b/website/src/components/community-channels-list.js @@ -1,5 +1,6 @@ import React from 'react'; import styled from '@emotion/styled'; + import theme from '../theme'; const StyledCommunityChannelsList = styled.ul` diff --git a/website/src/components/community.js b/website/src/components/community.js index 69b5dfe6..c6a0c1c4 100644 --- a/website/src/components/community.js +++ b/website/src/components/community.js @@ -1,5 +1,6 @@ import React from 'react'; import { css } from '@emotion/core'; + import Markdownify from './markdownify'; import PageHero from './page-hero'; import HeroTitle from './hero-title'; diff --git a/website/src/components/event-box.js b/website/src/components/event-box.js index 00fae3b7..24b1abc3 100644 --- a/website/src/components/event-box.js +++ b/website/src/components/event-box.js @@ -3,7 +3,6 @@ import moment from 'moment'; import styled from '@emotion/styled'; import Markdownify from './markdownify'; - import theme from '../theme'; const Root = styled.div` diff --git a/website/src/components/footer.js b/website/src/components/footer.js index bb60e863..3d249699 100644 --- a/website/src/components/footer.js +++ b/website/src/components/footer.js @@ -2,7 +2,6 @@ import React from 'react'; import styled from '@emotion/styled'; import Container from './container'; - import theme from '../theme'; import { mq } from '../utils'; diff --git a/website/src/components/header.js b/website/src/components/header.js index 1b16d712..ef9a5d6f 100644 --- a/website/src/components/header.js +++ b/website/src/components/header.js @@ -2,15 +2,13 @@ import React, { useState, useEffect } from 'react'; import { Link, graphql, StaticQuery } from 'gatsby'; import styled from '@emotion/styled'; import { css } from '@emotion/core'; - import GitHubButton from 'react-github-btn'; + import Container from './container'; import Notifications from './notifications'; import DocSearch from './docsearch'; - import logo from '../img/netlify-cms-logo.svg'; import searchIcon from '../img/search.svg'; - import theme from '../theme'; import { mq } from '../utils'; diff --git a/website/src/components/hero-title.js b/website/src/components/hero-title.js index 0d844121..f7bf9e32 100644 --- a/website/src/components/hero-title.js +++ b/website/src/components/hero-title.js @@ -1,4 +1,5 @@ import styled from '@emotion/styled'; + import theme from '../theme'; import { mq } from '../utils'; diff --git a/website/src/components/home-section.js b/website/src/components/home-section.js index eb97c251..1080c8b7 100644 --- a/website/src/components/home-section.js +++ b/website/src/components/home-section.js @@ -3,7 +3,6 @@ import styled from '@emotion/styled'; import Container from './container'; import Page from './page'; - import theme from '../theme'; const Header = styled.header` diff --git a/website/src/components/layout.js b/website/src/components/layout.js index 312e26ea..3bbba7f8 100644 --- a/website/src/components/layout.js +++ b/website/src/components/layout.js @@ -2,6 +2,7 @@ import React from 'react'; import { Helmet } from 'react-helmet'; import { graphql, StaticQuery } from 'gatsby'; import { ThemeProvider } from 'emotion-theming'; + import Header from './header'; import Footer from './footer'; import GlobalStyles from '../global-styles'; diff --git a/website/src/components/notifications.js b/website/src/components/notifications.js index 825e30f8..479aad3e 100644 --- a/website/src/components/notifications.js +++ b/website/src/components/notifications.js @@ -1,4 +1,5 @@ import React from 'react'; + import Notification from './notification'; function Notifications({ notifications }) { diff --git a/website/src/components/page-hero.js b/website/src/components/page-hero.js index cbb0c597..dd12e271 100644 --- a/website/src/components/page-hero.js +++ b/website/src/components/page-hero.js @@ -2,7 +2,6 @@ import React from 'react'; import { css } from '@emotion/core'; import Container from './container'; - import theme from '../theme'; import { mq } from '../utils'; diff --git a/website/src/components/sidebar-layout.js b/website/src/components/sidebar-layout.js index 29f3465e..6cbae740 100644 --- a/website/src/components/sidebar-layout.js +++ b/website/src/components/sidebar-layout.js @@ -1,9 +1,9 @@ import React from 'react'; import { css } from '@emotion/core'; +import styled from '@emotion/styled'; import Page from './page'; import { mq } from '../utils'; -import styled from '@emotion/styled'; const Children = styled.div` overflow: auto; diff --git a/website/src/components/video-embed.js b/website/src/components/video-embed.js index 43028d28..e122b83d 100644 --- a/website/src/components/video-embed.js +++ b/website/src/components/video-embed.js @@ -2,7 +2,6 @@ import React, { useState } from 'react'; import styled from '@emotion/styled'; import theme from '../theme'; - import screenshotEditor from '../img/screenshot-editor.jpg'; const VideoLink = styled.a` diff --git a/website/src/components/widgets.js b/website/src/components/widgets.js index e527ec66..a8883d7b 100644 --- a/website/src/components/widgets.js +++ b/website/src/components/widgets.js @@ -3,7 +3,6 @@ import styled from '@emotion/styled'; import WidgetDoc from './widget-doc'; import Button from './button'; - import theme from '../theme'; const WidgetsNav = styled.nav` diff --git a/website/src/html.js b/website/src/html.js index bbeb40b1..8f78553d 100644 --- a/website/src/html.js +++ b/website/src/html.js @@ -1,4 +1,5 @@ import React from 'react'; + import ChatButton from './components/chat-button'; class HTML extends React.Component { diff --git a/website/src/pages/blog.js b/website/src/pages/blog.js index 24e77969..f5d58bb0 100644 --- a/website/src/pages/blog.js +++ b/website/src/pages/blog.js @@ -8,7 +8,6 @@ import Container from '../components/container'; import MetaInfo from '../components/meta-info'; import Page from '../components/page'; import Lead from '../components/lead'; - import theme from '../theme'; function Blog({ data }) { diff --git a/website/src/pages/index.js b/website/src/pages/index.js index afec6232..b0f670b8 100644 --- a/website/src/pages/index.js +++ b/website/src/pages/index.js @@ -13,7 +13,6 @@ import Lead from '../components/lead'; import Features from '../components/features'; import HomeSection from '../components/home-section'; import Grid from '../components/grid'; - import theme from '../theme'; import { mq } from '../utils';