diff --git a/examples/with-apollo-and-redux-saga/lib/clock/actions.js b/examples/with-apollo-and-redux-saga/lib/clock/actions.js index 3ef5384e..ad5afe46 100644 --- a/examples/with-apollo-and-redux-saga/lib/clock/actions.js +++ b/examples/with-apollo-and-redux-saga/lib/clock/actions.js @@ -3,7 +3,7 @@ export const actionTypes = { TICK_CLOCK: 'TICK_CLOCK' } -export function startClock(isServer=true) { +export function startClock (isServer = true) { return { type: actionTypes.START_CLOCK, light: isServer, @@ -11,7 +11,7 @@ export function startClock(isServer=true) { } } -export function tickClock(isServer) { +export function tickClock (isServer) { return { type: actionTypes.TICK_CLOCK, light: !isServer, diff --git a/examples/with-apollo-and-redux-saga/lib/clock/reducers.js b/examples/with-apollo-and-redux-saga/lib/clock/reducers.js index 3edb2519..6897881e 100644 --- a/examples/with-apollo-and-redux-saga/lib/clock/reducers.js +++ b/examples/with-apollo-and-redux-saga/lib/clock/reducers.js @@ -5,7 +5,7 @@ export const initialState = { light: false } -function reducer(state = initialState, action) { +function reducer (state = initialState, action) { switch (action.type) { case actionTypes.TICK_CLOCK: return { diff --git a/examples/with-apollo-and-redux-saga/lib/clock/sagas.js b/examples/with-apollo-and-redux-saga/lib/clock/sagas.js index d567add2..fdb15740 100644 --- a/examples/with-apollo-and-redux-saga/lib/clock/sagas.js +++ b/examples/with-apollo-and-redux-saga/lib/clock/sagas.js @@ -7,7 +7,7 @@ import { actionTypes, tickClock } from './actions' es6promise.polyfill() -function* runClockSaga() { +function * runClockSaga () { yield take(actionTypes.START_CLOCK) while (true) { yield put(tickClock(false)) diff --git a/examples/with-apollo-and-redux-saga/lib/count/actions.js b/examples/with-apollo-and-redux-saga/lib/count/actions.js index caf6da60..4b4aed14 100644 --- a/examples/with-apollo-and-redux-saga/lib/count/actions.js +++ b/examples/with-apollo-and-redux-saga/lib/count/actions.js @@ -3,10 +3,10 @@ export const actionTypes = { COUNT_DECREASE: 'COUNT_DECREASE' } -export function countIncrease() { +export function countIncrease () { return { type: actionTypes.COUNT_INCREASE } } -export function countDecrease() { +export function countDecrease () { return { type: actionTypes.COUNT_DECREASE } } diff --git a/examples/with-apollo-and-redux-saga/lib/count/reducers.js b/examples/with-apollo-and-redux-saga/lib/count/reducers.js index 3114af7f..892dc236 100644 --- a/examples/with-apollo-and-redux-saga/lib/count/reducers.js +++ b/examples/with-apollo-and-redux-saga/lib/count/reducers.js @@ -2,7 +2,7 @@ import { actionTypes } from './actions' const initialState = 0 -function reducer(state = initialState, action) { +function reducer (state = initialState, action) { switch (action.type) { case actionTypes.COUNT_INCREASE: return state + 1 diff --git a/examples/with-apollo-and-redux-saga/lib/initApollo.js b/examples/with-apollo-and-redux-saga/lib/initApollo.js index 0187d79a..8a780627 100644 --- a/examples/with-apollo-and-redux-saga/lib/initApollo.js +++ b/examples/with-apollo-and-redux-saga/lib/initApollo.js @@ -10,7 +10,7 @@ if (!process.browser) { global.fetch = fetch } -function create(initialState) { +function create (initialState) { // Check out https://github.com/zeit/next.js/pull/4611 if you want to use the AWSAppSyncClient return new ApolloClient({ connectToDevTools: process.browser, @@ -23,7 +23,7 @@ function create(initialState) { }) } -export default function initApollo(initialState) { +export default function initApollo (initialState) { // Make sure to create a new client for every server-side request so that data // isn't shared between connections (which would be bad) if (!process.browser) { diff --git a/examples/with-apollo-and-redux-saga/lib/placeholder/actions.js b/examples/with-apollo-and-redux-saga/lib/placeholder/actions.js index 8ab4df3c..c7584271 100644 --- a/examples/with-apollo-and-redux-saga/lib/placeholder/actions.js +++ b/examples/with-apollo-and-redux-saga/lib/placeholder/actions.js @@ -4,18 +4,18 @@ export const actionTypes = { LOAD_DATA_ERROR: 'LOAD_DATA_ERROR' } -export function loadData() { +export function loadData () { return { type: actionTypes.LOAD_DATA } } -export function loadDataSuccess(data) { +export function loadDataSuccess (data) { return { type: actionTypes.LOAD_DATA_SUCCESS, data } } -export function loadDataError(error) { +export function loadDataError (error) { return { type: actionTypes.LOAD_DATA_ERROR, error diff --git a/examples/with-apollo-and-redux-saga/lib/placeholder/reducers.js b/examples/with-apollo-and-redux-saga/lib/placeholder/reducers.js index 4aba7960..6e71980b 100644 --- a/examples/with-apollo-and-redux-saga/lib/placeholder/reducers.js +++ b/examples/with-apollo-and-redux-saga/lib/placeholder/reducers.js @@ -5,7 +5,7 @@ export const initialState = { error: false } -function reducer(state = initialState, action) { +function reducer (state = initialState, action) { switch (action.type) { case actionTypes.LOAD_DATA_SUCCESS: return { diff --git a/examples/with-apollo-and-redux-saga/lib/placeholder/sagas.js b/examples/with-apollo-and-redux-saga/lib/placeholder/sagas.js index adac726d..153ec4a5 100644 --- a/examples/with-apollo-and-redux-saga/lib/placeholder/sagas.js +++ b/examples/with-apollo-and-redux-saga/lib/placeholder/sagas.js @@ -1,12 +1,12 @@ import { put, takeLatest } from 'redux-saga/effects' import es6promise from 'es6-promise' -import 'isomorphic-unfetch' +import fetch from 'isomorphic-unfetch' import { actionTypes, loadDataSuccess, loadDataError } from './actions' es6promise.polyfill() -function* loadDataSaga() { +function * loadDataSaga () { try { const res = yield fetch('https://jsonplaceholder.typicode.com/users') const data = yield res.json() diff --git a/examples/with-apollo-and-redux-saga/lib/rootSaga.js b/examples/with-apollo-and-redux-saga/lib/rootSaga.js index b42700b4..3d99abaa 100644 --- a/examples/with-apollo-and-redux-saga/lib/rootSaga.js +++ b/examples/with-apollo-and-redux-saga/lib/rootSaga.js @@ -3,7 +3,7 @@ import { all } from 'redux-saga/effects' import clock from './clock/sagas' import placeholder from './placeholder/sagas' -function* rootSaga() { +function * rootSaga () { yield all([clock, placeholder]) } diff --git a/examples/with-apollo-and-redux-saga/lib/withApollo.js b/examples/with-apollo-and-redux-saga/lib/withApollo.js index 776eef39..3213d811 100644 --- a/examples/with-apollo-and-redux-saga/lib/withApollo.js +++ b/examples/with-apollo-and-redux-saga/lib/withApollo.js @@ -5,7 +5,7 @@ import Head from 'next/head' import initApollo from './initApollo' // Gets the display name of a JSX component for dev tools -function getComponentDisplayName(Component) { +function getComponentDisplayName (Component) { return Component.displayName || Component.name || 'Unknown' } @@ -18,7 +18,7 @@ export default ComposedComponent => { serverState: PropTypes.object.isRequired } - static async getInitialProps(ctx) { + static async getInitialProps (ctx) { // Initial serverState with apollo (empty) let serverState = { apollo: { @@ -76,12 +76,12 @@ export default ComposedComponent => { } } - constructor(props) { + constructor (props) { super(props) this.apollo = initApollo(props.serverState.apollo.data) } - render() { + render () { return ( diff --git a/examples/with-apollo-and-redux-saga/lib/withReduxSaga.js b/examples/with-apollo-and-redux-saga/lib/withReduxSaga.js index f3d75033..de02dd97 100644 --- a/examples/with-apollo-and-redux-saga/lib/withReduxSaga.js +++ b/examples/with-apollo-and-redux-saga/lib/withReduxSaga.js @@ -10,7 +10,7 @@ import rootSaga from './rootSaga' const sagaMiddleware = createSagaMiddleware() -export function configureStore(initialState = {}) { +export function configureStore (initialState = {}) { const store = createStore( rootReducer, initialState, diff --git a/examples/with-apollo-and-redux/lib/initApollo.js b/examples/with-apollo-and-redux/lib/initApollo.js index 0187d79a..8a780627 100644 --- a/examples/with-apollo-and-redux/lib/initApollo.js +++ b/examples/with-apollo-and-redux/lib/initApollo.js @@ -10,7 +10,7 @@ if (!process.browser) { global.fetch = fetch } -function create(initialState) { +function create (initialState) { // Check out https://github.com/zeit/next.js/pull/4611 if you want to use the AWSAppSyncClient return new ApolloClient({ connectToDevTools: process.browser, @@ -23,7 +23,7 @@ function create(initialState) { }) } -export default function initApollo(initialState) { +export default function initApollo (initialState) { // Make sure to create a new client for every server-side request so that data // isn't shared between connections (which would be bad) if (!process.browser) { diff --git a/examples/with-apollo-and-redux/lib/store.js b/examples/with-apollo-and-redux/lib/store.js index 36f7007f..8291b0f4 100644 --- a/examples/with-apollo-and-redux/lib/store.js +++ b/examples/with-apollo-and-redux/lib/store.js @@ -41,4 +41,4 @@ export const addCount = () => dispatch => { export const initStore = (initialState = exampleInitialState) => { return createStore(reducer, initialState, composeWithDevTools(applyMiddleware(thunkMiddleware))) -} \ No newline at end of file +} diff --git a/examples/with-apollo-and-redux/lib/withApollo.js b/examples/with-apollo-and-redux/lib/withApollo.js index f8e9cd62..1a619dc7 100644 --- a/examples/with-apollo-and-redux/lib/withApollo.js +++ b/examples/with-apollo-and-redux/lib/withApollo.js @@ -5,7 +5,7 @@ import Head from 'next/head' import initApollo from './initApollo' // Gets the display name of a JSX component for dev tools -function getComponentDisplayName(Component) { +function getComponentDisplayName (Component) { return Component.displayName || Component.name || 'Unknown' } @@ -18,7 +18,7 @@ export default ComposedComponent => { serverState: PropTypes.object.isRequired } - static async getInitialProps(ctx) { + static async getInitialProps (ctx) { // Initial serverState with apollo (empty) let serverState = { apollo: { @@ -74,12 +74,12 @@ export default ComposedComponent => { } } - constructor(props) { + constructor (props) { super(props) this.apollo = initApollo(this.props.serverState.apollo.data) } - render() { + render () { return ( diff --git a/examples/with-apollo-auth/lib/withApollo.js b/examples/with-apollo-auth/lib/withApollo.js index 45b89fee..62c746c9 100644 --- a/examples/with-apollo-auth/lib/withApollo.js +++ b/examples/with-apollo-auth/lib/withApollo.js @@ -6,7 +6,7 @@ import Head from 'next/head' import initApollo from './initApollo' -function parseCookies(req, options = {}) { +function parseCookies (req, options = {}) { return cookie.parse( req ? req.headers.cookie || '' : document.cookie, options @@ -20,7 +20,7 @@ export default App => { apolloState: PropTypes.object.isRequired } - static async getInitialProps(ctx) { + static async getInitialProps (ctx) { const { Component, router, ctx: { req, res } } = ctx const apollo = initApollo({}, { getToken: () => parseCookies(req).token @@ -73,7 +73,7 @@ export default App => { } } - constructor(props) { + constructor (props) { super(props) // `getDataFromTree` renders the component first, the client is passed off as a property. // After that rendering is done using Next's normal rendering pipeline @@ -82,7 +82,7 @@ export default App => { }) } - render() { + render () { return } } diff --git a/examples/with-apollo/lib/init-apollo.js b/examples/with-apollo/lib/init-apollo.js index 224d8a19..d089aebf 100644 --- a/examples/with-apollo/lib/init-apollo.js +++ b/examples/with-apollo/lib/init-apollo.js @@ -1,6 +1,4 @@ -import { ApolloClient } from 'apollo-boost' -import { HttpLink } from 'apollo-boost' -import { InMemoryCache } from 'apollo-boost' +import { ApolloClient, InMemoryCache, HttpLink } from 'apollo-boost' import fetch from 'isomorphic-unfetch' let apolloClient = null @@ -10,7 +8,7 @@ if (!process.browser) { global.fetch = fetch } -function create(initialState) { +function create (initialState) { // Check out https://github.com/zeit/next.js/pull/4611 if you want to use the AWSAppSyncClient return new ApolloClient({ connectToDevTools: process.browser, @@ -23,7 +21,7 @@ function create(initialState) { }) } -export default function initApollo(initialState) { +export default function initApollo (initialState) { // Make sure to create a new client for every server-side request so that data // isn't shared between connections (which would be bad) if (!process.browser) { diff --git a/examples/with-apollo/lib/with-apollo-client.js b/examples/with-apollo/lib/with-apollo-client.js index 1eac8f6b..7e7364ea 100644 --- a/examples/with-apollo/lib/with-apollo-client.js +++ b/examples/with-apollo/lib/with-apollo-client.js @@ -1,3 +1,4 @@ +import React from 'react' import initApollo from './init-apollo' import Head from 'next/head' import { getDataFromTree } from 'react-apollo' diff --git a/examples/with-google-analytics/lib/gtag.js b/examples/with-google-analytics/lib/gtag.js index 3279ca6f..0163d7e4 100644 --- a/examples/with-google-analytics/lib/gtag.js +++ b/examples/with-google-analytics/lib/gtag.js @@ -3,7 +3,7 @@ export const GA_TRACKING_ID = '' // https://developers.google.com/analytics/devguides/collection/gtagjs/pages export const pageview = url => { window.gtag('config', GA_TRACKING_ID, { - page_location: url, + page_location: url }) } @@ -12,6 +12,6 @@ export const event = ({ action, category, label, value }) => { window.gtag('event', action, { event_category: category, event_label: label, - value: value, + value: value }) } diff --git a/examples/with-higher-order-component/lib/getDisplayName.js b/examples/with-higher-order-component/lib/getDisplayName.js index 4689c4ea..3b7e4b56 100644 --- a/examples/with-higher-order-component/lib/getDisplayName.js +++ b/examples/with-higher-order-component/lib/getDisplayName.js @@ -1,3 +1,3 @@ -export function getDisplayName(Component) { +export function getDisplayName (Component) { return Component.displayName || Component.name || 'Unknown' } diff --git a/examples/with-react-i18next/lib/withI18next.js b/examples/with-react-i18next/lib/withI18next.js index 4db21f2f..3e1f87af 100644 --- a/examples/with-react-i18next/lib/withI18next.js +++ b/examples/with-react-i18next/lib/withI18next.js @@ -11,12 +11,12 @@ export const withI18next = (namespaces = ['common']) => ComposedComponent => { ? await ComposedComponent.getInitialProps(ctx) : {} - const i18nInitialProps = ctx.req + const i18nInitialProps = ctx.req ? getInitialProps(ctx.req, namespaces) : await loadNamespaces({ - components: [{ props: { namespaces } }], - i18n: I18n, - }); + components: [{ props: { namespaces } }], + i18n: I18n + }) return { ...composedInitialProps, diff --git a/examples/with-redux/lib/with-redux-store.js b/examples/with-redux/lib/with-redux-store.js index 2ba0c13c..91e8e5ce 100644 --- a/examples/with-redux/lib/with-redux-store.js +++ b/examples/with-redux/lib/with-redux-store.js @@ -4,7 +4,7 @@ import {initializeStore} from '../store' const isServer = typeof window === 'undefined' const __NEXT_REDUX_STORE__ = '__NEXT_REDUX_STORE__' -function getOrCreateStore(initialState) { +function getOrCreateStore (initialState) { // Always make a new store if server, otherwise state is shared between requests if (isServer) { return initializeStore(initialState) @@ -29,7 +29,7 @@ export default (App) => { let appProps = {} if (typeof App.getInitialProps === 'function') { - appProps = await App.getInitialProps.call(App, appContext) + appProps = await App.getInitialProps(appContext) } return { @@ -38,12 +38,12 @@ export default (App) => { } } - constructor(props) { + constructor (props) { super(props) this.reduxStore = getOrCreateStore(props.initialReduxState) } - render() { + render () { return } } diff --git a/examples/with-relay-modern/lib/createRelayEnvironment.js b/examples/with-relay-modern/lib/createRelayEnvironment.js index c1da6aa5..47b62631 100644 --- a/examples/with-relay-modern/lib/createRelayEnvironment.js +++ b/examples/with-relay-modern/lib/createRelayEnvironment.js @@ -9,7 +9,7 @@ function fetchQuery ( operation, variables, cacheConfig, - uploadables, + uploadables ) { return fetch(process.env.RELAY_ENDPOINT, { method: 'POST', diff --git a/examples/with-universal-configuration-runtime/lib/env.js b/examples/with-universal-configuration-runtime/lib/env.js index 6c575fba..08de6326 100644 --- a/examples/with-universal-configuration-runtime/lib/env.js +++ b/examples/with-universal-configuration-runtime/lib/env.js @@ -1 +1 @@ -export default ('undefined' !== typeof window ? window.__ENV__ : process.env) +export default (typeof window !== 'undefined' ? window.__ENV__ : process.env) diff --git a/package.json b/package.json index 48d96a5e..4f13456b 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,6 @@ "parser": "babel-eslint", "ignore": [ "**/node_modules/**", - "**/examples/**/lib/**", "**/examples/with-ioc/**", "**/examples/with-kea/**", "**/examples/with-mobx/**",