From ab963bcdb7b2427a66d18bf10d2fa646af7fa108 Mon Sep 17 00:00:00 2001 From: Suneil Nyamathi Date: Mon, 6 Nov 2023 09:32:45 -0800 Subject: [PATCH 1/4] Update .babelrc --- site/.babelrc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/site/.babelrc b/site/.babelrc index e2971e13..a901d71b 100644 --- a/site/.babelrc +++ b/site/.babelrc @@ -1,9 +1,5 @@ { "presets": ["@babel/preset-env", "@babel/preset-react"], - "plugins": [ - "@babel/plugin-proposal-class-properties", - "@babel/plugin-proposal-object-rest-spread" - ], "env": { "test": { "plugins": ["istanbul"] From cea44aa15dfea1daff915d90fa8ab0817a3a2d37 Mon Sep 17 00:00:00 2001 From: Suneil Nyamathi Date: Mon, 6 Nov 2023 09:33:39 -0800 Subject: [PATCH 2/4] Update package.json --- site/package.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/site/package.json b/site/package.json index eb8d205f..df1d990d 100644 --- a/site/package.json +++ b/site/package.json @@ -47,8 +47,6 @@ "superagent": "^3.8.3" }, "devDependencies": { - "@babel/plugin-proposal-class-properties": "^7.18.6", - "@babel/plugin-proposal-object-rest-spread": "^7.20.7", "@istanbuljs/nyc-config-babel": "^3.0.0", "babel-eslint": "^10.0.0", "babel-loader": "^8.2.2", From ee20ea590df5a46fb628d1d550df2a0ba1b59c65 Mon Sep 17 00:00:00 2001 From: Suneil Nyamathi Date: Mon, 6 Nov 2023 09:38:01 -0800 Subject: [PATCH 3/4] Update .npmrc --- .npmrc | 1 + 1 file changed, 1 insertion(+) diff --git a/.npmrc b/.npmrc index c1ca392f..30ad7fde 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1,2 @@ +legacy-peer-deps = true package-lock = false From 396d44467cebba412b0636739c1bba45a4103fad Mon Sep 17 00:00:00 2001 From: Suneil Nyamathi Date: Mon, 6 Nov 2023 17:43:15 +0000 Subject: [PATCH 4/4] fix prettier issues --- examples/chat/app.js | 2 +- examples/chat/client.js | 2 +- examples/chat/components/MessageSection.js | 2 +- examples/chat/components/ThreadSection.js | 2 +- examples/chat/configs/routes.js | 4 +- examples/chat/server.js | 4 +- .../src/RandomNumberGenerator.js | 2 +- .../browser-only/browser-only.js | 2 +- .../fluxible-router/components/Application.js | 4 +- examples/fluxible-router/components/Page.js | 2 +- examples/fluxible-router/server.js | 4 +- examples/minimal/src/RandomNumberGenerator.js | 2 +- examples/react-router/client.js | 4 +- examples/react-router/components/Page.js | 2 +- examples/react-router/server.js | 10 +- examples/stale-props/src/Item.js | 2 +- examples/stale-props/src/index.js | 2 +- examples/todo/actions/toggleAll.js | 2 +- examples/todo/app.js | 2 +- examples/todo/assets/todomvc-common/base.css | 19 ++- examples/todo/components/TodoApp.js | 2 +- examples/todo/components/TodoItem.js | 2 +- examples/todo/server.js | 4 +- examples/todo/services/todo.js | 54 +++++--- packages/dispatchr/addons/BaseStore.js | 2 +- packages/dispatchr/addons/createStore.js | 2 +- packages/dispatchr/lib/Action.js | 4 +- packages/dispatchr/lib/Dispatcher.js | 12 +- packages/dispatchr/lib/DispatcherContext.js | 50 ++++---- .../tests/unit/lib/Dispatcher.test.js | 24 ++-- packages/dispatchr/utils/BaseStore.js | 2 +- packages/dispatchr/utils/createStore.js | 2 +- packages/dispatchr/utils/index.js | 2 +- .../src/FluxibleComponentContext.js | 2 +- .../src/FluxibleProvider.js | 2 +- .../src/connectToStores.js | 8 +- .../src/createElementWithContext.js | 2 +- .../src/provideContext.js | 2 +- .../tests/unit/lib/FluxibleComponent.test.js | 4 +- .../unit/lib/FluxibleComponentContext.test.js | 4 +- .../unit/lib/batchedUpdatePlugin.test.js | 2 +- .../tests/unit/lib/connectToStores.test.js | 16 +-- .../tests/unit/lib/provideContext.test.js | 6 +- .../tests/unit/lib/useFluxible.test.js | 2 +- .../tests/unit/lib/withFluxible.test.js | 2 +- .../src/components/ActionTree.jsx | 14 +-- .../src/lib/devtools-plugin.js | 8 +- .../tests/unit/lib/devtools-plugin.test.js | 66 +++++----- .../lib/fetchr-plugin.js | 4 +- .../tests/unit/lib/fetchr-plugin.test.js | 24 ++-- .../utils/MockServiceManager.js | 2 +- .../lib/createReducerStore.js | 10 +- packages/fluxible-router/src/History.js | 2 +- packages/fluxible-router/src/RouteStore.js | 4 +- .../src/createNavLinkComponent.js | 8 +- packages/fluxible-router/src/handleHistory.js | 8 +- packages/fluxible-router/src/handleRoute.js | 6 +- .../fluxible-router/src/navigateAction.js | 8 +- .../tests/mocks/MockAppComponent.js | 2 +- .../fluxible-router/tests/mocks/mockWindow.js | 4 +- .../tests/unit/History.test.js | 2 +- .../tests/unit/HistoryWithHash.test.js | 8 +- .../tests/unit/NavLink.test.js | 30 ++--- .../tests/unit/RouteStore.test.js | 6 +- .../tests/unit/handleHistory.test.js | 118 +++++++++--------- .../tests/unit/navigateAction.test.js | 98 +++++++-------- packages/fluxible/lib/Fluxible.js | 8 +- packages/fluxible/lib/FluxibleContext.js | 54 ++++---- .../fixtures/plugins/TestApplicationPlugin.js | 2 +- .../plugins/TestApplicationPluginPromise.js | 2 +- .../plugins/TestApplicationPluginSync.js | 2 +- .../tests/unit/lib/FluxibleContext.test.js | 76 +++++------ .../utils/createMockActionContext.test.js | 7 +- .../tests/unit/utils/promiseCallback.test.js | 8 +- packages/fluxible/utils/MockActionContext.js | 2 +- .../fluxible/utils/MockComponentContext.js | 2 +- packages/fluxible/utils/callAction.js | 2 +- packages/fluxible/utils/promiseCallback.js | 2 +- packages/generator-fluxible/app/index.js | 6 +- .../app/templates/components/Application.js | 6 +- .../app/templates/server.js | 4 +- .../tests/unit/test-app.test.js | 2 +- site/Gruntfile.js | 22 ++-- site/assets/css/base.css | 9 +- site/client.js | 2 +- site/components/Application.js | 4 +- site/components/Doc.js | 2 +- site/components/Docs.js | 2 +- site/components/Html.js | 2 +- site/components/Menu.js | 6 +- site/server.js | 6 +- site/services/docs.js | 12 +- site/tests/unit/actions/loadIndex.js | 2 +- site/tests/unit/actions/showDoc.js | 2 +- site/tests/unit/configs/routes.js | 6 +- site/utils/assets.js | 11 +- 96 files changed, 511 insertions(+), 483 deletions(-) diff --git a/examples/chat/app.js b/examples/chat/app.js index edb43e74..41b744ac 100644 --- a/examples/chat/app.js +++ b/examples/chat/app.js @@ -14,7 +14,7 @@ var app = new Fluxible({ app.plug( fetchrPlugin({ xhrPath: '/api', - }) + }), ); app.registerStore(require('./stores/RouteStore')); diff --git a/examples/chat/client.js b/examples/chat/client.js index 1c0cf864..42e90e4d 100644 --- a/examples/chat/client.js +++ b/examples/chat/client.js @@ -40,7 +40,7 @@ app.rehydrate(dehydratedState, function (err, context) { }, function (err) { throw err; - } + }, ); }, 1000); } diff --git a/examples/chat/components/MessageSection.js b/examples/chat/components/MessageSection.js index 7921f7b0..ad92911a 100644 --- a/examples/chat/components/MessageSection.js +++ b/examples/chat/components/MessageSection.js @@ -60,5 +60,5 @@ module.exports = connectToStores( (context) => ({ messages: context.getStore(MessageStore).getAllForCurrentThread(), thread: context.getStore(ThreadStore).getCurrent(), - }) + }), ); diff --git a/examples/chat/components/ThreadSection.js b/examples/chat/components/ThreadSection.js index 4372832d..4855e3d9 100644 --- a/examples/chat/components/ThreadSection.js +++ b/examples/chat/components/ThreadSection.js @@ -47,5 +47,5 @@ module.exports = connectToStores( currentThreadID: context.getStore(ThreadStore).getCurrentID(), threads: context.getStore(ThreadStore).getAllChrono(), unreadCount: context.getStore(UnreadThreadStore).getCount(), - }) + }), ); diff --git a/examples/chat/configs/routes.js b/examples/chat/configs/routes.js index 31b295af..ff47b297 100644 --- a/examples/chat/configs/routes.js +++ b/examples/chat/configs/routes.js @@ -23,9 +23,9 @@ module.exports = { { threadID: threadID }, function () { done(); - } + }, ); - } + }, ); }, }, diff --git a/examples/chat/server.js b/examples/chat/server.js index 36644c7f..90d7a47c 100644 --- a/examples/chat/server.js +++ b/examples/chat/server.js @@ -46,7 +46,7 @@ function renderPage(req, res, context) { React.createElement(HtmlComponent, { state: exposed, markup: mainMarkup, - }) + }), ); debug('Sending markup'); @@ -78,7 +78,7 @@ server.use(function (req, res, next) { return; } renderPage(req, res, context); - } + }, ); } }); diff --git a/examples/create-react-app/src/RandomNumberGenerator.js b/examples/create-react-app/src/RandomNumberGenerator.js index 1111e8a2..892fc030 100644 --- a/examples/create-react-app/src/RandomNumberGenerator.js +++ b/examples/create-react-app/src/RandomNumberGenerator.js @@ -18,5 +18,5 @@ export default connectToStores( (context) => ({ number: context.getStore(AppStore).getNumber(), setRandomNumber: () => context.executeAction(actions.setRandomNumber), - }) + }), ); diff --git a/examples/fluxible-router/browser-only/browser-only.js b/examples/fluxible-router/browser-only/browser-only.js index c7a3cb2d..d81ec870 100644 --- a/examples/fluxible-router/browser-only/browser-only.js +++ b/examples/fluxible-router/browser-only/browser-only.js @@ -35,6 +35,6 @@ app.rehydrate(dehydratedState, (err, context) => { window.context = context; bootstrapDebug('React Rendering'); render(createElementWithContext(context, {}), mountNode); - } + }, ); }); diff --git a/examples/fluxible-router/components/Application.js b/examples/fluxible-router/components/Application.js index d0db4516..ef3df730 100644 --- a/examples/fluxible-router/components/Application.js +++ b/examples/fluxible-router/components/Application.js @@ -32,6 +32,6 @@ export default provideContext( connectToStores(Application, [ApplicationStore], (context) => ({ ...context.getStore(ApplicationStore).getState(), })), - { enableScroll: false } - ) + { enableScroll: false }, + ), ); diff --git a/examples/fluxible-router/components/Page.js b/examples/fluxible-router/components/Page.js index f0627c05..0a3fc801 100644 --- a/examples/fluxible-router/components/Page.js +++ b/examples/fluxible-router/components/Page.js @@ -9,5 +9,5 @@ import { connectToStores } from 'fluxible-addons-react'; const Page = ({ content }) =>

{content}

; export default connectToStores(Page, [PageStore], (context) => - context.getStore(PageStore).getState() + context.getStore(PageStore).getState(), ); diff --git a/examples/fluxible-router/server.js b/examples/fluxible-router/server.js index 323972d6..ef617fbb 100644 --- a/examples/fluxible-router/server.js +++ b/examples/fluxible-router/server.js @@ -37,7 +37,7 @@ server.use((req, res, next) => { const state = 'window.App=' + serialize(app.dehydrate(context)) + ';'; const markup = ReactDOM.renderToString( - createElementWithContext(context) + createElementWithContext(context), ); const helmet = Helmet.renderStatic(); @@ -48,7 +48,7 @@ server.use((req, res, next) => { markup, helmet, context: context.getComponentContext(), - }) + }), ); debug('Sending markup'); diff --git a/examples/minimal/src/RandomNumberGenerator.js b/examples/minimal/src/RandomNumberGenerator.js index 1111e8a2..892fc030 100644 --- a/examples/minimal/src/RandomNumberGenerator.js +++ b/examples/minimal/src/RandomNumberGenerator.js @@ -18,5 +18,5 @@ export default connectToStores( (context) => ({ number: context.getStore(AppStore).getNumber(), setRandomNumber: () => context.executeAction(actions.setRandomNumber), - }) + }), ); diff --git a/examples/react-router/client.js b/examples/react-router/client.js index f420ef31..66831dc4 100644 --- a/examples/react-router/client.js +++ b/examples/react-router/client.js @@ -25,12 +25,12 @@ function RenderApp(context) { React.createElement(ReactRouter.Router, { routes: context.getComponent(), history: ReactRouter.browserHistory, - }) + }), ), mountNode, function () { bootstrapDebug('React Rendered'); - } + }, ); } diff --git a/examples/react-router/components/Page.js b/examples/react-router/components/Page.js index 516eb570..e1d44c24 100644 --- a/examples/react-router/components/Page.js +++ b/examples/react-router/components/Page.js @@ -20,7 +20,7 @@ class Page extends React.Component { } Page = connectToStores(Page, [PageStore], (context) => - context.getStore(PageStore).getState() + context.getStore(PageStore).getState(), ); export default Page; diff --git a/examples/react-router/server.js b/examples/react-router/server.js index 47b8e63d..ae31d4e5 100644 --- a/examples/react-router/server.js +++ b/examples/react-router/server.js @@ -34,7 +34,7 @@ server.use(function (req, res, next) { } else if (redirectLocation) { res.redirect( 302, - redirectLocation.pathname + redirectLocation.search + redirectLocation.pathname + redirectLocation.search, ); } else if (renderProps) { var context = app.createContext(); @@ -50,24 +50,24 @@ server.use(function (req, res, next) { var markupElement = React.createElement( FluxibleComponent, { context: context.getComponentContext() }, - React.createElement(RouterContext, renderProps) + React.createElement(RouterContext, renderProps), ); var html = renderToStaticMarkup( + />, ); debug('Sending markup'); res.status(200).send(html); - } + }, ); } else { next(); } - } + }, ); }); diff --git a/examples/stale-props/src/Item.js b/examples/stale-props/src/Item.js index 49aa4209..05ea467a 100644 --- a/examples/stale-props/src/Item.js +++ b/examples/stale-props/src/Item.js @@ -29,5 +29,5 @@ export default connectToStores( ({ getStore, executeAction }, { itemId }) => ({ item: getStore(ListStore).getItem(itemId), remove: () => executeAction(removeItem, { itemId }), - }) + }), ); diff --git a/examples/stale-props/src/index.js b/examples/stale-props/src/index.js index 7257fd92..725f48a8 100644 --- a/examples/stale-props/src/index.js +++ b/examples/stale-props/src/index.js @@ -12,5 +12,5 @@ ReactDOM.render( , - document.getElementById('root') + document.getElementById('root'), ); diff --git a/examples/todo/actions/toggleAll.js b/examples/todo/actions/toggleAll.js index fe6cfaaa..45caa186 100644 --- a/examples/todo/actions/toggleAll.js +++ b/examples/todo/actions/toggleAll.js @@ -20,6 +20,6 @@ module.exports = function (context, payload, done) { context.dispatch('TOGGLE_ALL_TODO_SUCCESS', todos); done(); - } + }, ); }; diff --git a/examples/todo/app.js b/examples/todo/app.js index d2b05585..90bd0ca1 100644 --- a/examples/todo/app.js +++ b/examples/todo/app.js @@ -14,7 +14,7 @@ var app = new Fluxible({ app.plug( fetchrPlugin({ xhrPath: '/api', - }) + }), ); app.registerStore(require('./stores/TodoStore')); diff --git a/examples/todo/assets/todomvc-common/base.css b/examples/todo/assets/todomvc-common/base.css index a413b943..515ee382 100644 --- a/examples/todo/assets/todomvc-common/base.css +++ b/examples/todo/assets/todomvc-common/base.css @@ -20,7 +20,11 @@ button { } body { - font: 14px 'Helvetica Neue', Helvetica, Arial, sans-serif; + font: + 14px 'Helvetica Neue', + Helvetica, + Arial, + sans-serif; line-height: 1.4em; background: #eaeaea url('bg.png'); color: #4d4d4d; @@ -46,7 +50,8 @@ input[type='checkbox'] { position: relative; border-top-left-radius: 2px; border-top-right-radius: 2px; - box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.2), + box-shadow: + 0 2px 6px 0 rgba(0, 0, 0, 0.2), 0 25px 50px 0 rgba(0, 0, 0, 0.15); } @@ -285,7 +290,9 @@ label[for='toggle-all'] { } #todo-list li .destroy:hover { - text-shadow: 0 0 1px #000, 0 0 10px rgba(199, 107, 107, 0.8); + text-shadow: + 0 0 1px #000, + 0 0 10px rgba(199, 107, 107, 0.8); -webkit-transform: scale(1.3); transform: scale(1.3); } @@ -326,8 +333,10 @@ label[for='toggle-all'] { left: 0; height: 50px; z-index: -1; - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3), - 0 6px 0 -3px rgba(255, 255, 255, 0.8), 0 7px 1px -3px rgba(0, 0, 0, 0.3), + box-shadow: + 0 1px 1px rgba(0, 0, 0, 0.3), + 0 6px 0 -3px rgba(255, 255, 255, 0.8), + 0 7px 1px -3px rgba(0, 0, 0, 0.3), 0 43px 0 -6px rgba(255, 255, 255, 0.8), 0 44px 2px -6px rgba(0, 0, 0, 0.2); } diff --git a/examples/todo/components/TodoApp.js b/examples/todo/components/TodoApp.js index 789dc274..f7680b3d 100644 --- a/examples/todo/components/TodoApp.js +++ b/examples/todo/components/TodoApp.js @@ -190,5 +190,5 @@ module.exports = provideContext( connectToStores(TodoApp, [TodoStore], (context) => ({ items: context.getStore(TodoStore).getAll(), context, - })) + })), ); diff --git a/examples/todo/components/TodoItem.js b/examples/todo/components/TodoItem.js index 2141bae3..09d19966 100644 --- a/examples/todo/components/TodoItem.js +++ b/examples/todo/components/TodoItem.js @@ -39,7 +39,7 @@ class Component extends React.Component { const node = this.editField.current; node.focus(); node.setSelectionRange(node.value.length, node.value.length); - }.bind(this) + }.bind(this), ); this.setState({ editText: this.props.todo.text }); diff --git a/examples/todo/server.js b/examples/todo/server.js index cd9292eb..faca2e03 100644 --- a/examples/todo/server.js +++ b/examples/todo/server.js @@ -57,10 +57,10 @@ server.use(function (req, res, next) { HtmlComponent({ state: exposed, markup: ReactDOM.renderToString( - createElementWithContext(context) + createElementWithContext(context), ), context: componentContext, - }) + }), ); res.send(html); diff --git a/examples/todo/services/todo.js b/examples/todo/services/todo.js index 6c623e33..f4efbd9a 100644 --- a/examples/todo/services/todo.js +++ b/examples/todo/services/todo.js @@ -12,9 +12,12 @@ var randomResponseTime = function (min, max) { module.exports = { name: 'todo', read: function (req, resource, params, config, callback) { - setTimeout(function () { - callback(null, _todos.concat()); - }, randomResponseTime(100, 1000)); + setTimeout( + function () { + callback(null, _todos.concat()); + }, + randomResponseTime(100, 1000), + ); }, create: function (req, resource, params, body, config, callback) { var newTodo = { @@ -24,16 +27,22 @@ module.exports = { if (params.text.indexOf('fail') > -1) { var err = new Error('Shenanigans'); - setTimeout(function () { - callback(err); - }, randomResponseTime(800, 1000)); + setTimeout( + function () { + callback(err); + }, + randomResponseTime(800, 1000), + ); return; } else { _todos.push(newTodo); - setTimeout(function () { - callback(null, newTodo); - }, randomResponseTime(100, 1000)); + setTimeout( + function () { + callback(null, newTodo); + }, + randomResponseTime(100, 1000), + ); } }, update: function (req, resource, params, body, config, callback) { @@ -42,9 +51,12 @@ module.exports = { todo.completed = params.checked; }); - setTimeout(function () { - callback(null, _todos); - }, randomResponseTime(100, 1000)); + setTimeout( + function () { + callback(null, _todos); + }, + randomResponseTime(100, 1000), + ); } else { var foundTodo; @@ -57,9 +69,12 @@ module.exports = { } }); - setTimeout(function () { - callback(null, foundTodo); - }, randomResponseTime(100, 1000)); + setTimeout( + function () { + callback(null, foundTodo); + }, + randomResponseTime(100, 1000), + ); } }, delete: function (req, resource, params, config, callback) { @@ -67,8 +82,11 @@ module.exports = { return params.ids.indexOf(todo.id) === -1; }); - setTimeout(function () { - callback(null, _todos); - }, randomResponseTime(100, 1000)); + setTimeout( + function () { + callback(null, _todos); + }, + randomResponseTime(100, 1000), + ); }, }; diff --git a/packages/dispatchr/addons/BaseStore.js b/packages/dispatchr/addons/BaseStore.js index 949ee3df..715b2b7d 100644 --- a/packages/dispatchr/addons/BaseStore.js +++ b/packages/dispatchr/addons/BaseStore.js @@ -49,7 +49,7 @@ BaseStore.prototype.addChangeListener = function addChangeListener(callback) { * @param {Function} callback */ BaseStore.prototype.removeChangeListener = function removeChangeListener( - callback + callback, ) { this.removeListener(CHANGE_EVENT, callback); }; diff --git a/packages/dispatchr/addons/createStore.js b/packages/dispatchr/addons/createStore.js index 3e2bce0d..3ecb4f59 100644 --- a/packages/dispatchr/addons/createStore.js +++ b/packages/dispatchr/addons/createStore.js @@ -29,7 +29,7 @@ function mixInto(dest, src) { } else { if (dest.hasOwnProperty(prop)) { throw new Error( - 'Mixin property collision for property "' + prop + '"' + 'Mixin property collision for property "' + prop + '"', ); } dest[prop] = src[prop]; diff --git a/packages/dispatchr/lib/Action.js b/packages/dispatchr/lib/Action.js index d47a9cac..691224c3 100644 --- a/packages/dispatchr/lib/Action.js +++ b/packages/dispatchr/lib/Action.js @@ -57,7 +57,7 @@ Action.prototype._callHandler = function callHandler(storeName) { handlerFn = self._handlers[storeName]; if (!handlerFn) { throw new Error( - storeName + ' does not have a handler for action ' + self.name + storeName + ' does not have a handler for action ' + self.name, ); } if (self._isCompleted[storeName]) { @@ -80,7 +80,7 @@ Action.prototype.waitFor = function waitFor(stores, callback) { var self = this; if (!self._isExecuting) { throw new Error( - 'waitFor called even though there is no action being executed!' + 'waitFor called even though there is no action being executed!', ); } if (!Array.isArray(stores)) { diff --git a/packages/dispatchr/lib/Dispatcher.js b/packages/dispatchr/lib/Dispatcher.js index 6c507d89..526b33f0 100644 --- a/packages/dispatchr/lib/Dispatcher.js +++ b/packages/dispatchr/lib/Dispatcher.js @@ -45,7 +45,7 @@ Dispatcher.prototype.registerStore = function registerStore(store) { var message = 'registerStore requires a constructor as first parameter'; return this._throwOrCallErrorHandler( message, - 'REGISTER_STORE_NO_CONSTRUCTOR' + 'REGISTER_STORE_NO_CONSTRUCTOR', ); } var storeName = this.getStoreName(store); @@ -53,7 +53,7 @@ Dispatcher.prototype.registerStore = function registerStore(store) { var message = 'Store is required to have a `storeName` property.'; return this._throwOrCallErrorHandler( message, - 'REGISTER_STORE_NO_STORENAME' + 'REGISTER_STORE_NO_STORENAME', ); } if (this.stores[storeName]) { @@ -68,7 +68,7 @@ Dispatcher.prototype.registerStore = function registerStore(store) { 'Make sure you do not have multiple copies of the store installed.'; return this._throwOrCallErrorHandler( message, - 'REGISTER_STORE_DUPLICATE_REGISTERED' + 'REGISTER_STORE_DUPLICATE_REGISTERED', ); } this.stores[storeName] = store; @@ -127,7 +127,7 @@ Dispatcher.prototype.getStoreName = function getStoreName(store) { 'minify your stores during build time and could break string ' + 'references to your store. It is advised that you add a ' + 'static `storeName` property to your store to ensure the ' + - 'store name does not change during your build.' + 'store name does not change during your build.', ); this.hasWarnedAboutNameProperty = true; } @@ -148,7 +148,7 @@ Dispatcher.prototype.getStoreName = function getStoreName(store) { Dispatcher.prototype._registerHandler = function registerHandler( action, name, - handler + handler, ) { this.handlers[action] = this.handlers[action] || []; this.handlers[action].push({ @@ -185,7 +185,7 @@ Dispatcher.prototype._throwOrCallErrorHandler = type: type || 'DISPATCHER_ERROR', meta: meta, }, - context + context, ); } else { throw new Error(message, { cause: meta && meta.error }); diff --git a/packages/dispatchr/lib/DispatcherContext.js b/packages/dispatchr/lib/DispatcherContext.js index 4f124073..1d7369b3 100644 --- a/packages/dispatchr/lib/DispatcherContext.js +++ b/packages/dispatchr/lib/DispatcherContext.js @@ -47,11 +47,11 @@ DispatcherContext.prototype.getStore = function getStore(name) { message, 'STORE_UNREGISTERED', this.context, - meta + meta, ); } this.storeInstances[storeName] = new this.dispatcher.stores[storeName]( - this.dispatcherInterface + this.dispatcherInterface, ); if (this.rehydratedStoreState && this.rehydratedStoreState[storeName]) { var state = this.rehydratedStoreState[storeName]; @@ -77,7 +77,7 @@ DispatcherContext.prototype.dispatch = function dispatch(actionName, payload) { return this.dispatcher._throwOrCallErrorHandler( message, 'DISPATCH_INVALID_ACTIONNAME', - this.context + this.context, ); } if (this.currentAction) { @@ -95,7 +95,7 @@ DispatcherContext.prototype.dispatch = function dispatch(actionName, payload) { message, 'DISPATCH_EXECUTING', this.context, - meta + meta, ); } var actionHandlers = this.dispatcher.handlers[actionName] || [], @@ -131,7 +131,7 @@ DispatcherContext.prototype.dispatch = function dispatch(actionName, payload) { message, 'DISPATCH_INVALID_STORE_METHOD', self.context, - meta + meta, ); } handlerFns[store.name] = @@ -148,7 +148,7 @@ DispatcherContext.prototype.dispatch = function dispatch(actionName, payload) { message, 'DISPATCH_EXCEPTION', this.context, - meta + meta, ); } finally { this.currentAction = null; @@ -165,18 +165,18 @@ DispatcherContext.prototype.dispatch = function dispatch(actionName, payload) { DispatcherContext.prototype.dehydrate = function dehydrate() { var self = this, stores = {}; - Object.keys(self.storeInstances).forEach(function storeInstancesEach( - storeName - ) { - var store = self.storeInstances[storeName]; - if ( - !store.dehydrate || - (store.shouldDehydrate && !store.shouldDehydrate()) - ) { - return; - } - stores[storeName] = store.dehydrate(); - }); + Object.keys(self.storeInstances).forEach( + function storeInstancesEach(storeName) { + var store = self.storeInstances[storeName]; + if ( + !store.dehydrate || + (store.shouldDehydrate && !store.shouldDehydrate()) + ) { + return; + } + stores[storeName] = store.dehydrate(); + }, + ); return { stores: stores, }; @@ -191,12 +191,12 @@ DispatcherContext.prototype.dehydrate = function dehydrate() { DispatcherContext.prototype.rehydrate = function rehydrate(dispatcherState) { var self = this; if (dispatcherState.stores) { - Object.keys(dispatcherState.stores).forEach(function storeStateEach( - storeName - ) { - self.rehydratedStoreState[storeName] = - dispatcherState.stores[storeName]; - }); + Object.keys(dispatcherState.stores).forEach( + function storeStateEach(storeName) { + self.rehydratedStoreState[storeName] = + dispatcherState.stores[storeName]; + }, + ); } }; @@ -219,7 +219,7 @@ DispatcherContext.prototype.waitFor = function waitFor(stores, callback) { message, 'WAITFOR_NO_ACTION', this.context, - meta + meta, ); } this.currentAction.waitFor(stores, callback); diff --git a/packages/dispatchr/tests/unit/lib/Dispatcher.test.js b/packages/dispatchr/tests/unit/lib/Dispatcher.test.js index 0f29f962..6c376bdd 100644 --- a/packages/dispatchr/tests/unit/lib/Dispatcher.test.js +++ b/packages/dispatchr/tests/unit/lib/Dispatcher.test.js @@ -34,7 +34,7 @@ describe('Dispatchr', function () { expect(dispatcher.handlers.NAVIGATE.length).toBe(2); expect(dispatcher.handlers.NAVIGATE[0].name).toBe('Store'); expect(dispatcher.handlers.NAVIGATE[0].handler).toBeInstanceOf( - Function + Function, ); }); @@ -121,7 +121,7 @@ describe('Dispatchr', function () { dispatcherContext.dispatch('NAVIGATE', {}); expect(dispatcherContext.storeInstances).toBeInstanceOf(Object); expect(dispatcherContext.storeInstances.Store).toBeInstanceOf( - Object + Object, ); var mockStore = dispatcherContext.storeInstances.Store; expect(mockStore.dispatcher).toBeInstanceOf(Object); @@ -138,7 +138,7 @@ describe('Dispatchr', function () { dispatcherContext.dispatch('DELAY', {}); expect(dispatcherContext.getStore('Store').getState().page).toBe( - 'delay' + 'delay', ); }); @@ -148,7 +148,7 @@ describe('Dispatchr', function () { dispatcherContext.dispatch('WAITFOR', {}); expect(dispatcherContext.getStore('Store').getState().called).toBe( - true + true, ); }); @@ -158,10 +158,10 @@ describe('Dispatchr', function () { dispatcherContext.dispatch('NAVIGATE', {}); expect(dispatcherContext.getStore(delayedStore).defaultCalled).toBe( - true + true, ); expect(dispatcherContext.getStore(delayedStore).actionHandled).toBe( - 'NAVIGATE' + 'NAVIGATE', ); }); @@ -171,10 +171,10 @@ describe('Dispatchr', function () { dispatcherContext.dispatch('FOO', {}); expect(dispatcherContext.getStore(delayedStore).defaultCalled).toBe( - true + true, ); expect(dispatcherContext.getStore(delayedStore).actionHandled).toBe( - 'FOO' + 'FOO', ); }); @@ -183,10 +183,10 @@ describe('Dispatchr', function () { dispatcherContext = dispatcher.createContext(context); dispatcherContext.dispatch('DELAY', {}); expect(dispatcherContext.getStore(delayedStore).defaultCalled).toBe( - false + false, ); expect( - dispatcherContext.getStore(delayedStore).actionHandled + dispatcherContext.getStore(delayedStore).actionHandled, ).toBeNull(); }); @@ -280,7 +280,7 @@ describe('Dispatchr', function () { expect(info).toBeInstanceOf(Object); expect(info.type).toBe('REGISTER_STORE_NO_CONSTRUCTOR'); expect(info.message).toBe( - 'registerStore requires a constructor as first parameter' + 'registerStore requires a constructor as first parameter', ); expect(info.meta.error).toBeInstanceOf(Error); done(); @@ -311,7 +311,7 @@ describe('Dispatchr', function () { expect(info).toBeInstanceOf(Object); expect(info.type).toBe('STORE_UNREGISTERED'); expect(info.message).toBe( - 'Store NewStore was not registered.' + 'Store NewStore was not registered.', ); expect(info.meta.storeName).toBe('NewStore'); expect(info.meta.error).toBeInstanceOf(Error); diff --git a/packages/dispatchr/utils/BaseStore.js b/packages/dispatchr/utils/BaseStore.js index 6f225e1b..82ad78be 100644 --- a/packages/dispatchr/utils/BaseStore.js +++ b/packages/dispatchr/utils/BaseStore.js @@ -1,3 +1,3 @@ throw new Error( - "require('dispatchr/utils/BaseStore') has moved to require('dispatchr/addons/BaseStore')" + "require('dispatchr/utils/BaseStore') has moved to require('dispatchr/addons/BaseStore')", ); diff --git a/packages/dispatchr/utils/createStore.js b/packages/dispatchr/utils/createStore.js index 74252e6e..15393576 100644 --- a/packages/dispatchr/utils/createStore.js +++ b/packages/dispatchr/utils/createStore.js @@ -1,3 +1,3 @@ throw new Error( - "require('dispatchr/utils/createStore') has moved to require('dispatchr/addons/createStore')" + "require('dispatchr/utils/createStore') has moved to require('dispatchr/addons/createStore')", ); diff --git a/packages/dispatchr/utils/index.js b/packages/dispatchr/utils/index.js index f165fe1f..7997b90b 100644 --- a/packages/dispatchr/utils/index.js +++ b/packages/dispatchr/utils/index.js @@ -1,3 +1,3 @@ throw new Error( - "require('dispatchr/utils') has moved to require('dispatchr/addons')" + "require('dispatchr/utils') has moved to require('dispatchr/addons')", ); diff --git a/packages/fluxible-addons-react/src/FluxibleComponentContext.js b/packages/fluxible-addons-react/src/FluxibleComponentContext.js index d9d09135..2cf7e70f 100644 --- a/packages/fluxible-addons-react/src/FluxibleComponentContext.js +++ b/packages/fluxible-addons-react/src/FluxibleComponentContext.js @@ -2,7 +2,7 @@ import { createContext } from 'react'; const throwError = () => { throw new Error( - 'Fluxible component context not found. Wrap your component with FluxibleProvider.' + 'Fluxible component context not found. Wrap your component with FluxibleProvider.', ); }; diff --git a/packages/fluxible-addons-react/src/FluxibleProvider.js b/packages/fluxible-addons-react/src/FluxibleProvider.js index c072ea9c..2960754a 100644 --- a/packages/fluxible-addons-react/src/FluxibleProvider.js +++ b/packages/fluxible-addons-react/src/FluxibleProvider.js @@ -6,7 +6,7 @@ const FluxibleProvider = ({ children, context }) => createElement( FluxibleComponentContext.Provider, { value: context }, - children + children, ); FluxibleProvider.propTypes = { diff --git a/packages/fluxible-addons-react/src/connectToStores.js b/packages/fluxible-addons-react/src/connectToStores.js index a026f75c..9228db9a 100644 --- a/packages/fluxible-addons-react/src/connectToStores.js +++ b/packages/fluxible-addons-react/src/connectToStores.js @@ -48,7 +48,7 @@ function connectToStores(Component, stores, getStateFromStores, options) { componentDidMount() { this._isMounted = true; stores.forEach((Store) => - this.context.getStore(Store).on('change', this._onStoreChange) + this.context.getStore(Store).on('change', this._onStoreChange), ); } @@ -57,7 +57,7 @@ function connectToStores(Component, stores, getStateFromStores, options) { stores.forEach((Store) => this.context .getStore(Store) - .removeListener('change', this._onStoreChange) + .removeListener('change', this._onStoreChange), ); } @@ -80,8 +80,8 @@ function connectToStores(Component, stores, getStateFromStores, options) { StoreConnector, options?.forwardRef ? Object.assign({ fluxibleRef: ref }, props) - : props - ) + : props, + ), ); forwarded.displayName = `storeConnector(${ Component.displayName || Component.name || 'Component' diff --git a/packages/fluxible-addons-react/src/createElementWithContext.js b/packages/fluxible-addons-react/src/createElementWithContext.js index db4e28c4..99cdbe62 100644 --- a/packages/fluxible-addons-react/src/createElementWithContext.js +++ b/packages/fluxible-addons-react/src/createElementWithContext.js @@ -16,7 +16,7 @@ function createElementWithContext(fluxibleContext, props) { const Component = fluxibleContext.getComponent(); if (!Component) { throw new Error( - 'A top-level component was not passed to the Fluxible constructor.' + 'A top-level component was not passed to the Fluxible constructor.', ); } diff --git a/packages/fluxible-addons-react/src/provideContext.js b/packages/fluxible-addons-react/src/provideContext.js index e95cda1d..63a4afda 100644 --- a/packages/fluxible-addons-react/src/provideContext.js +++ b/packages/fluxible-addons-react/src/provideContext.js @@ -22,7 +22,7 @@ function provideContext(Component) { createElement( FluxibleProvider, { context: props.context }, - createElement(Component, props) + createElement(Component, props), ); ContextProvider.propTypes = { diff --git a/packages/fluxible-addons-react/tests/unit/lib/FluxibleComponent.test.js b/packages/fluxible-addons-react/tests/unit/lib/FluxibleComponent.test.js index dac153ac..b9409089 100644 --- a/packages/fluxible-addons-react/tests/unit/lib/FluxibleComponent.test.js +++ b/packages/fluxible-addons-react/tests/unit/lib/FluxibleComponent.test.js @@ -43,7 +43,7 @@ describe('fluxible-addons-react', () => { ReactTestUtils.renderIntoDocument( Some child - + , ); expect(spy).toHaveBeenCalledTimes(1); @@ -63,7 +63,7 @@ describe('fluxible-addons-react', () => { ReactTestUtils.renderIntoDocument( Some child - + , ); }); }); diff --git a/packages/fluxible-addons-react/tests/unit/lib/FluxibleComponentContext.test.js b/packages/fluxible-addons-react/tests/unit/lib/FluxibleComponentContext.test.js index e3728261..aea1805a 100644 --- a/packages/fluxible-addons-react/tests/unit/lib/FluxibleComponentContext.test.js +++ b/packages/fluxible-addons-react/tests/unit/lib/FluxibleComponentContext.test.js @@ -12,7 +12,7 @@ describe('FluxibleComponentContext', () => { const Component = () => { const { getStore, executeAction } = useContext( - FluxibleComponentContext + FluxibleComponentContext, ); getStore('SomeStore'); executeAction('SomeAction'); @@ -22,7 +22,7 @@ describe('FluxibleComponentContext', () => { renderToString( - + , ); expect(context.getStore).toHaveBeenCalledTimes(1); diff --git a/packages/fluxible-addons-react/tests/unit/lib/batchedUpdatePlugin.test.js b/packages/fluxible-addons-react/tests/unit/lib/batchedUpdatePlugin.test.js index 414abaf6..7fe2fcd8 100644 --- a/packages/fluxible-addons-react/tests/unit/lib/batchedUpdatePlugin.test.js +++ b/packages/fluxible-addons-react/tests/unit/lib/batchedUpdatePlugin.test.js @@ -34,7 +34,7 @@ const createComponent = (context) => { connectToStores(DumbComponent, [FooStore, BarStore], (context) => ({ foo: context.getStore(FooStore).getFoo(), bar: context.getStore(BarStore).getBar(), - })) + })), ); const props = { diff --git a/packages/fluxible-addons-react/tests/unit/lib/connectToStores.test.js b/packages/fluxible-addons-react/tests/unit/lib/connectToStores.test.js index f6636ad9..3ae829e5 100644 --- a/packages/fluxible-addons-react/tests/unit/lib/connectToStores.test.js +++ b/packages/fluxible-addons-react/tests/unit/lib/connectToStores.test.js @@ -33,7 +33,7 @@ const getStateFromStores = ({ getStore, executeAction }) => ({ const ConnectedComponent = connectToStores( DumbComponent, stores, - getStateFromStores + getStateFromStores, ); const renderComponent = (Component, ref) => { @@ -42,7 +42,7 @@ const renderComponent = (Component, ref) => { const app = TestRenderer.create( - + , ); return { app, context }; @@ -57,12 +57,12 @@ describe('fluxible-addons-react', () => { describe('connectToStores', () => { it('should hoist and set static properties properly', () => { expect(ConnectedComponent.displayName).toBe( - 'storeConnector(DumbComponent)' + 'storeConnector(DumbComponent)', ); expect(ConnectedComponent.WrappedComponent).toBe(DumbComponent); expect(ConnectedComponent.initAction).toBeInstanceOf(Function); expect(ConnectedComponent.initAction).toBe( - DumbComponent.initAction + DumbComponent.initAction, ); }); @@ -115,7 +115,7 @@ describe('fluxible-addons-react', () => { ClassComponent, stores, getStateFromStores, - { forwardRef: true } + { forwardRef: true }, ); const ForwardComponent = forwardRef((props, ref) => { @@ -128,14 +128,14 @@ describe('fluxible-addons-react', () => { ForwardComponent, stores, getStateFromStores, - { forwardRef: true } + { forwardRef: true }, ); const WithoutRefComponent = connectToStores( DumbComponent, stores, getStateFromStores, - { forwardRef: false } + { forwardRef: false }, ); it('should not forward ref by default', () => { @@ -165,7 +165,7 @@ describe('fluxible-addons-react', () => { const { app } = renderComponent(ConnectedComponent, ref); const connector = app.root.find( - (node) => node.type.name === 'StoreConnector' + (node) => node.type.name === 'StoreConnector', ); expect(connector.props.fluxibleRef).toBe(undefined); diff --git a/packages/fluxible-addons-react/tests/unit/lib/provideContext.test.js b/packages/fluxible-addons-react/tests/unit/lib/provideContext.test.js index eb4cc462..87e756a9 100644 --- a/packages/fluxible-addons-react/tests/unit/lib/provideContext.test.js +++ b/packages/fluxible-addons-react/tests/unit/lib/provideContext.test.js @@ -29,7 +29,7 @@ describe('fluxible-addons-react', () => { const WrappedComponent = provideContext(Component); expect(WrappedComponent.displayName).toBe( - 'contextProvider(Component)' + 'contextProvider(Component)', ); }); @@ -43,7 +43,7 @@ describe('fluxible-addons-react', () => { const WrappedComponent = provideContext(Component); expect(WrappedComponent.displayName).toBe( - 'contextProvider(TestComponent)' + 'contextProvider(TestComponent)', ); }); @@ -79,7 +79,7 @@ describe('fluxible-addons-react', () => { expect(WrappedComponent.initAction).toBeInstanceOf(Function); expect(WrappedComponent.displayName).not.toBe( - Component.displayName + Component.displayName, ); }); }); diff --git a/packages/fluxible-addons-react/tests/unit/lib/useFluxible.test.js b/packages/fluxible-addons-react/tests/unit/lib/useFluxible.test.js index 995652ed..edb2301a 100644 --- a/packages/fluxible-addons-react/tests/unit/lib/useFluxible.test.js +++ b/packages/fluxible-addons-react/tests/unit/lib/useFluxible.test.js @@ -18,7 +18,7 @@ describe('fluxible-addons-react', () => { const testRenderer = TestRenderer.create( - + , ); const component = testRenderer.root.findByType('p'); diff --git a/packages/fluxible-addons-react/tests/unit/lib/withFluxible.test.js b/packages/fluxible-addons-react/tests/unit/lib/withFluxible.test.js index f3e8e4ab..6426b6e7 100644 --- a/packages/fluxible-addons-react/tests/unit/lib/withFluxible.test.js +++ b/packages/fluxible-addons-react/tests/unit/lib/withFluxible.test.js @@ -20,7 +20,7 @@ describe('fluxible-addons-react', () => { const testRenderer = TestRenderer.create( - + , ); const component = testRenderer.root.findByType('p'); diff --git a/packages/fluxible-plugin-devtools/src/components/ActionTree.jsx b/packages/fluxible-plugin-devtools/src/components/ActionTree.jsx index cad3c321..2b6f9e1b 100644 --- a/packages/fluxible-plugin-devtools/src/components/ActionTree.jsx +++ b/packages/fluxible-plugin-devtools/src/components/ActionTree.jsx @@ -179,7 +179,7 @@ class ActionTree extends React.Component { (d) => 'Click to collapse ' + d.name + - '. Hover to see path to parent.' + '. Hover to see path to parent.', ); nodeEnter .append('text') @@ -213,7 +213,7 @@ class ActionTree extends React.Component { .text( (d) => 'Open your javascript console and click here to inspect the payload of ' + - d.name + d.name, ); // Transition nodes to their new position. @@ -246,12 +246,12 @@ class ActionTree extends React.Component { .insert('path', 'g') .attr('class', 'link') .attr('d', (d) => - diagonal({ source: d.source, target: d.source }) + diagonal({ source: d.source, target: d.source }), ) .transition() .duration(duration) .attr('d', (d) => - diagonal({ source: d.source, target: d.target }) + diagonal({ source: d.source, target: d.target }), ); // Transition links to their new position. @@ -262,7 +262,7 @@ class ActionTree extends React.Component { .transition() .duration(duration) .attr('d', (d) => - diagonal({ source: d.source, target: d.source }) + diagonal({ source: d.source, target: d.source }), ) .remove(); } @@ -325,13 +325,13 @@ class ActionTree extends React.Component { if (d.dispatchCalls) { console.log( '-> Dispatch Calls: %o', - d.dispatchCalls.map((c) => c.name) + d.dispatchCalls.map((c) => c.name), ); } if (d.actionCalls) { console.log( '-> Action Calls: %o', - d.actionCalls.map((c) => c.name) + d.actionCalls.map((c) => c.name), ); } console.log('==='); diff --git a/packages/fluxible-plugin-devtools/src/lib/devtools-plugin.js b/packages/fluxible-plugin-devtools/src/lib/devtools-plugin.js index b92be1d2..7fdefa51 100644 --- a/packages/fluxible-plugin-devtools/src/lib/devtools-plugin.js +++ b/packages/fluxible-plugin-devtools/src/lib/devtools-plugin.js @@ -73,11 +73,11 @@ export default function devToolsPlugin() { context._createSubActionContext = function createDevSubActionContext( parentActionContext, - action + action, ) { let subActionContext = createSubActionContext( parentActionContext, - action + action, ); let actionReference = { rootId: subActionContext.rootId, @@ -98,7 +98,7 @@ export default function devToolsPlugin() { parentActionReference.actionCalls = parentActionReference.actionCalls || []; parentActionReference.actionCalls.push( - actionReference + actionReference, ); // TODO: perhaps also push to an parentActionReference.actions reference array. // This way we can still correctly detect leaf nodes. Actually are leaf nodes even useful? @@ -189,7 +189,7 @@ export default function devToolsPlugin() { * @param componentContext */ plugComponentContext: function plugComponentContext( - componentContext + componentContext, ) { provideDevTools(componentContext); }, diff --git a/packages/fluxible-plugin-devtools/tests/unit/lib/devtools-plugin.test.js b/packages/fluxible-plugin-devtools/tests/unit/lib/devtools-plugin.test.js index a616e17b..461be962 100644 --- a/packages/fluxible-plugin-devtools/tests/unit/lib/devtools-plugin.test.js +++ b/packages/fluxible-plugin-devtools/tests/unit/lib/devtools-plugin.test.js @@ -27,15 +27,15 @@ describe('devToolsPlugin', function () { var ctx; ctx = app.createContext(); expect( - ctx.dehydrate().plugins[pluginInstance.name].enableDebug + ctx.dehydrate().plugins[pluginInstance.name].enableDebug, ).toEqual(false); ctx = app.createContext({ debug: false }); expect( - ctx.dehydrate().plugins[pluginInstance.name].enableDebug + ctx.dehydrate().plugins[pluginInstance.name].enableDebug, ).toEqual(false); ctx = app.createContext({ debug: true }); expect( - ctx.dehydrate().plugins[pluginInstance.name].enableDebug + ctx.dehydrate().plugins[pluginInstance.name].enableDebug, ).toEqual(true); }); }); @@ -51,13 +51,13 @@ describe('devToolsPlugin', function () { let ctx; ctx = app.createContext(); expect( - ctx.dehydrate().plugins[pluginInstance.name].enableDebug + ctx.dehydrate().plugins[pluginInstance.name].enableDebug, ).toEqual(false); expect( - ctx.dehydrate().plugins[pluginInstance.name].actionHistory + ctx.dehydrate().plugins[pluginInstance.name].actionHistory, ).toHaveLength(0); expect(ctx._createSubActionContext.name).toEqual( - 'createSubActionContext' + 'createSubActionContext', ); ctx.rehydrate({ plugins: { @@ -68,17 +68,17 @@ describe('devToolsPlugin', function () { }, }); expect( - ctx.dehydrate().plugins[pluginInstance.name].enableDebug + ctx.dehydrate().plugins[pluginInstance.name].enableDebug, ).toEqual(true); expect( - ctx.dehydrate().plugins[pluginInstance.name].actionHistory + ctx.dehydrate().plugins[pluginInstance.name].actionHistory, ).toHaveLength(1); expect( ctx.dehydrate().plugins[pluginInstance.name].actionHistory[0] - .name + .name, ).toEqual('navigateAction'); expect(ctx._createSubActionContext.name).toEqual( - 'createDevSubActionContext' + 'createDevSubActionContext', ); }); }); @@ -93,7 +93,7 @@ describe('devToolsPlugin', function () { it('should plug componentContext with a devtools namespace', function () { expect(componentContext.devtools).toBeInstanceOf(Object); expect(componentContext.devtools.getActionHistory).toBeInstanceOf( - Function + Function, ); }); }); @@ -111,7 +111,7 @@ describe('devToolsPlugin', function () { expect(Array.isArray(getActionHistory())).toBe(true); expect(getActionHistory()).toHaveLength(1); expect(getActionHistory()[0].name).toEqual( - MockActionFromComponent.name + MockActionFromComponent.name, ); function MockActionFromAction(ctx, payload, cb) { cb(); @@ -120,10 +120,10 @@ describe('devToolsPlugin', function () { expect(Array.isArray(getActionHistory())).toBe(true); expect(getActionHistory()).toHaveLength(2); expect(getActionHistory()[0].name).toEqual( - MockActionFromComponent.name + MockActionFromComponent.name, ); expect(getActionHistory()[1].name).toEqual( - MockActionFromAction.name + MockActionFromAction.name, ); }); @@ -141,9 +141,9 @@ describe('devToolsPlugin', function () { payload, function actionOneSecondCallback() { cb(); - } + }, ); - } + }, ); }, function (cb) { @@ -152,14 +152,14 @@ describe('devToolsPlugin', function () { payload, function actionOneThirdcallback() { cb(); - } + }, ); }, async.apply(context.executeAction, actionFour, payload), ], function (err) { callback(err); - } + }, ); }; actionOne.displayName = 'One'; @@ -214,22 +214,22 @@ describe('devToolsPlugin', function () { duration: expect.anything(), failed: expect.anything(), rootId: expect.anything(), - }) + }), ); expect(expected.name).toEqual(actual.name); if (expected.actionCalls) { expect(actual).toEqual( expect.objectContaining({ actionCalls: expect.any(Array), - }) + }), ); expect(expected.actionCalls.length).toEqual( - actual.actionCalls.length + actual.actionCalls.length, ); expected.actionCalls.forEach((a, index) => { compareHeirarchy( expected.actionCalls[index], - actual.actionCalls[index] + actual.actionCalls[index], ); }); } @@ -256,9 +256,9 @@ describe('devToolsPlugin', function () { payload, function actionOneSecondCallback() { cb(); - } + }, ); - } + }, ); }, function (cb) { @@ -267,7 +267,7 @@ describe('devToolsPlugin', function () { payload, function actionOneThirdcallback() { cb(); - } + }, ); }, async.apply(context.executeAction, actionFour, payload), @@ -275,7 +275,7 @@ describe('devToolsPlugin', function () { function (err) { context.dispatch('ONE_STOP'); callback(err); - } + }, ); }; actionOne.displayName = 'One'; @@ -344,21 +344,21 @@ describe('devToolsPlugin', function () { duration: expect.anything(), failed: expect.anything(), rootId: expect.anything(), - }) + }), ); expect(expected.name).toEqual(actual.name); if (expected.dispatchCalls) { expect(actual).toEqual( expect.objectContaining({ dispatchCalls: expect.any(Array), - }) + }), ); expect(expected.dispatchCalls.length).toEqual( - actual.dispatchCalls.length + actual.dispatchCalls.length, ); expected.dispatchCalls.forEach((a, index) => { expect(expected.dispatchCalls[index].name).toEqual( - actual.dispatchCalls[index].name + actual.dispatchCalls[index].name, ); }); } @@ -366,15 +366,15 @@ describe('devToolsPlugin', function () { expect(actual).toEqual( expect.objectContaining({ actionCalls: expect.any(Array), - }) + }), ); expect(expected.actionCalls.length).toEqual( - actual.actionCalls.length + actual.actionCalls.length, ); expected.actionCalls.forEach((a, index) => { compareHeirarchy( expected.actionCalls[index], - actual.actionCalls[index] + actual.actionCalls[index], ); }); } diff --git a/packages/fluxible-plugin-fetchr/lib/fetchr-plugin.js b/packages/fluxible-plugin-fetchr/lib/fetchr-plugin.js index 52fcae58..1544d4e2 100644 --- a/packages/fluxible-plugin-fetchr/lib/fetchr-plugin.js +++ b/packages/fluxible-plugin-fetchr/lib/fetchr-plugin.js @@ -87,7 +87,7 @@ module.exports = function fetchrPlugin(options) { constructGetXhrUri: function constructGetXhrUri( resource, params, - config + config, ) { config = config || {}; uri = config.cors ? corsPath : currentXhrPath; @@ -100,7 +100,7 @@ module.exports = function fetchrPlugin(options) { resource, params, config, - xhrContext + xhrContext, ); }, updateOptions: function (options) { diff --git a/packages/fluxible-plugin-fetchr/tests/unit/lib/fetchr-plugin.test.js b/packages/fluxible-plugin-fetchr/tests/unit/lib/fetchr-plugin.test.js index df0cc3e3..4cfc6a3d 100644 --- a/packages/fluxible-plugin-fetchr/tests/unit/lib/fetchr-plugin.test.js +++ b/packages/fluxible-plugin-fetchr/tests/unit/lib/fetchr-plugin.test.js @@ -76,7 +76,7 @@ describe('fetchrPlugin', function () { }, ]); done(); - } + }, ); }); }); @@ -90,10 +90,10 @@ describe('fetchrPlugin', function () { function (err, result) { expect(result).toBe('create'); expect(actionContext.getServiceMeta()).toHaveLength( - 0 + 0, ); done(); - } + }, ); }); }); @@ -107,10 +107,10 @@ describe('fetchrPlugin', function () { function (err, result) { expect(result).toBe('update'); expect(actionContext.getServiceMeta()).toHaveLength( - 0 + 0, ); done(); - } + }, ); }); }); @@ -123,10 +123,10 @@ describe('fetchrPlugin', function () { function (err, result) { expect(result).toBe('delete'); expect(actionContext.getServiceMeta()).toHaveLength( - 0 + 0, ); done(); - } + }, ); }); }); @@ -213,8 +213,8 @@ describe('fetchrPlugin', function () { actionContext.service.constructGetXhrUri( 'resourceFoo', { a: 1 }, - { cors: true } - ) + { cors: true }, + ), ).toBe('http://example.com/resourceFoo;a=1?device=tablet'); }); }); @@ -235,7 +235,7 @@ describe('fetchrPlugin', function () { expect( actionContext.service.constructGetXhrUri('resourceFoo', { a: 1, - }) + }), ).toBe('custom2/api/resourceFoo;a=1?device=tablet'); expect( @@ -246,8 +246,8 @@ describe('fetchrPlugin', function () { constructGetUri: function () { return '/customGetUri'; }, - } - ) + }, + ), ).toBe('/customGetUri'); }); }); diff --git a/packages/fluxible-plugin-fetchr/utils/MockServiceManager.js b/packages/fluxible-plugin-fetchr/utils/MockServiceManager.js index 5d1a9d7d..1cf200f5 100644 --- a/packages/fluxible-plugin-fetchr/utils/MockServiceManager.js +++ b/packages/fluxible-plugin-fetchr/utils/MockServiceManager.js @@ -14,7 +14,7 @@ MockServiceManager.prototype.read = function (name) { this.serviceCalls.push(args.concat(name)); if (!this.services[name]) { throw new Error( - 'Fetcher ' + name + ' has not been registered to mock fetcher' + 'Fetcher ' + name + ' has not been registered to mock fetcher', ); } this.services[name].apply(null, args); diff --git a/packages/fluxible-reducer-store/lib/createReducerStore.js b/packages/fluxible-reducer-store/lib/createReducerStore.js index 55d47c07..c899b98e 100644 --- a/packages/fluxible-reducer-store/lib/createReducerStore.js +++ b/packages/fluxible-reducer-store/lib/createReducerStore.js @@ -44,7 +44,7 @@ module.exports = function createReducerStore(spec) { if (!ReducerStore.handlers[eventName]) { ReducerStore.handlers[eventName] = function ( payload, - dispatchedEventName + dispatchedEventName, ) { if (__DEV__) { if (!spec.reducers[eventName]) { @@ -54,7 +54,7 @@ module.exports = function createReducerStore(spec) { eventName + ' reducer on ' + spec.storeName + - ' has been removed.' + ' has been removed.', ); return; } @@ -63,7 +63,7 @@ module.exports = function createReducerStore(spec) { this.state = spec.reducers[eventName]( this.state, payload, - dispatchedEventName + dispatchedEventName, ); if (this.state !== startingState) { this.emitChange(); @@ -89,13 +89,13 @@ module.exports = function createReducerStore(spec) { methodName + ' on ' + storeName + - ' has been removed but was still called.' + ' has been removed but was still called.', ); } } var state = this.state; var args = [state].concat( - Array.prototype.slice.call(arguments) + Array.prototype.slice.call(arguments), ); return spec.getters[methodName].apply(null, args); }; diff --git a/packages/fluxible-router/src/History.js b/packages/fluxible-router/src/History.js index 1f873d7a..a80efa43 100644 --- a/packages/fluxible-router/src/History.js +++ b/packages/fluxible-router/src/History.js @@ -107,7 +107,7 @@ History.prototype = { // remember the referrer url in state, so that it can be used for back navigations var _state = Object.assign( { origUrl: url, referrerUrl: win.location.href }, - state + state, ); try { diff --git a/packages/fluxible-router/src/RouteStore.js b/packages/fluxible-router/src/RouteStore.js index a9c56010..dcb9315f 100644 --- a/packages/fluxible-router/src/RouteStore.js +++ b/packages/fluxible-router/src/RouteStore.js @@ -171,7 +171,7 @@ const RouteStore = createStore({ method: (state.currentNavigate && state.currentNavigate.method) || 'GET', - } + }, ); }, }); @@ -189,7 +189,7 @@ RouteStore.withStaticRoutes = function (staticRoutes) { return Object.assign( {}, StaticRouteStore.routes, - this._routes || {} + this._routes || {}, ); } } diff --git a/packages/fluxible-router/src/createNavLinkComponent.js b/packages/fluxible-router/src/createNavLinkComponent.js index 35021473..9d808de2 100644 --- a/packages/fluxible-router/src/createNavLinkComponent.js +++ b/packages/fluxible-router/src/createNavLinkComponent.js @@ -259,7 +259,7 @@ class NavLink extends React.Component { } catch (error) { console.warn( 'Warning: Call of window.onbeforeunload failed', - error + error, ); } } @@ -296,12 +296,12 @@ class NavLink extends React.Component { "NavLink created with empty or missing href '" + props.href + "'or unresolvable routeName '" + - props.routeName + props.routeName, ); } else { console.error( 'Error: Render NavLink with empty or missing href', - props + props, ); } } @@ -325,7 +325,7 @@ class NavLink extends React.Component { 'routeName', 'stopPropagation', 'validate', - ].concat(this.getFilteredProps()) + ].concat(this.getFilteredProps()), ); var isActive = false; diff --git a/packages/fluxible-router/src/handleHistory.js b/packages/fluxible-router/src/handleHistory.js index e309179a..dcc57af2 100644 --- a/packages/fluxible-router/src/handleHistory.js +++ b/packages/fluxible-router/src/handleHistory.js @@ -142,7 +142,7 @@ function handleHistory(Component, opts) { } this._scrollTimer = window.setTimeout( this._saveScrollPosition, - 150 + 150, ); } @@ -178,7 +178,7 @@ function handleHistory(Component, opts) { } catch (error) { console.warn( 'Warning: Call of window.onbeforeunload failed', - error + error, ); } } @@ -284,13 +284,13 @@ function handleHistory(Component, opts) { this._history.replaceState( historyState, pageTitle, - nav.url + nav.url, ); } else { this._history.pushState( historyState, pageTitle, - nav.url + nav.url, ); } break; diff --git a/packages/fluxible-router/src/handleRoute.js b/packages/fluxible-router/src/handleRoute.js index a98b0852..4b04c5ff 100644 --- a/packages/fluxible-router/src/handleRoute.js +++ b/packages/fluxible-router/src/handleRoute.js @@ -24,8 +24,8 @@ function handleRoute(Component) { isActive: routeStore.isActive.bind(routeStore), makePath: routeStore.makePath.bind(routeStore), }, - this.props - ) + this.props, + ), ); } }; @@ -50,7 +50,7 @@ function handleRoute(Component) { isNavigateComplete: routeStore.isNavigateComplete(), currentRoute: routeStore.getCurrentRoute(), }; - } + }, ); hoistNonReactStatics(RouteHandler, Component); diff --git a/packages/fluxible-router/src/navigateAction.js b/packages/fluxible-router/src/navigateAction.js index a7e6e618..1bf3732f 100644 --- a/packages/fluxible-router/src/navigateAction.js +++ b/packages/fluxible-router/src/navigateAction.js @@ -9,13 +9,13 @@ function navigateAction(context, payload, done) { { transactionId: context.rootId, }, - payload + payload, ); if (!payload.url && payload.routeName) { navigate.url = routeStore.makePath( payload.routeName, payload.params, - payload.query + payload.query, ); navigate.routeName = null; } @@ -25,8 +25,8 @@ function navigateAction(context, payload, done) { if (!routeStore.getCurrentRoute) { done( new Error( - 'RouteStore has not implemented `getCurrentRoute` method.' - ) + 'RouteStore has not implemented `getCurrentRoute` method.', + ), ); return; } diff --git a/packages/fluxible-router/tests/mocks/MockAppComponent.js b/packages/fluxible-router/tests/mocks/MockAppComponent.js index 81207f76..b6ded6a2 100644 --- a/packages/fluxible-router/tests/mocks/MockAppComponent.js +++ b/packages/fluxible-router/tests/mocks/MockAppComponent.js @@ -28,7 +28,7 @@ module.exports.default = provideContext( handleHistory(MockAppComponent, { checkRouteOnPageLoad: false, enableScroll: true, - }) + }), ); module.exports.createWrappedMockAppComponent = diff --git a/packages/fluxible-router/tests/mocks/mockWindow.js b/packages/fluxible-router/tests/mocks/mockWindow.js index a344aa75..59e95fbf 100644 --- a/packages/fluxible-router/tests/mocks/mockWindow.js +++ b/packages/fluxible-router/tests/mocks/mockWindow.js @@ -41,7 +41,7 @@ module.exports = function mockWindow(testResult) { pushState: function (state, title, url) { if (arguments.length < 3) { throw new TypeError( - 'Not enough arguments to History.pushState.' + 'Not enough arguments to History.pushState.', ); } testResult.pushState = { @@ -53,7 +53,7 @@ module.exports = function mockWindow(testResult) { replaceState: function (state, title, url) { if (arguments.length < 3) { throw new TypeError( - 'Not enough arguments to History.replaceState.' + 'Not enough arguments to History.replaceState.', ); } testResult.pushState = { diff --git a/packages/fluxible-router/tests/unit/History.test.js b/packages/fluxible-router/tests/unit/History.test.js index dcd6e499..61fe452c 100644 --- a/packages/fluxible-router/tests/unit/History.test.js +++ b/packages/fluxible-router/tests/unit/History.test.js @@ -68,7 +68,7 @@ describe('History', function () { var history = new History({ win: _.merge( { history: { state: { foo: 'bar' } } }, - windowMock.HTML5 + windowMock.HTML5, ), }); expect(history.getState()).toEqual({ foo: 'bar' }); diff --git a/packages/fluxible-router/tests/unit/HistoryWithHash.test.js b/packages/fluxible-router/tests/unit/HistoryWithHash.test.js index 817566bb..ceff4302 100644 --- a/packages/fluxible-router/tests/unit/HistoryWithHash.test.js +++ b/packages/fluxible-router/tests/unit/HistoryWithHash.test.js @@ -96,7 +96,7 @@ describe('HistoryWithHash', function () { var history = new HistoryWithHash({ win: _.merge( { history: { state: { foo: 'bar' } } }, - windowMock.HTML5 + windowMock.HTML5, ), }); expect(history.getState()).toEqual({ foo: 'bar' }); @@ -412,7 +412,7 @@ describe('HistoryWithHash', function () { expect(testResult.replaceState.state).toEqual({ foo: 'bar' }); expect(testResult.replaceState.title).toBe('t'); expect(testResult.replaceState.url).toBe( - '/path?foo=bar#/url?a=b&x=y' + '/path?foo=bar#/url?a=b&x=y', ); }); it('useHashRouter=true; has pushState; has hashRouteTransformer', function () { @@ -440,7 +440,7 @@ describe('HistoryWithHash', function () { expect(testResult.replaceState.state).toEqual({ foo: 'bar' }); expect(testResult.replaceState.title).toBe('t'); expect(testResult.replaceState.url).toBe( - '/path?foo=bar#-url+a=b&x=y' + '/path?foo=bar#-url+a=b&x=y', ); }); it('useHashRoute=true; no pushState', function () { @@ -458,7 +458,7 @@ describe('HistoryWithHash', function () { expect(testResult.locationReplace.url).toBe('/path?foo=bar#/url'); history.replaceState({ foo: 'bar' }, 't', '/url?a=b&x=y'); expect(testResult.locationReplace.url).toBe( - '/path?foo=bar#/url?a=b&x=y' + '/path?foo=bar#/url?a=b&x=y', ); testResult.locationReplace.url = null; history.replaceState({ foo: 'bar' }); diff --git a/packages/fluxible-router/tests/unit/NavLink.test.js b/packages/fluxible-router/tests/unit/NavLink.test.js index 85d5a5b1..af193fbd 100644 --- a/packages/fluxible-router/tests/unit/NavLink.test.js +++ b/packages/fluxible-router/tests/unit/NavLink.test.js @@ -143,7 +143,7 @@ describe('NavLink', () => { }); expect(link.getAttribute('class')).toBe('foo'); expect(link.getAttribute('style')).toEqual( - 'background-color: rgb(0, 0, 0);' + 'background-color: rgb(0, 0, 0);', ); }); @@ -171,7 +171,7 @@ describe('NavLink', () => { }); expect(link.getAttribute('class')).toBe('bar'); expect(link.getAttribute('style').replace(/ /g, '')).toBe( - 'color:red;' + 'color:red;', ); }); @@ -186,7 +186,7 @@ describe('NavLink', () => { expect(link.getAttribute('class')).toBe('bar active2'); expect(link.getAttribute('style').replace(/ /g, '')).toBe( - 'background:blue;color:red;' + 'background:blue;color:red;', ); }); @@ -209,7 +209,7 @@ describe('NavLink', () => { }; const component = React.createElement( createNavLinkComponent({ getDefaultChildProps: () => props }), - { routeName: 'foo' } + { routeName: 'foo' }, ); renderComponent(component, context); @@ -235,7 +235,7 @@ describe('NavLink', () => { expect(context.executeActionCalls[0].payload.type).toBe('click'); expect(context.executeActionCalls[0].payload.url).toBe('/foo'); expect( - context.executeActionCalls[0].payload.preserveScrollPosition + context.executeActionCalls[0].payload.preserveScrollPosition, ).toBe(true); expect(context.executeActionCalls[0].payload.params).toEqual({ a: 1, @@ -255,7 +255,7 @@ describe('NavLink', () => { createNavLinkComponent({ getNavParams: () => ({ a: 2, b: false }), }), - props + props, ); const context = createContext(); @@ -268,7 +268,7 @@ describe('NavLink', () => { expect(context.executeActionCalls[0].payload.type).toBe('click'); expect(context.executeActionCalls[0].payload.url).toBe('/foo'); expect( - context.executeActionCalls[0].payload.preserveScrollPosition + context.executeActionCalls[0].payload.preserveScrollPosition, ).toBe(true); expect(context.executeActionCalls[0].payload.params).toEqual({ a: 2, @@ -504,7 +504,7 @@ describe('NavLink', () => { simulateClick(link); expect(loggerWarning[0]).toBe( - 'Warning: Call of window.onbeforeunload failed' + 'Warning: Call of window.onbeforeunload failed', ); expect(loggerWarning[1].message).toBe('Test error'); expect(context.executeActionCalls.length).toBe(1); @@ -514,7 +514,7 @@ describe('NavLink', () => { it('should throw if context not available', () => { expect(() => { ReactTestUtils.renderIntoDocument( - + , ); }).toThrowError(); }); @@ -528,10 +528,10 @@ describe('NavLink', () => { expect(context.executeActionCalls.length).toBe(1); expect(context.executeActionCalls[0].action).toBe( - navigateAction + navigateAction, ); expect(context.executeActionCalls[0].payload.type).toBe( - 'click' + 'click', ); }); @@ -545,10 +545,10 @@ describe('NavLink', () => { simulateClick(link); expect(context.executeActionCalls[0].action).toBe( - navigateAction + navigateAction, ); expect(context.executeActionCalls[0].payload.type).toBe( - 'replacestate' + 'replacestate', ); }); @@ -659,7 +659,7 @@ describe('NavLink NODE_ENV === production', () => { expect(link.textContent).toBe('bar'); expect(spy).toHaveBeenCalledWith( 'Error: Render NavLink with empty or missing href', - expect.anything() + expect.anything(), ); }); @@ -669,7 +669,7 @@ describe('NavLink NODE_ENV === production', () => { expect(link.textContent).toBe('bar'); expect(spy).toHaveBeenCalledWith( 'Error: Render NavLink with empty or missing href', - expect.anything() + expect.anything(), ); }); }); diff --git a/packages/fluxible-router/tests/unit/RouteStore.test.js b/packages/fluxible-router/tests/unit/RouteStore.test.js index 5a96a4bf..6d1268f9 100644 --- a/packages/fluxible-router/tests/unit/RouteStore.test.js +++ b/packages/fluxible-router/tests/unit/RouteStore.test.js @@ -52,7 +52,7 @@ describe('RouteStore', function () { }); expect(newStore.getCurrentRoute()).toBeInstanceOf(Object); expect(newStore.getCurrentNavigate().transactionId).toBe( - 'first' + 'first', ); expect(newStore.getCurrentNavigate().url).toBe('/foo'); expect(newStore.getCurrentNavigate().method).toBe('get'); @@ -122,7 +122,7 @@ describe('RouteStore', function () { method: 'get', }); expect(routeStore.getCurrentNavigate().transactionId).toBe( - 'second' + 'second', ); }); it('should update transactionId with same url navigation', function () { @@ -132,7 +132,7 @@ describe('RouteStore', function () { method: 'get', }); expect(routeStore.getCurrentNavigate().transactionId).toBe( - 'second' + 'second', ); }); }); diff --git a/packages/fluxible-router/tests/unit/handleHistory.test.js b/packages/fluxible-router/tests/unit/handleHistory.test.js index 6abefb1c..c0bc77e2 100644 --- a/packages/fluxible-router/tests/unit/handleHistory.test.js +++ b/packages/fluxible-router/tests/unit/handleHistory.test.js @@ -135,7 +135,7 @@ describe('handleHistory', function () { ReactTestUtils.renderIntoDocument( - + , ); expect(rendered).toBe(true); }); @@ -145,25 +145,25 @@ describe('handleHistory', function () { it('listen to popstate event', function () { var MockAppComponent = mockCreator(); ReactTestUtils.renderIntoDocument( - + , ); window.dispatchEvent( Object.assign(new Event('popstate'), { state: { params: { a: 1 } }, - }) + }), ); expect(mockContext.executeActionCalls.length).toBe(1); expect(mockContext.executeActionCalls[0].action).toBeInstanceOf( - Function + Function, ); expect(mockContext.executeActionCalls[0].payload.type).toBe( - 'popstate' + 'popstate', ); expect(mockContext.executeActionCalls[0].payload.url).toBe( - window.location.pathname + window.location.pathname, ); expect( - mockContext.executeActionCalls[0].payload.params + mockContext.executeActionCalls[0].payload.params, ).toEqual({ a: 1 }); }); it('handle pre-emptive popstate events', function (done) { @@ -171,34 +171,34 @@ describe('handleHistory', function () { window.dispatchEvent( Object.assign(new Event('popstate'), { state: { params: { a: 1 } }, - }) + }), ); window.dispatchEvent( Object.assign(new Event('popstate'), { state: { params: { a: 2 } }, - }) + }), ); window.dispatchEvent( Object.assign(new Event('popstate'), { state: { params: { a: 3 } }, - }) + }), ); setTimeout(function () { ReactTestUtils.renderIntoDocument( - + , ); expect(mockContext.executeActionCalls.length).toBe(1); expect( - mockContext.executeActionCalls[0].action + mockContext.executeActionCalls[0].action, ).toBeInstanceOf(Function); expect(mockContext.executeActionCalls[0].payload.type).toBe( - 'popstate' + 'popstate', ); expect(mockContext.executeActionCalls[0].payload.url).toBe( - window.location.pathname + window.location.pathname, ); expect( - mockContext.executeActionCalls[0].payload.params + mockContext.executeActionCalls[0].payload.params, ).toEqual({ a: 3 }); done(); }, 10); @@ -215,7 +215,7 @@ describe('handleHistory', function () { }, }); ReactTestUtils.renderIntoDocument( - + , ); window.scrollY = 0; window.dispatchEvent(new Event('scroll')); @@ -253,18 +253,18 @@ describe('handleHistory', function () { }, }); ReactTestUtils.renderIntoDocument( - + , ); window.setTimeout(function () { expect(mockContext.executeActionCalls.length).toBe(1); expect( - mockContext.executeActionCalls[0].action + mockContext.executeActionCalls[0].action, ).toBeInstanceOf(Function); expect(mockContext.executeActionCalls[0].payload.type).toBe( - 'pageload' + 'pageload', ); expect(mockContext.executeActionCalls[0].payload.url).toBe( - '/the_path_from_history' + '/the_path_from_history', ); done(); }, 150); @@ -281,7 +281,7 @@ describe('handleHistory', function () { }, }); ReactTestUtils.renderIntoDocument( - + , ); window.setTimeout(function () { expect(testResult.dispatch).toBe(undefined); @@ -305,23 +305,23 @@ describe('handleHistory', function () { // simulate page load popstate window.dispatchEvent( - Object.assign(new Event('popstate'), { state: null }) + Object.assign(new Event('popstate'), { state: null }), ); ReactTestUtils.renderIntoDocument( - + , ); setTimeout(function () { expect(mockContext.executeActionCalls.length).toBe(1); expect( - mockContext.executeActionCalls[0].action + mockContext.executeActionCalls[0].action, ).toBeInstanceOf(Function); expect( - mockContext.executeActionCalls[0].payload.type + mockContext.executeActionCalls[0].payload.type, ).toBe('popstate'); expect( - mockContext.executeActionCalls[0].payload.url + mockContext.executeActionCalls[0].payload.url, ).toBe('/browserUrl'); done(); }, 150); @@ -342,11 +342,11 @@ describe('handleHistory', function () { // simulate page load popstate window.dispatchEvent( - Object.assign(new Event('popstate'), { state: null }) + Object.assign(new Event('popstate'), { state: null }), ); ReactTestUtils.renderIntoDocument( - + , ); setTimeout(function () { @@ -372,23 +372,23 @@ describe('handleHistory', function () { // simulate page load popstate window.dispatchEvent( - Object.assign(new Event('popstate'), { state: null }) + Object.assign(new Event('popstate'), { state: null }), ); ReactTestUtils.renderIntoDocument( - + , ); setTimeout(function () { expect(mockContext.executeActionCalls.length).toBe(1); expect( - mockContext.executeActionCalls[0].action + mockContext.executeActionCalls[0].action, ).toBeInstanceOf(Function); expect( - mockContext.executeActionCalls[0].payload.type + mockContext.executeActionCalls[0].payload.type, ).toBe('popstate'); expect( - mockContext.executeActionCalls[0].payload.url + mockContext.executeActionCalls[0].payload.url, ).toBe('/browserUrl'); done(); }, 150); @@ -411,11 +411,11 @@ describe('handleHistory', function () { // simulate page load popstate window.dispatchEvent( - Object.assign(new Event('popstate'), { state: null }) + Object.assign(new Event('popstate'), { state: null }), ); ReactTestUtils.renderIntoDocument( - + , ); setTimeout(function () { @@ -428,7 +428,7 @@ describe('handleHistory', function () { var MockAppComponent; beforeEach(function () { global.window.dispatchEvent( - Object.assign(new Event('popstate'), {}) + Object.assign(new Event('popstate'), {}), ); var routeStore = mockContext.getStore('RouteStore'); routeStore._handleNavigateStart({ @@ -450,12 +450,12 @@ describe('handleHistory', function () { }, }); ReactTestUtils.renderIntoDocument( - + , ); window.setTimeout(function () { expect(testResult.pushState).toHaveLength(1); expect(testResult.pushState[0].url).toBe( - '/the_path_from_history' + '/the_path_from_history', ); expect(mockContext.executeActionCalls.length).toBe(0); done(); @@ -479,11 +479,11 @@ describe('handleHistory', function () { }, }); ReactTestUtils.renderIntoDocument( - + , ); window.setTimeout(function () { expect(loggerWarning[0]).toBe( - 'Warning: Call of window.onbeforeunload failed' + 'Warning: Call of window.onbeforeunload failed', ); expect(loggerWarning[1].message).toBe('Test error'); expect(testResult.pushState).toBeUndefined(); @@ -504,14 +504,14 @@ describe('handleHistory', function () { }); ReactDOM.render( , - div + div, ); ReactDOM.unmountComponentAtNode(div); expect(testResult.historyMockOn).toBeNull(); window.dispatchEvent( Object.assign(new Event('popstate'), { state: { params: { a: 1 } }, - }) + }), ); expect(testResult.dispatch).toBeUndefined(); }); @@ -527,7 +527,7 @@ describe('handleHistory', function () { }, }); ReactTestUtils.renderIntoDocument( - + , ); routeStore._handleNavigateStart({ url: '/foo', method: 'GET' }); expect(testResult.pushState).toBeUndefined(); @@ -541,7 +541,7 @@ describe('handleHistory', function () { }, }); ReactTestUtils.renderIntoDocument( - + , ); routeStore._handleNavigateStart({ url: '/bar', @@ -559,7 +559,7 @@ describe('handleHistory', function () { }, }); ReactTestUtils.renderIntoDocument( - + , ); routeStore._handleNavigateStart({ url: '/bar', method: 'GET' }); expect(testResult.pushState[0]).toEqual({ @@ -578,7 +578,7 @@ describe('handleHistory', function () { }, }); ReactTestUtils.renderIntoDocument( - + , ); routeStore._handleNavigateStart({ url: '/föö', method: 'GET' }); expect(testResult.pushState[0]).toEqual({ @@ -598,7 +598,7 @@ describe('handleHistory', function () { }, }); ReactTestUtils.renderIntoDocument( - + , ); routeStore._handleNavigateStart({ url: '/bar', method: 'GET' }); expect(testResult.pushState[0]).toEqual({ @@ -618,7 +618,7 @@ describe('handleHistory', function () { }, }); ReactTestUtils.renderIntoDocument( - + , ); routeStore._handleNavigateStart({ url: '/bar', @@ -641,7 +641,7 @@ describe('handleHistory', function () { }, }); ReactTestUtils.renderIntoDocument( - + , ); routeStore._handleNavigateStart({ url: '/bar', method: 'GET' }); expect(testResult.pushState[0]).toEqual({ @@ -663,7 +663,7 @@ describe('handleHistory', function () { }, }); ReactTestUtils.renderIntoDocument( - + , ); routeStore._handleNavigateStart({ url: '/bar', method: 'GET' }); expect(testResult.pushState[0]).toEqual({ @@ -684,7 +684,7 @@ describe('handleHistory', function () { }, }); ReactTestUtils.renderIntoDocument( - + , ); routeStore._handleNavigateStart({ url: '/foo#hash1', @@ -706,7 +706,7 @@ describe('handleHistory', function () { }, }); ReactTestUtils.renderIntoDocument( - + , ); routeStore._handleNavigateStart({ url: '/bar', @@ -726,7 +726,7 @@ describe('handleHistory', function () { }, }); ReactTestUtils.renderIntoDocument( - + , ); routeStore._handleNavigateStart({ url: '/bar', @@ -744,7 +744,7 @@ describe('handleHistory', function () { }, }); ReactTestUtils.renderIntoDocument( - + , ); routeStore._handleNavigateStart({ url: '/bar', @@ -773,7 +773,7 @@ describe('handleHistory', function () { }, }); ReactTestUtils.renderIntoDocument( - + , ); routeStore._handleNavigateStart({ url: '/foo#hash2', @@ -799,7 +799,7 @@ describe('handleHistory', function () { }, }); ReactTestUtils.renderIntoDocument( - + , ); routeStore._handleNavigateStart({ url: '/bar', @@ -826,7 +826,7 @@ describe('handleHistory', function () { }, }); ReactTestUtils.renderIntoDocument( - + , ); routeStore._handleNavigateStart({ url: '/bar', @@ -850,7 +850,7 @@ describe('handleHistory', function () { }, }); ReactTestUtils.renderIntoDocument( - + , ); routeStore._handleNavigateStart({ url: '/bar', @@ -875,7 +875,7 @@ describe('handleHistory', function () { }, }); ReactTestUtils.renderIntoDocument( - + , ); routeStore._handleNavigateStart({ url: '/bar', diff --git a/packages/fluxible-router/tests/unit/navigateAction.test.js b/packages/fluxible-router/tests/unit/navigateAction.test.js index 03f5bbba..44385939 100644 --- a/packages/fluxible-router/tests/unit/navigateAction.test.js +++ b/packages/fluxible-router/tests/unit/navigateAction.test.js @@ -74,15 +74,15 @@ describe('navigateAction', function () { expect(err).toBeUndefined(); expect(mockContext.dispatchCalls.length).toBe(2); expect(mockContext.dispatchCalls[0].name).toBe( - 'NAVIGATE_START' + 'NAVIGATE_START', ); expect(mockContext.dispatchCalls[0].payload.url).toBe('/'); expect(mockContext.dispatchCalls[1].name).toBe( - 'NAVIGATE_SUCCESS' + 'NAVIGATE_SUCCESS', ); expect(mockContext.dispatchCalls[1].payload.url).toBe('/'); done(); - } + }, ); }); @@ -97,7 +97,7 @@ describe('navigateAction', function () { expect(err).toBeUndefined(); expect(mockContext.dispatchCalls.length).toBe(2); expect(mockContext.dispatchCalls[0].name).toBe( - 'NAVIGATE_START' + 'NAVIGATE_START', ); var route = mockContext .getStore('RouteStore') @@ -108,15 +108,15 @@ describe('navigateAction', function () { bool: '', }); expect(mockContext.dispatchCalls[1].name).toBe( - 'NAVIGATE_SUCCESS' + 'NAVIGATE_SUCCESS', ); var navigateSuccessPayload = mockContext.dispatchCalls[1].payload; expect(navigateSuccessPayload.route.url).toBe( - url.split('#')[0] + url.split('#')[0], ); done(); - } + }, ); }); @@ -154,7 +154,7 @@ describe('navigateAction', function () { function () { expect(mockContext.executeActionCalls.length).toBe(0); done(); - } + }, ); }); @@ -168,20 +168,20 @@ describe('navigateAction', function () { expect(err).toBeUndefined(); expect(mockContext.dispatchCalls.length).toBe(2); expect(mockContext.dispatchCalls[1].name).toBe( - 'NAVIGATE_SUCCESS' + 'NAVIGATE_SUCCESS', ); expect(mockContext.dispatchCalls[1].payload.url).toBe( - '/action' + '/action', ); expect(mockContext.executeActionCalls.length).toBe(1); expect(mockContext.executeActionCalls[0].action).toBe( - routes.action.action + routes.action.action, ); expect(mockContext.executeActionCalls[0].payload.url).toBe( - '/action' + '/action', ); done(); - } + }, ); }); @@ -195,20 +195,20 @@ describe('navigateAction', function () { expect(err).toBeUndefined(); expect(mockContext.dispatchCalls.length).toBe(2); expect(mockContext.dispatchCalls[1].name).toBe( - 'NAVIGATE_SUCCESS' + 'NAVIGATE_SUCCESS', ); expect(mockContext.dispatchCalls[1].payload.url).toBe( - '/string' + '/string', ); expect(mockContext.executeActionCalls.length).toBe(1); expect(mockContext.executeActionCalls[0].action).toBe( - fooAction + fooAction, ); expect(mockContext.executeActionCalls[0].payload.url).toBe( - '/string' + '/string', ); done(); - } + }, ); }); @@ -222,19 +222,19 @@ describe('navigateAction', function () { expect(err).toBeInstanceOf(Error); expect(mockContext.dispatchCalls.length).toBe(2); expect(mockContext.dispatchCalls[1].name).toBe( - 'NAVIGATE_FAILURE' + 'NAVIGATE_FAILURE', ); expect( - mockContext.dispatchCalls[1].payload.error + mockContext.dispatchCalls[1].payload.error, ).toBeInstanceOf(Object); expect(mockContext.dispatchCalls[1].payload.error.message).toBe( - err.message + err.message, ); expect( - mockContext.getStore(RouteStore).isNavigateComplete() + mockContext.getStore(RouteStore).isNavigateComplete(), ).toBe(true); done(); - } + }, ); }); @@ -248,7 +248,7 @@ describe('navigateAction', function () { expect(err).toBeInstanceOf(Error); expect(err.statusCode).toBe(404); done(); - } + }, ); }); @@ -263,7 +263,7 @@ describe('navigateAction', function () { expect(err).toBeInstanceOf(Error); expect(err.statusCode).toBe(404); done(); - } + }, ); }); @@ -278,15 +278,15 @@ describe('navigateAction', function () { expect(err).toBeUndefined(); expect(mockContext.dispatchCalls.length).toBe(2); expect(mockContext.dispatchCalls[0].name).toBe( - 'NAVIGATE_START' + 'NAVIGATE_START', ); expect(mockContext.dispatchCalls[0].payload.url).toBe('/post'); expect(mockContext.dispatchCalls[1].name).toBe( - 'NAVIGATE_SUCCESS' + 'NAVIGATE_SUCCESS', ); expect(mockContext.dispatchCalls[1].payload.url).toBe('/post'); done(); - } + }, ); }); @@ -300,23 +300,23 @@ describe('navigateAction', function () { function (err) { expect(err.statusCode).toBe(500); expect(err.message).toBe( - 'Action for /noMatchedAction can not be resolved' + 'Action for /noMatchedAction can not be resolved', ); expect(mockContext.dispatchCalls.length).toBe(2); expect(mockContext.dispatchCalls[0].name).toBe( - 'NAVIGATE_START' + 'NAVIGATE_START', ); expect(mockContext.dispatchCalls[0].payload.url).toBe( - '/noMatchedAction' + '/noMatchedAction', ); expect(mockContext.dispatchCalls[1].name).toBe( - 'NAVIGATE_FAILURE' + 'NAVIGATE_FAILURE', ); expect(mockContext.dispatchCalls[1].payload.url).toBe( - '/noMatchedAction' + '/noMatchedAction', ); done(); - } + }, ); }); @@ -330,15 +330,15 @@ describe('navigateAction', function () { expect(err).toBeUndefined(); expect(mockContext.dispatchCalls.length).toBe(2); expect(mockContext.dispatchCalls[0].name).toBe( - 'NAVIGATE_START' + 'NAVIGATE_START', ); expect(mockContext.dispatchCalls[0].payload.url).toBe('/'); expect(mockContext.dispatchCalls[1].name).toBe( - 'NAVIGATE_SUCCESS' + 'NAVIGATE_SUCCESS', ); expect(mockContext.dispatchCalls[1].payload.url).toBe('/'); done(); - } + }, ); }); @@ -353,19 +353,19 @@ describe('navigateAction', function () { expect(err).toBeUndefined(); expect(mockContext.dispatchCalls.length).toBe(2); expect(mockContext.dispatchCalls[0].name).toBe( - 'NAVIGATE_START' + 'NAVIGATE_START', ); expect(mockContext.dispatchCalls[0].payload.url).toBe( - '/withParams/5' + '/withParams/5', ); expect(mockContext.dispatchCalls[1].name).toBe( - 'NAVIGATE_SUCCESS' + 'NAVIGATE_SUCCESS', ); expect(mockContext.dispatchCalls[1].payload.url).toBe( - '/withParams/5' + '/withParams/5', ); done(); - } + }, ); }); @@ -381,19 +381,19 @@ describe('navigateAction', function () { expect(err).toBeUndefined(); expect(mockContext.dispatchCalls.length).toBe(2); expect(mockContext.dispatchCalls[0].name).toBe( - 'NAVIGATE_START' + 'NAVIGATE_START', ); expect(mockContext.dispatchCalls[0].payload.url).toBe( - '/withParams/5?foo=bar' + '/withParams/5?foo=bar', ); expect(mockContext.dispatchCalls[1].name).toBe( - 'NAVIGATE_SUCCESS' + 'NAVIGATE_SUCCESS', ); expect(mockContext.dispatchCalls[1].payload.url).toBe( - '/withParams/5?foo=bar' + '/withParams/5?foo=bar', ); done(); - } + }, ); }); @@ -414,10 +414,10 @@ describe('navigateAction', function () { function (err) { expect(err).toBeInstanceOf(Error); expect(err.message).toBe( - 'RouteStore has not implemented `getCurrentRoute` method.' + 'RouteStore has not implemented `getCurrentRoute` method.', ); done(); - } + }, ); }); }); diff --git a/packages/fluxible/lib/Fluxible.js b/packages/fluxible/lib/Fluxible.js index 17cb72ba..0ae5e582 100644 --- a/packages/fluxible/lib/Fluxible.js +++ b/packages/fluxible/lib/Fluxible.js @@ -82,7 +82,7 @@ Fluxible.prototype.createContext = function createContext(options) { * @returns {Dispatcher} */ Fluxible.prototype.createDispatcherInstance = function createDispatcherInstance( - contextOptions + contextOptions, ) { return this._dispatcher.createContext(contextOptions); }; @@ -181,7 +181,7 @@ Fluxible.prototype.rehydrate = function rehydrate(obj, callback) { throw new Error( '`rehydrate` called with a non-object. Ensure ' + 'that the parameter passed to rehydrate is a state object ' + - 'produced by a dehydrate call.' + 'produced by a dehydrate call.', ); } } @@ -203,7 +203,7 @@ Fluxible.prototype.rehydrate = function rehydrate(obj, callback) { } else { resolve(); } - } + }, ); if (isPromise(result)) { result.then(resolve, reject); @@ -217,7 +217,7 @@ Fluxible.prototype.rehydrate = function rehydrate(obj, callback) { var rehydratePromise = Promise.all(pluginTasks).then( function rehydratePluginTasks() { return context.rehydrate(obj.context || {}); - } + }, ); if (callback) { diff --git a/packages/fluxible/lib/FluxibleContext.js b/packages/fluxible/lib/FluxibleContext.js index 024528b5..b5a467c9 100644 --- a/packages/fluxible/lib/FluxibleContext.js +++ b/packages/fluxible/lib/FluxibleContext.js @@ -116,7 +116,7 @@ function executeActionProxy(context, actionContext, action, payload, done) { if (!action) { throw new Error( 'executeAction called with an invalid action. Action ' + - 'must be a function.' + 'must be a function.', ); } } @@ -138,25 +138,25 @@ function executeActionProxy(context, actionContext, action, payload, done) { displayName + '` will only start after `' + currentActionDisplayName + - '` is complete.' + '` is complete.', ); } } - context._executeActionPlugins.forEach(function pluginsEach( - executeActionPlugin - ) { - var pluggedExecuteAction = executeActionPlugin({ - actionContext: actionContext, - action: action, - payload: payload, - done: done, - }); - actionContext = pluggedExecuteAction.actionContext; - action = pluggedExecuteAction.action; - payload = pluggedExecuteAction.payload; - done = pluggedExecuteAction.done; - }); + context._executeActionPlugins.forEach( + function pluginsEach(executeActionPlugin) { + var pluggedExecuteAction = executeActionPlugin({ + actionContext: actionContext, + action: action, + payload: payload, + done: done, + }); + actionContext = pluggedExecuteAction.actionContext; + action = pluggedExecuteAction.action; + payload = pluggedExecuteAction.payload; + done = pluggedExecuteAction.done; + }, + ); return callAction(actionContext, action, payload, done); } @@ -172,11 +172,11 @@ function executeActionProxy(context, actionContext, action, payload, done) { FluxContext.prototype.executeAction = function executeAction( action, payload, - done + done, ) { var subActionContext = this._createSubActionContext( this.getActionContext(), - action + action, ); return executeActionProxy(this, subActionContext, action, payload, done); }; @@ -188,7 +188,7 @@ FluxContext.prototype.executeAction = function executeAction( */ FluxContext.prototype._initializeDispatcher = function initializeDispatcher() { this._dispatcher = this._app.createDispatcherInstance( - this.getStoreContext() + this.getStoreContext(), ); }; @@ -204,7 +204,7 @@ FluxContext.prototype._initializeDispatcher = function initializeDispatcher() { */ FluxContext.prototype._createSubActionContext = function createSubActionContext( parentActionContext, - action + action, ) { /* * We store the action's stack array on the `stack` property @@ -246,14 +246,14 @@ FluxContext.prototype.getActionContext = function getActionContext() { // `this` will be the current action context var subActionContext = self._createSubActionContext( this, - action + action, ); return executeActionProxy( self, subActionContext, action, payload, - callback + callback, ); }, getStore: self._dispatcher.getStore.bind(self._dispatcher), @@ -295,7 +295,7 @@ FluxContext.prototype.getComponentContext = function getComponentContext() { console.warn( 'When calling executeAction from a component, ' + "a callback isn't allowed. See our docs for more info: " + - 'http://fluxible.io/api/components.html#component-context' + 'http://fluxible.io/api/components.html#component-context', ); } } @@ -306,7 +306,7 @@ FluxContext.prototype.getComponentContext = function getComponentContext() { { actionName: action.displayName || action.name, err: err, - } + }, ); }) .catch(function unhandledError(err) { @@ -392,7 +392,7 @@ FluxContext.prototype.rehydrate = function rehydrate(obj) { throw new Error( '`rehydrate` called with a non-object. Ensure ' + 'that the parameter passed to rehydrate is a state object ' + - 'produced by a dehydrate call.' + 'produced by a dehydrate call.', ); } } @@ -417,7 +417,7 @@ FluxContext.prototype.rehydrate = function rehydrate(obj) { } else { resolve(); } - } + }, ); if (isPromise(result)) { result.then(resolve, reject); @@ -429,7 +429,7 @@ FluxContext.prototype.rehydrate = function rehydrate(obj) { return Promise.all(pluginTasks).then(function rehydratePluginTasks() { self._dispatcher = self._app.createDispatcherInstance( - self.getStoreContext() + self.getStoreContext(), ); self._dispatcher.rehydrate(obj.dispatcher || {}); return self; diff --git a/packages/fluxible/tests/fixtures/plugins/TestApplicationPlugin.js b/packages/fluxible/tests/fixtures/plugins/TestApplicationPlugin.js index 7e53f714..db533c6b 100644 --- a/packages/fluxible/tests/fixtures/plugins/TestApplicationPlugin.js +++ b/packages/fluxible/tests/fixtures/plugins/TestApplicationPlugin.js @@ -20,7 +20,7 @@ module.exports = function TestApplicationPlugin(initialFoo, initialBar) { }; }, plugComponentContext: function plugComponentContext( - componentContext + componentContext, ) { componentContext.getFoo = function () { return foo; diff --git a/packages/fluxible/tests/fixtures/plugins/TestApplicationPluginPromise.js b/packages/fluxible/tests/fixtures/plugins/TestApplicationPluginPromise.js index 447fe712..188dae17 100644 --- a/packages/fluxible/tests/fixtures/plugins/TestApplicationPluginPromise.js +++ b/packages/fluxible/tests/fixtures/plugins/TestApplicationPluginPromise.js @@ -20,7 +20,7 @@ module.exports = function TestApplicationPlugin(initialFoo, initialBar) { }; }, plugComponentContext: function plugComponentContext( - componentContext + componentContext, ) { componentContext.getFoo = function () { return foo; diff --git a/packages/fluxible/tests/fixtures/plugins/TestApplicationPluginSync.js b/packages/fluxible/tests/fixtures/plugins/TestApplicationPluginSync.js index 4a761109..0b498492 100644 --- a/packages/fluxible/tests/fixtures/plugins/TestApplicationPluginSync.js +++ b/packages/fluxible/tests/fixtures/plugins/TestApplicationPluginSync.js @@ -20,7 +20,7 @@ module.exports = function TestApplicationPlugin(initialFoo, initialBar) { }; }, plugComponentContext: function plugComponentContext( - componentContext + componentContext, ) { componentContext.getFoo = function () { return foo; diff --git a/packages/fluxible/tests/unit/lib/FluxibleContext.test.js b/packages/fluxible/tests/unit/lib/FluxibleContext.test.js index dbc98a89..0c6f8959 100644 --- a/packages/fluxible/tests/unit/lib/FluxibleContext.test.js +++ b/packages/fluxible/tests/unit/lib/FluxibleContext.test.js @@ -126,9 +126,9 @@ describe('FluxibleContext', function () { payload, function actionOneSecondCallback() { cb(); - } + }, ); - } + }, ); }, function (cb) { @@ -137,18 +137,18 @@ describe('FluxibleContext', function () { payload, function actionOneThirdcallback() { cb(); - } + }, ); }, async.apply( context.executeAction, actionFour, - payload + payload, ), ], function (err) { callback(err); - } + }, ); }; actionOne.displayName = 'One'; @@ -196,35 +196,35 @@ describe('FluxibleContext', function () { expectToHaveActionContextProperties(actionCalls[1]); expect(actionCalls[1].context.rootId).toBe(firstId); expect(actionCalls[1].context.stack.join('.')).toBe( - 'One.Two' + 'One.Two', ); expect(actionCalls[1].payload).toBe(payload); expectToHaveActionContextProperties(actionCalls[2]); expect(actionCalls[2].context.rootId).toBe(firstId); expect(actionCalls[2].context.stack.join('.')).toBe( - 'One.Two' + 'One.Two', ); expect(actionCalls[2].payload).toBe(payload); expectToHaveActionContextProperties(actionCalls[3]); expect(actionCalls[3].context.rootId).toBe(firstId); expect(actionCalls[3].context.stack.join('.')).toBe( - 'One.Three' + 'One.Three', ); expect(actionCalls[3].payload).toBe(payload); expectToHaveActionContextProperties(actionCalls[4]); expect(actionCalls[4].context.rootId).toBe(firstId); expect(actionCalls[4].context.stack.join('.')).toBe( - 'One.Four' + 'One.Four', ); expect(actionCalls[4].payload).toBe(payload); expectToHaveActionContextProperties(actionCalls[5]); expect(actionCalls[5].context.rootId).toBe(firstId); expect(actionCalls[5].context.stack.join('.')).toBe( - 'One.Four.Five' + 'One.Four.Five', ); expect(actionCalls[5].payload).toBe(payload); done(); @@ -244,7 +244,7 @@ describe('FluxibleContext', function () { function (executeActionError) { expect(executeActionError).toBe(err); done(); - } + }, ); }); @@ -295,7 +295,7 @@ describe('FluxibleContext', function () { expect(err).toBeNull(); expect(result).toBe(payload); done(); - } + }, ); }); @@ -462,7 +462,7 @@ describe('FluxibleContext', function () { warningCalls = []; console.warn = function () { warningCalls.push( - Array.prototype.slice.call(arguments) + Array.prototype.slice.call(arguments), ); }; @@ -512,7 +512,7 @@ describe('FluxibleContext', function () { 'Warning: executeAction for `action2` was ' + 'called, but `TEST` is currently being dispatched. This could mean there are ' + 'cascading updates, which should be avoided. `action2` will only start after ' + - '`TEST` is complete.' + '`TEST` is complete.', ); expect(action1ExecuteCount).toBe(1); expect(action2ExecuteCount).toBe(1); @@ -520,7 +520,7 @@ describe('FluxibleContext', function () { } catch (e) { done(e); } - } + }, ); }); @@ -583,9 +583,9 @@ describe('FluxibleContext', function () { payload, function actionOneSecondCallback() { cb(); - } + }, ); - } + }, ); }, function (cb) { @@ -594,7 +594,7 @@ describe('FluxibleContext', function () { payload, function actionOneThirdcallback() { cb(); - } + }, ); }, ], @@ -607,39 +607,39 @@ describe('FluxibleContext', function () { expectToHaveActionContextProperties(actionCalls[0]); var firstId = actionCalls[0].context.rootId; expect(actionCalls[0].context.stack.join('.')).toBe( - 'One' + 'One', ); expect(actionCalls[0].payload).toBe(payload); expectToHaveActionContextProperties(actionCalls[1]); expect(actionCalls[1].context.rootId).toBe(firstId); expect(actionCalls[1].context.stack.join('.')).toBe( - 'One.Two' + 'One.Two', ); expect(actionCalls[1].payload).toBe(payload); expectToHaveActionContextProperties(actionCalls[2]); expect(actionCalls[2].context.rootId).toBe(firstId); expect(actionCalls[2].context.stack.join('.')).toBe( - 'One.Two' + 'One.Two', ); expect(actionCalls[2].payload).toBe(payload); expectToHaveActionContextProperties(actionCalls[3]); expect(actionCalls[3].context.rootId).toBe(firstId); expect(actionCalls[3].context.stack.join('.')).toBe( - 'One.Three' + 'One.Three', ); expect(actionCalls[3].payload).toBe(payload); expectToHaveActionContextProperties(actionCalls[4]); expect(actionCalls[4].context.rootId).toBe(firstId); expect(actionCalls[4].context.stack.join('.')).toBe( - 'One.Three.Four' + 'One.Three.Four', ); expect(actionCalls[4].payload).toBe(payload); done(); - } + }, ); }; actionOne.displayName = 'One'; @@ -708,7 +708,7 @@ describe('FluxibleContext', function () { d.run(function () { var componentActionErrorHandler = function ( context, - payload + payload, ) { throw payload.err; }; @@ -808,7 +808,7 @@ describe('FluxibleContext', function () { action: function modifiedAction( context, payload, - callback + callback, ) { modifiedActionCalled = true; args.action(context, payload, callback); @@ -860,7 +860,7 @@ describe('FluxibleContext', function () { expect(state.plugins).toBeInstanceOf(Object); expect(state.plugins.DimensionsPlugin).toBeInstanceOf(Object); expect(state.plugins.DimensionsPlugin.dimensions).toEqual( - dimensions + dimensions, ); var newContext = app.createContext(); newContext.plug(dimensionsPlugin()); @@ -868,13 +868,13 @@ describe('FluxibleContext', function () { .rehydrate(state) .then(function () { expect( - newContext.getActionContext().getDimensions() + newContext.getActionContext().getDimensions(), ).toEqual(dimensions); expect( - newContext.getComponentContext().getDimensions() + newContext.getComponentContext().getDimensions(), ).toEqual(dimensions); expect( - newContext.getStoreContext().getDimensions() + newContext.getStoreContext().getDimensions(), ).toEqual(dimensions); done(); }, done); @@ -888,7 +888,7 @@ describe('FluxibleContext', function () { expect(state.plugins).toBeInstanceOf(Object); expect(state.plugins.DimensionsPlugin).toBeInstanceOf(Object); expect(state.plugins.DimensionsPlugin.dimensions).toEqual( - dimensions + dimensions, ); var newContext = app.createContext(); newContext.plug(dimensionsPluginSync()); @@ -896,13 +896,13 @@ describe('FluxibleContext', function () { .rehydrate(state) .then(function () { expect( - newContext.getActionContext().getDimensions() + newContext.getActionContext().getDimensions(), ).toEqual(dimensions); expect( - newContext.getComponentContext().getDimensions() + newContext.getComponentContext().getDimensions(), ).toEqual(dimensions); expect( - newContext.getStoreContext().getDimensions() + newContext.getStoreContext().getDimensions(), ).toEqual(dimensions); done(); }, done); @@ -916,7 +916,7 @@ describe('FluxibleContext', function () { expect(state.plugins).toBeInstanceOf(Object); expect(state.plugins.DimensionsPlugin).toBeInstanceOf(Object); expect(state.plugins.DimensionsPlugin.dimensions).toEqual( - dimensions + dimensions, ); var newContext = app.createContext(); newContext.plug(dimensionsPluginPromise()); @@ -924,13 +924,13 @@ describe('FluxibleContext', function () { .rehydrate(state) .then(function () { expect( - newContext.getActionContext().getDimensions() + newContext.getActionContext().getDimensions(), ).toEqual(dimensions); expect( - newContext.getComponentContext().getDimensions() + newContext.getComponentContext().getDimensions(), ).toEqual(dimensions); expect( - newContext.getStoreContext().getDimensions() + newContext.getStoreContext().getDimensions(), ).toEqual(dimensions); done(); }, done); diff --git a/packages/fluxible/tests/unit/utils/createMockActionContext.test.js b/packages/fluxible/tests/unit/utils/createMockActionContext.test.js index 1b8801ff..7bee2dac 100644 --- a/packages/fluxible/tests/unit/utils/createMockActionContext.test.js +++ b/packages/fluxible/tests/unit/utils/createMockActionContext.test.js @@ -79,7 +79,7 @@ describe('createMockActionContext', function () { .executeAction(mockActionFailure, mockPayload) .then(function () { done( - new Error('should not have resolved successfully') + new Error('should not have resolved successfully'), ); }) .catch(function (error) { @@ -93,11 +93,10 @@ describe('createMockActionContext', function () { var result = context.executeAction(function ( context, payload, - fn + fn, ) { fn(null, returnValue); - }, - mockPayload); + }, mockPayload); expect(result.then).toBeInstanceOf(Function); result .then(function (r) { diff --git a/packages/fluxible/tests/unit/utils/promiseCallback.test.js b/packages/fluxible/tests/unit/utils/promiseCallback.test.js index 3ee64af4..7d42510d 100644 --- a/packages/fluxible/tests/unit/utils/promiseCallback.test.js +++ b/packages/fluxible/tests/unit/utils/promiseCallback.test.js @@ -108,7 +108,7 @@ describe('#promiseCallback', function () { }, { optimize: true, - } + }, ); }); it('should call callback when promise rejects', function (done) { @@ -125,7 +125,7 @@ describe('#promiseCallback', function () { }, { optimize: true, - } + }, ); }); it.skip('should not throw error from success callback in same cycle', function (done) { @@ -141,7 +141,7 @@ describe('#promiseCallback', function () { }, { optimize: true, - } + }, ); } catch (e) { caughtError = e; @@ -168,7 +168,7 @@ describe('#promiseCallback', function () { }, { optimize: true, - } + }, ); } catch (e) { caughtError = e; diff --git a/packages/fluxible/utils/MockActionContext.js b/packages/fluxible/utils/MockActionContext.js index 48e0878c..eddd7a99 100644 --- a/packages/fluxible/utils/MockActionContext.js +++ b/packages/fluxible/utils/MockActionContext.js @@ -28,7 +28,7 @@ MockActionContext.prototype.dispatch = function (name, payload) { MockActionContext.prototype.executeAction = function ( action, payload, - callback + callback, ) { this.executeActionCalls.push({ action: action, diff --git a/packages/fluxible/utils/MockComponentContext.js b/packages/fluxible/utils/MockComponentContext.js index 445d532c..966059b8 100644 --- a/packages/fluxible/utils/MockComponentContext.js +++ b/packages/fluxible/utils/MockComponentContext.js @@ -28,7 +28,7 @@ MockComponentContext.prototype.executeAction = function (action, payload) { dispatcherContext: this.dispatcherContext, }), payload, - noop + noop, ); }; diff --git a/packages/fluxible/utils/callAction.js b/packages/fluxible/utils/callAction.js index a976e18b..61bbeba3 100644 --- a/packages/fluxible/utils/callAction.js +++ b/packages/fluxible/utils/callAction.js @@ -26,7 +26,7 @@ function callAction(actionContext, action, payload, done) { } else { resolve(result); } - } + }, ); if (isPromise(syncResult)) { syncResult.then(resolve, reject); diff --git a/packages/fluxible/utils/promiseCallback.js b/packages/fluxible/utils/promiseCallback.js index b7b6f4b0..9eb564b5 100644 --- a/packages/fluxible/utils/promiseCallback.js +++ b/packages/fluxible/utils/promiseCallback.js @@ -37,7 +37,7 @@ function promiseCallback(promise, callbackFn, options) { function (err) { // Ensures that errors in callback are not swallowed by promise setImmediate(callbackFn, err); - } + }, ); } } diff --git a/packages/generator-fluxible/app/index.js b/packages/generator-fluxible/app/index.js index f837b0c8..16c30061 100644 --- a/packages/generator-fluxible/app/index.js +++ b/packages/generator-fluxible/app/index.js @@ -21,8 +21,8 @@ module.exports = class extends Generator { yosay( 'Welcome to the riveting ' + chalk.red('Fluxible') + - ' generator!' - ) + ' generator!', + ), ); this.answers = await this.prompt([ { @@ -47,7 +47,7 @@ module.exports = class extends Generator { this.destinationRoot(), this, null, - { globOptions: { dot: true } } + { globOptions: { dot: true } }, ); } }; diff --git a/packages/generator-fluxible/app/templates/components/Application.js b/packages/generator-fluxible/app/templates/components/Application.js index 76e70285..fbbb7ee3 100644 --- a/packages/generator-fluxible/app/templates/components/Application.js +++ b/packages/generator-fluxible/app/templates/components/Application.js @@ -44,7 +44,7 @@ export default provideContext( return { pageTitle: appStore.getPageTitle(), }; - } - ) - ) + }, + ), + ), ); diff --git a/packages/generator-fluxible/app/templates/server.js b/packages/generator-fluxible/app/templates/server.js index 4bc54ca7..c9f67aaa 100644 --- a/packages/generator-fluxible/app/templates/server.js +++ b/packages/generator-fluxible/app/templates/server.js @@ -46,7 +46,7 @@ server.use((req, res, next) => { 'window.App=' + serialize(app.dehydrate(context)) + ';'; const markup = ReactDOMServer.renderToString( - createElementWithContext(context) + createElementWithContext(context), ); const htmlElement = React.createElement(HtmlComponent, { clientFile: env === 'production' ? 'main.min.js' : 'main.js', @@ -59,7 +59,7 @@ server.use((req, res, next) => { res.type('html'); res.write('' + html); res.end(); - } + }, ); }); diff --git a/packages/generator-fluxible/tests/unit/test-app.test.js b/packages/generator-fluxible/tests/unit/test-app.test.js index e1ebf5cf..9fe3ae6a 100644 --- a/packages/generator-fluxible/tests/unit/test-app.test.js +++ b/packages/generator-fluxible/tests/unit/test-app.test.js @@ -20,7 +20,7 @@ describe('generator-fluxible', function () { 'fluxible', [[require('../../app'), 'fluxible']], 'fluxy', - { 'skip-install': true } + { 'skip-install': true }, ); done(); }); diff --git a/site/Gruntfile.js b/site/Gruntfile.js index 08d5bcb9..28722e27 100644 --- a/site/Gruntfile.js +++ b/site/Gruntfile.js @@ -182,19 +182,19 @@ module.exports = function (grunt) { assets: {}, }; - Object.keys(assets).forEach(function eachAsset( - key - ) { - var value = assets[key]; + Object.keys(assets).forEach( + function eachAsset(key) { + var value = assets[key]; - // if `*.[chunkhash].min.js` regex matched, then use file name for key - var matches = key.match(CHUNK_REGEX); - if (matches) { - key = matches[1]; - } + // if `*.[chunkhash].min.js` regex matched, then use file name for key + var matches = key.match(CHUNK_REGEX); + if (matches) { + key = matches[1]; + } - output.assets[key] = value; - }); + output.assets[key] = value; + }, + ); return JSON.stringify(output, null, 4); }, }), diff --git a/site/assets/css/base.css b/site/assets/css/base.css index ae63ae4d..049ef210 100644 --- a/site/assets/css/base.css +++ b/site/assets/css/base.css @@ -38,7 +38,11 @@ input, optgroup, select, textarea { - font: 300 16px/1.55 'Helvetica Neue', Helvetica, Arial, sans-serif; /* 1 */ + font: + 300 16px/1.55 'Helvetica Neue', + Helvetica, + Arial, + sans-serif; /* 1 */ margin: 0; /* 2 */ } @@ -304,7 +308,8 @@ input:focus, textarea:focus { outline: 0; border-color: rgba(82, 168, 236, 0.8); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), + box-shadow: + inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6) !important; } diff --git a/site/client.js b/site/client.js index 7da578d6..b18cf13a 100644 --- a/site/client.js +++ b/site/client.js @@ -30,6 +30,6 @@ app.rehydrate(dehydratedState, function (err, context) { render( createElementWithContext(context), - document.getElementById('docsapp') + document.getElementById('docsapp'), ); }); diff --git a/site/components/Application.js b/site/components/Application.js index 81e52980..bb4ecf53 100644 --- a/site/components/Application.js +++ b/site/components/Application.js @@ -102,9 +102,9 @@ Application = provideContext( connectToStores(Application, ['DocStore'], (context) => ({ currentTitle: context.getStore('DocStore').getCurrentTitle() || '', currentDoc: context.getStore('DocStore').getCurrent(), - })) + })), ), - ['query', 'devtools'] + ['query', 'devtools'], ); export default Application; diff --git a/site/components/Doc.js b/site/components/Doc.js index b60d4281..e2f4566b 100644 --- a/site/components/Doc.js +++ b/site/components/Doc.js @@ -77,7 +77,7 @@ class Doc extends React.Component { ({ search: context.getStore(SearchStore).getState(), - })) + })), ); export default Docs; diff --git a/site/components/Html.js b/site/components/Html.js index d2e6f740..11b55cfc 100644 --- a/site/components/Html.js +++ b/site/components/Html.js @@ -52,7 +52,7 @@ Html = provideContext( connectToStores(Html, ['DocStore'], (context) => ({ currentTitle: context.getStore('DocStore').getCurrentTitle() || '', currentDoc: context.getStore('DocStore').getCurrent() || {}, - })) + })), ); export default Html; diff --git a/site/components/Menu.js b/site/components/Menu.js index 72c3648d..fa4dbf1b 100644 --- a/site/components/Menu.js +++ b/site/components/Menu.js @@ -21,7 +21,7 @@ class Menu extends React.Component { key={menuitem.category} > {menuitem.category} - + , ); } @@ -57,7 +57,7 @@ class Menu extends React.Component { submenu.push(
  • {linkNode} -
  • + , ); }); @@ -65,7 +65,7 @@ class Menu extends React.Component { menu.push(
      {submenu} -
    + , ); } }); diff --git a/site/server.js b/site/server.js index 5a5b8516..4d072ca3 100644 --- a/site/server.js +++ b/site/server.js @@ -32,7 +32,7 @@ server.use( inc_req_timeout: 5000, out_req_timeout: 5000, post_max_size: 2000000, - }) + }), ); server.set('state namespace', 'App'); @@ -42,7 +42,7 @@ server.use( '/public', express.static(path.join(__dirname, '/build'), { maxAge: '1y', - }) + }), ); server.use(cookieParser()); server.use(bodyParser.json()); @@ -86,7 +86,7 @@ function renderApp(res, context) { context: componentContext, state: exposed, markup: renderedApp, - }) + }), ); res.send(doctype + html); diff --git a/site/services/docs.js b/site/services/docs.js index cd91725c..7922068f 100644 --- a/site/services/docs.js +++ b/site/services/docs.js @@ -30,7 +30,7 @@ if (secrets.github.accessToken) { console.log('All good! Found access token.'); } else { console.error( - 'Not good! Missing access token. Will be rate-limited by github API.' + 'Not good! Missing access token. Will be rate-limited by github API.', ); } @@ -134,7 +134,7 @@ function fetchAPI(docParams, cb) { (result[1].indexOf('http') !== -1 && -1 !== result[1].indexOf( - `/${routeConfig.githubRepo}/blob/${githubRef}${routeConfig.githubPath}` + `/${routeConfig.githubRepo}/blob/${githubRef}${routeConfig.githubPath}`, )) ) { matchedDoc = routeConfig; @@ -151,7 +151,7 @@ function fetchAPI(docParams, cb) { githubPath + ' has a broken ' + 'link to ' + - fixedRelativePath + fixedRelativePath, ); } continue; @@ -187,7 +187,7 @@ function fetchAPI(docParams, cb) { 'Doc not found for', githubRepo, githubPath, - res.body + res.body, ); cache[key] = { @@ -207,7 +207,7 @@ function fetchAPI(docParams, cb) { type: 'contents/' + githubPath, ref: githubRef, }, - fetchCallback + fetchCallback, ); } @@ -264,7 +264,7 @@ function fetchGitBranch(pkg, cb) { resolve(result); }); }); - }, {}) + }, {}), ) .then(() => { const fetches = []; diff --git a/site/tests/unit/actions/loadIndex.js b/site/tests/unit/actions/loadIndex.js index 95eae61c..fe9fe287 100644 --- a/site/tests/unit/actions/loadIndex.js +++ b/site/tests/unit/actions/loadIndex.js @@ -24,7 +24,7 @@ describe('site', () => { 'search', function (method, params, config, callback) { callback(null, mockIndex); - } + }, ); }); diff --git a/site/tests/unit/actions/showDoc.js b/site/tests/unit/actions/showDoc.js index 26a40da6..378af2e0 100644 --- a/site/tests/unit/actions/showDoc.js +++ b/site/tests/unit/actions/showDoc.js @@ -28,7 +28,7 @@ describe('site', () => { } callback(null, docResponse); - } + }, ); }); diff --git a/site/tests/unit/configs/routes.js b/site/tests/unit/configs/routes.js index b50422cb..85eefdb3 100644 --- a/site/tests/unit/configs/routes.js +++ b/site/tests/unit/configs/routes.js @@ -32,7 +32,7 @@ describe('site', () => { } callback(null, docResponse); - } + }, ); context.service.setService( 'api', @@ -42,7 +42,7 @@ describe('site', () => { } callback(null, docResponse); - } + }, ); }); @@ -78,7 +78,7 @@ describe('site', () => { let docs = context.getStore(DocStore).getAll(); expect(docs).to.be.an('object'); done(); - } + }, ); }); }); diff --git a/site/utils/assets.js b/site/utils/assets.js index 58761675..69c0622a 100644 --- a/site/utils/assets.js +++ b/site/utils/assets.js @@ -12,15 +12,12 @@ let assets = { if ('production' === process.env.NODE_ENV) { try { - var webpackAssets = require(path.join( - __dirname, - '..', - 'build', - 'assets.json' - )); + var webpackAssets = require( + path.join(__dirname, '..', 'build', 'assets.json'), + ); } catch (e) { throw new Error( - 'Please run `grunt build` to generate the production assets.' + 'Please run `grunt build` to generate the production assets.', ); } assets.main = CDN_PATH + webpackAssets.assets.main;