Skip to content

Commit

Permalink
chore: upgrade babel, prettier, eslint (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
hedgepigdaniel authored Sep 19, 2019
1 parent f8807e8 commit 51ff994
Show file tree
Hide file tree
Showing 18 changed files with 885 additions and 771 deletions.
42 changes: 21 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,34 @@
"check": "yarn run is-pretty && yarn run lint && yarn run build && yarn run test -- -- -w 1"
},
"devDependencies": {
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.5",
"@babel/plugin-proposal-class-properties": "^7.4.4",
"@babel/plugin-proposal-object-rest-spread": "^7.4.4",
"@babel/cli": "^7.6.0",
"@babel/core": "^7.6.0",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/plugin-proposal-object-rest-spread": "^7.5.5",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.4.4",
"@babel/preset-env": "^7.4.5",
"@babel/plugin-transform-runtime": "^7.6.0",
"@babel/preset-env": "^7.6.0",
"@babel/preset-flow": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@babel/runtime": "^7.4.5",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^10.0.1",
"@babel/runtime": "^7.6.0",
"babel-eslint": "^10.0.3",
"babel-jest": "^24.8.0",
"babel-loader": "^8.0.6",
"babel-watch": "git://github.com/kmagiera/babel-watch.git",
"cross-env": "^5.0.1",
"css-loader": "^1.0.0",
"eslint": "^5.16.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-config-prettier": "^3.0.1",
"eslint-import-resolver-lerna": "^1.0.0",
"eslint-loader": "^2.1.0",
"eslint-plugin-flowtype": "^2.50.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jest": "^22.6.4",
"eslint-plugin-jsx-a11y": "^6.1.1",
"eslint-plugin-prettier": "^2.6.2",
"eslint-plugin-react": "^7.11.1",
"eslint": "^6.3.0",
"eslint-config-airbnb": "^18.0.1",
"eslint-config-prettier": "^6.3.0",
"eslint-import-resolver-lerna": "^1.1.0",
"eslint-loader": "^3.0.0",
"eslint-plugin-flowtype": "^4.3.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jest": "^22.17.0",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.0",
"eslint-plugin-react": "^7.14.3",
"eslint-plugin-react-hooks": "^1.7.0",
"flow-bin": "^0.78.0",
"flow-copy-source": "^2.0.2",
"husky": "^0.14.3",
Expand All @@ -61,7 +61,7 @@
"lerna": "^3.15.0",
"lint-staged": "^7.2.0",
"npm-publish-git": "git://github.com/hedgepigdaniel/npm-publish-git.git",
"prettier": "^1.14.2",
"prettier": "^1.18.2",
"prop-types": "^15.6.2",
"react": "^16.8.0",
"react-dom": "^16.8.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/boilerplate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
"lint": "eslint ."
},
"dependencies": {
"@babel/polyfill": "^7.4.4",
"@respond-framework/react": "^0.1.1-test.3",
"@respond-framework/rudy": "^0.1.1-test.4",
"core-js": "^3.2.1",
"express": "^4.15.2",
"react": "^16.8.0",
"react-dom": "^16.8.0",
Expand All @@ -32,6 +32,7 @@
"react-universal-component": "^3.0.3",
"redux": "^4.0.4",
"redux-devtools-extension": "^2.13.5",
"regenerator-runtime": "^0.13.3",
"serve-favicon": "^2.4.5",
"source-map-support": "^0.5.6",
"webpack-flush-chunks": "^2.0.3"
Expand Down
3 changes: 2 additions & 1 deletion packages/boilerplate/server/serveDev.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* eslint-disable import/no-extraneous-dependencies */

import 'source-map-support/register'
import '@babel/polyfill'
import 'core-js/stable'
import 'regenerator-runtime/runtime'
import path from 'path'
import express from 'express'
import favicon from 'serve-favicon'
Expand Down
3 changes: 2 additions & 1 deletion packages/boilerplate/server/serveProd.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'source-map-support/register'
import '@babel/polyfill'
import 'core-js/stable'
import 'regenerator-runtime/runtime'
import { resolve } from 'path'
import express from 'express'
import favicon from 'serve-favicon'
Expand Down
3 changes: 2 additions & 1 deletion packages/boilerplate/server/webpack.config.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ export default (env) => {
isClient &&
isDev &&
'webpack-hot-middleware/client?path=/__webpack_hmr&timeout=20000&reload=false&quiet=false&noInfo=false',
isClient && '@babel/polyfill',
isClient && 'core-js/stable',
isClient && 'regenerator-runtime/runtime',
res(isServer ? '../src/render.server.js' : '../src/render.browser.js'),
].filter(Boolean),
},
Expand Down
5 changes: 4 additions & 1 deletion packages/middleware-change-page-title/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ export default (options) => {
window.document.title = title
},
} = options || {}
const selectTitleState = createSelector('title', keyOrSelector)
const selectTitleState = createSelector(
'title',
keyOrSelector,
)

return (api) => async (req, next) => {
const title = selectTitleState(api.getState())
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/link.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @flow
/* eslint-disable react/prop-types,react/jsx-props-no-spreading */

import React from 'react'
import { connect } from 'react-redux'
Expand Down
2 changes: 1 addition & 1 deletion packages/rudy/.codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ engines:
enabled: true
config:
languages:
- ? javascript
- javascript:
fixme:
enabled: true
eslint:
Expand Down
8 changes: 4 additions & 4 deletions packages/rudy/src/core/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ export default (
result !== undefined
? result // as below in the standard use-case, this insures last middleware dictates return
: res === req.action
? req.redirect // `transformAction` + `enter` middleware return original action dispatched, but we never want to return that value of the action redirected from
: res !== undefined
? res
: req.redirect) // usually the result returned will be the result of the pipeline redirected to, but we honor explicit different returns (`res`)
? req.redirect // `transformAction` + `enter` middleware return original action dispatched, but we never want to return that value of the action redirected from
: res !== undefined
? res
: req.redirect) // usually the result returned will be the result of the pipeline redirected to, but we honor explicit different returns (`res`)
}

// if a middleware return `false`, the pipeline is terminated and now there is no longer a "pending" route change
Expand Down
4 changes: 2 additions & 2 deletions packages/rudy/src/core/createRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ export class Request {
const action = isAction(act)
? act
: typeof act === 'string' && (type = this.isActionType(act))
? { type }
: { payload: act }
? { type }
: { payload: act }

action.type =
action.type ||
Expand Down
5 changes: 4 additions & 1 deletion packages/rudy/src/core/createRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ export default (
options.stringifyQuery = options.stringifyQuery || qs.stringify

const routes = formatRoutes(routesInput, formatRoute)
const selectLocationState = createSelector('location', location)
const selectLocationState = createSelector(
'location',
location,
)
const history = createSmartHistory(routes, options)
const { firstAction } = history
const initialState = createState(firstAction)
Expand Down
4 changes: 2 additions & 2 deletions packages/rudy/src/history/History.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ export default class History {
? i > this.index
? 1
: i === this.index
? this.n
: -1 // create direction relative to index of current entries
? this.n
: -1 // create direction relative to index of current entries
: 1) // at the front of the array, always use "forward" direction

const kind = 'reset'
Expand Down
5 changes: 2 additions & 3 deletions packages/rudy/src/middleware/anonymousThunk.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ export default ({ options }) => {
const thunk = req.action
const thunkResult = Promise.resolve(thunk(req))

return thunkResult.then(
(action) =>
action && !action._dispatched ? req.dispatch(action) : action,
return thunkResult.then((action) =>
action && !action._dispatched ? req.dispatch(action) : action,
)
}
}
8 changes: 4 additions & 4 deletions packages/rudy/src/middleware/call/utils/autoDispatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const isAutoDispatch = (route, options, isOptCb) =>
? true
: options.autoDispatch
: route.autoDispatch !== undefined
? route.autoDispatch
: options.autoDispatch === undefined
? true
: options.autoDispatch
? route.autoDispatch
: options.autoDispatch === undefined
? true
: options.autoDispatch
4 changes: 2 additions & 2 deletions packages/rudy/src/utils/actionToUrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ const notFoundUrl = (
const t: string = hasScene
? type
: routes[`${scene}/NOT_FOUND`] // try to interpret scene-level NOT_FOUND if available (note: links create plain NOT_FOUND actions)
? `${scene}/NOT_FOUND`
: 'NOT_FOUND'
? `${scene}/NOT_FOUND`
: 'NOT_FOUND'

const p: string = routes[t].path || routes.NOT_FOUND.path || ''

Expand Down
24 changes: 11 additions & 13 deletions packages/rudy/src/utils/formatRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,18 @@ export default (

const types: RouteNames = Object.keys(routes)

types.forEach(
(type: string): void => {
const route: Object = formatRoute(
routes[type],
type,
routes,
formatter,
isAddRoutes,
)
types.forEach((type: string): void => {
const route: Object = formatRoute(
routes[type],
type,
routes,
formatter,
isAddRoutes,
)

route.type = type
routes[type] = route
},
)
route.type = type
routes[type] = route
})

return routes
}
Expand Down
10 changes: 8 additions & 2 deletions packages/utils/tests/createSelector.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ describe('createSelector', () => {
})

test('Returns the given key if a string is provided', async () => {
const selector = createSelector('test name', 'test key')
const selector = createSelector(
'test name',
'test key',
)
expect(
selector({
'test name': 'test value',
Expand All @@ -36,7 +39,10 @@ describe('createSelector', () => {
'test key': 'test keyed value',
}
const providedSelector = jest.fn(() => 'selector return value')
const selector = createSelector('test name', providedSelector)
const selector = createSelector(
'test name',
providedSelector,
)
const result = selector(state)
expect(result).toStrictEqual('selector return value')
expect(providedSelector).toHaveBeenCalledTimes(1)
Expand Down
Loading

0 comments on commit 51ff994

Please sign in to comment.