diff --git a/package.json b/package.json index a3fbf917..4a6e16bb 100644 --- a/package.json +++ b/package.json @@ -119,7 +119,7 @@ "nock": "^11.0.0", "node-fetch": "^2.3.0", "npm-run-all": "^4.1.5", - "prettier": "1.18.2", + "prettier": "^1.19.1", "react-test-renderer": "^16.8.4", "rimraf": "^3.0.0", "simple-git": "^1.124.0", diff --git a/packages/netlify-cms-backend-github/src/API.js b/packages/netlify-cms-backend-github/src/API.js index 3833330a..dda46fa4 100644 --- a/packages/netlify-cms-backend-github/src/API.js +++ b/packages/netlify-cms-backend-github/src/API.js @@ -627,9 +627,11 @@ export default class API { const metadata = await this.retrieveMetadata(contentKey); // mark media files to remove const metadataMediaFiles = get(metadata, 'objects.files', []); - const mediaFilesToRemove = differenceBy(metadataMediaFiles, mediaFilesList, 'path').map( - file => ({ ...file, remove: true }), - ); + const mediaFilesToRemove = differenceBy( + metadataMediaFiles, + mediaFilesList, + 'path', + ).map(file => ({ ...file, remove: true })); const branchData = await this.getBranch(branchName); const changeTree = await this.updateTree( branchData.commit.sha, 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 136d3fc9..5b3e98f6 100644 --- a/packages/netlify-cms-core/src/actions/__tests__/entries.spec.js +++ b/packages/netlify-cms-core/src/actions/__tests__/entries.spec.js @@ -57,7 +57,10 @@ describe('entries', () => { { name: 'images', widget: 'list', - fields: [{ name: 'title', widget: 'text' }, { name: 'url', widget: 'text' }], + fields: [ + { name: 'title', widget: 'text' }, + { name: 'url', widget: 'text' }, + ], }, ]); expect(createEmptyDraftData(fields)).toEqual({}); @@ -95,7 +98,10 @@ describe('entries', () => { { name: 'post', widget: 'object', - fields: [{ name: 'title', widget: 'text' }, { name: 'url', widget: 'text' }], + fields: [ + { name: 'title', widget: 'text' }, + { name: 'url', widget: 'text' }, + ], }, ]); expect(createEmptyDraftData(fields)).toEqual({}); diff --git a/packages/netlify-cms-core/src/backend.js b/packages/netlify-cms-core/src/backend.js index 02a62dee..b06318b4 100644 --- a/packages/netlify-cms-core/src/backend.js +++ b/packages/netlify-cms-core/src/backend.js @@ -407,9 +407,10 @@ export class Backend { const { raw, path, mediaFiles = [], assets = [] } = backup; const label = selectFileEntryLabel(collection, slug); - const entry = this.entryWithFormat(collection, slug)( - createEntry(collection.get('name'), slug, path, { raw, label }), - ); + const entry = this.entryWithFormat( + collection, + slug, + )(createEntry(collection.get('name'), slug, path, { raw, label })); return { entry, mediaFiles, assets }; } @@ -446,7 +447,10 @@ export class Backend { const path = selectEntryPath(collection, slug); const label = selectFileEntryLabel(collection, slug); return this.implementation.getEntry(collection, slug, path).then(loadedEntry => - this.entryWithFormat(collection, slug)( + this.entryWithFormat( + collection, + slug, + )( createEntry(collection.get('name'), slug, loadedEntry.file.path, { raw: loadedEntry.data, label, diff --git a/packages/netlify-cms-core/src/components/App/App.js b/packages/netlify-cms-core/src/components/App/App.js index a27b0a16..2a57a5f9 100644 --- a/packages/netlify-cms-core/src/components/App/App.js +++ b/packages/netlify-cms-core/src/components/App/App.js @@ -237,9 +237,4 @@ const mapDispatchToProps = { logoutUser, }; -export default hot(module)( - connect( - mapStateToProps, - mapDispatchToProps, - )(translate()(App)), -); +export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(translate()(App))); 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 9ddb46be..41018e99 100644 --- a/packages/netlify-cms-core/src/components/Collection/Entries/EntriesCollection.js +++ b/packages/netlify-cms-core/src/components/Collection/Entries/EntriesCollection.js @@ -83,7 +83,4 @@ const mapDispatchToProps = { traverseCollectionCursor: actionTraverseCollectionCursor, }; -export default connect( - mapStateToProps, - mapDispatchToProps, -)(EntriesCollection); +export default connect(mapStateToProps, mapDispatchToProps)(EntriesCollection); 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 674d29b0..a40e72ef 100644 --- a/packages/netlify-cms-core/src/components/Collection/Entries/EntriesSearch.js +++ b/packages/netlify-cms-core/src/components/Collection/Entries/EntriesSearch.js @@ -83,7 +83,4 @@ const mapDispatchToProps = { clearSearch: actionClearSearch, }; -export default connect( - mapStateToProps, - mapDispatchToProps, -)(EntriesSearch); +export default connect(mapStateToProps, mapDispatchToProps)(EntriesSearch); diff --git a/packages/netlify-cms-core/src/components/Editor/Editor.js b/packages/netlify-cms-core/src/components/Editor/Editor.js index eb5094c0..71003dce 100644 --- a/packages/netlify-cms-core/src/components/Editor/Editor.js +++ b/packages/netlify-cms-core/src/components/Editor/Editor.js @@ -464,26 +464,23 @@ function mapStateToProps(state, ownProps) { }; } -export default connect( - mapStateToProps, - { - changeDraftField, - changeDraftFieldValidation, - loadEntry, - loadEntries, - loadDeployPreview, - loadLocalBackup, - retrieveLocalBackup, - persistLocalBackup, - deleteLocalBackup, - createDraftFromEntry, - createEmptyDraft, - discardDraft, - persistEntry, - deleteEntry, - updateUnpublishedEntryStatus, - publishUnpublishedEntry, - deleteUnpublishedEntry, - logoutUser, - }, -)(withWorkflow(translate()(Editor))); +export default connect(mapStateToProps, { + changeDraftField, + changeDraftFieldValidation, + loadEntry, + loadEntries, + loadDeployPreview, + loadLocalBackup, + retrieveLocalBackup, + persistLocalBackup, + deleteLocalBackup, + createDraftFromEntry, + createEmptyDraft, + discardDraft, + persistEntry, + deleteEntry, + updateUnpublishedEntryStatus, + publishUnpublishedEntry, + deleteUnpublishedEntry, + logoutUser, +})(withWorkflow(translate()(Editor))); 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 81acd968..44ebd8fb 100644 --- a/packages/netlify-cms-core/src/components/Editor/EditorControlPane/EditorControl.js +++ b/packages/netlify-cms-core/src/components/Editor/EditorControlPane/EditorControl.js @@ -325,11 +325,8 @@ const mapDispatchToProps = { clearFieldErrors, }; -const ConnectedEditorControl = connect( - mapStateToProps, - mapDispatchToProps, - null, - { withRef: false }, -)(translate()(EditorControl)); +const ConnectedEditorControl = connect(mapStateToProps, mapDispatchToProps, null, { + withRef: false, +})(translate()(EditorControl)); export default ConnectedEditorControl; diff --git a/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibrary.js b/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibrary.js index 794ad6d7..743a85ff 100644 --- a/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibrary.js +++ b/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibrary.js @@ -348,7 +348,4 @@ const mapDispatchToProps = { closeMediaLibrary: closeMediaLibraryAction, }; -export default connect( - mapStateToProps, - mapDispatchToProps, -)(translate()(MediaLibrary)); +export default connect(mapStateToProps, mapDispatchToProps)(translate()(MediaLibrary)); diff --git a/packages/netlify-cms-core/src/components/Workflow/Workflow.js b/packages/netlify-cms-core/src/components/Workflow/Workflow.js index 83fcaa6b..a3bbdec4 100644 --- a/packages/netlify-cms-core/src/components/Workflow/Workflow.js +++ b/packages/netlify-cms-core/src/components/Workflow/Workflow.js @@ -156,12 +156,9 @@ function mapStateToProps(state) { return returnObj; } -export default connect( - mapStateToProps, - { - loadUnpublishedEntries, - updateUnpublishedEntryStatus, - publishUnpublishedEntry, - deleteUnpublishedEntry, - }, -)(translate()(Workflow)); +export default connect(mapStateToProps, { + loadUnpublishedEntries, + updateUnpublishedEntryStatus, + publishUnpublishedEntry, + deleteUnpublishedEntry, +})(translate()(Workflow)); diff --git a/packages/netlify-cms-core/src/lib/serializeEntryValues.js b/packages/netlify-cms-core/src/lib/serializeEntryValues.js index 1b1b4070..dca2a343 100644 --- a/packages/netlify-cms-core/src/lib/serializeEntryValues.js +++ b/packages/netlify-cms-core/src/lib/serializeEntryValues.js @@ -35,7 +35,10 @@ const runSerializer = (values, fields, method) => { // Call recursively for fields within lists if (nestedFields && List.isList(value)) { - return acc.set(fieldName, value.map(val => runSerializer(val, nestedFields, method))); + return acc.set( + fieldName, + value.map(val => runSerializer(val, nestedFields, method)), + ); } // Call recursively for fields within objects 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 8ee7e7ab..68205dc2 100644 --- a/packages/netlify-cms-core/src/reducers/__tests__/entries.spec.js +++ b/packages/netlify-cms-core/src/reducers/__tests__/entries.spec.js @@ -21,7 +21,10 @@ describe('entries', () => { }); it('should handle loaded entries', () => { - const entries = [{ slug: 'a', path: '' }, { slug: 'b', title: 'B' }]; + const entries = [ + { slug: 'a', path: '' }, + { slug: 'b', title: 'B' }, + ]; expect( reducer(initialState, actions.entriesLoaded(Map({ name: 'posts' }), entries, 0)), ).toEqual( diff --git a/packages/netlify-cms-core/src/valueObjects/AssetProxy.js b/packages/netlify-cms-core/src/valueObjects/AssetProxy.js index 0f655030..97735907 100644 --- a/packages/netlify-cms-core/src/valueObjects/AssetProxy.js +++ b/packages/netlify-cms-core/src/valueObjects/AssetProxy.js @@ -51,13 +51,11 @@ export function createAssetProxy(value, fileObj, uploaded = false, privateUpload currentBackend(state.config).getToken, integration, ); - return provider - .upload(fileObj, privateUpload) - .then( - response => - new AssetProxy(response.asset.url.replace(/^(https?):/, ''), null, true, response.asset), - () => new AssetProxy(value, fileObj, false), - ); + return provider.upload(fileObj, privateUpload).then( + response => + new AssetProxy(response.asset.url.replace(/^(https?):/, ''), null, true, response.asset), + () => new AssetProxy(value, fileObj, false), + ); } else if (privateUpload) { throw new Error('The Private Upload option is only available for Asset Store Integration'); } diff --git a/packages/netlify-cms-lib-auth/src/implicit-oauth.js b/packages/netlify-cms-lib-auth/src/implicit-oauth.js index e3f473d0..a4518aea 100644 --- a/packages/netlify-cms-lib-auth/src/implicit-oauth.js +++ b/packages/netlify-cms-lib-auth/src/implicit-oauth.js @@ -30,7 +30,8 @@ export default class ImplicitAuthenticator { document.location.protocol !== 'https:' && // TODO: Is insecure localhost a bad idea as well? I don't think it is, since you are not actually // sending the token over the internet in this case, assuming the auth URL is secure. - (document.location.hostname !== 'localhost' && document.location.hostname !== '127.0.0.1') + document.location.hostname !== 'localhost' && + document.location.hostname !== '127.0.0.1' ) { return cb(new Error('Cannot authenticate over insecure protocol!')); } diff --git a/packages/netlify-cms-widget-markdown/src/MarkdownControl/keys.js b/packages/netlify-cms-widget-markdown/src/MarkdownControl/keys.js index d1494f39..69fa7f2a 100644 --- a/packages/netlify-cms-widget-markdown/src/MarkdownControl/keys.js +++ b/packages/netlify-cms-widget-markdown/src/MarkdownControl/keys.js @@ -38,7 +38,12 @@ function onKeyDown(event, change) { .collapseToStartOf(newBlock); } - const marks = [['b', 'bold'], ['i', 'italic'], ['s', 'strikethrough'], ['`', 'code']]; + const marks = [ + ['b', 'bold'], + ['i', 'italic'], + ['s', 'strikethrough'], + ['`', 'code'], + ]; const [, markName] = marks.find(([key]) => isHotkey(`mod+${key}`, event)) || []; diff --git a/yarn.lock b/yarn.lock index 23591242..e128619f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10126,10 +10126,10 @@ prelude-ls@~1.1.2: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= -prettier@1.18.2: - version "1.18.2" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea" - integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw== +prettier@^1.19.1: + version "1.19.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb" + integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew== pretty-format@^24.0.0, pretty-format@^24.3.0, pretty-format@^24.7.0, pretty-format@^24.9.0: version "24.9.0"