mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Lint examples (#4985)
* Lint examples/with-apollo-and-redux-saga * Lint examples/with-apollo-auth * Lint examples/with-apollo * Lint exampels/with-google-analytics * Lint examples/with-higher-order-component * Lint examples/with-react-i18next * Lint exampels/with-redux * Lint exampels/with-relay-modern * Lint examples/with-universal-configuration-runtime * Add **/examples/**/lib/** to linter
This commit is contained in:
parent
639df91c87
commit
5ff7c0742c
|
@ -1,6 +1,6 @@
|
||||||
import { put, takeLatest } from 'redux-saga/effects'
|
import { put, takeLatest } from 'redux-saga/effects'
|
||||||
import es6promise from 'es6-promise'
|
import es6promise from 'es6-promise'
|
||||||
import 'isomorphic-unfetch'
|
import fetch from 'isomorphic-unfetch'
|
||||||
|
|
||||||
import { actionTypes, loadDataSuccess, loadDataError } from './actions'
|
import { actionTypes, loadDataSuccess, loadDataError } from './actions'
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
import { ApolloClient } from 'apollo-boost'
|
import { ApolloClient, InMemoryCache, HttpLink } from 'apollo-boost'
|
||||||
import { HttpLink } from 'apollo-boost'
|
|
||||||
import { InMemoryCache } from 'apollo-boost'
|
|
||||||
import fetch from 'isomorphic-unfetch'
|
import fetch from 'isomorphic-unfetch'
|
||||||
|
|
||||||
let apolloClient = null
|
let apolloClient = null
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import React from 'react'
|
||||||
import initApollo from './init-apollo'
|
import initApollo from './init-apollo'
|
||||||
import Head from 'next/head'
|
import Head from 'next/head'
|
||||||
import { getDataFromTree } from 'react-apollo'
|
import { getDataFromTree } from 'react-apollo'
|
||||||
|
|
|
@ -3,7 +3,7 @@ export const GA_TRACKING_ID = '<YOUR_GA_TRACKING_ID>'
|
||||||
// https://developers.google.com/analytics/devguides/collection/gtagjs/pages
|
// https://developers.google.com/analytics/devguides/collection/gtagjs/pages
|
||||||
export const pageview = url => {
|
export const pageview = url => {
|
||||||
window.gtag('config', GA_TRACKING_ID, {
|
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, {
|
window.gtag('event', action, {
|
||||||
event_category: category,
|
event_category: category,
|
||||||
event_label: label,
|
event_label: label,
|
||||||
value: value,
|
value: value
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,8 @@ export const withI18next = (namespaces = ['common']) => ComposedComponent => {
|
||||||
? getInitialProps(ctx.req, namespaces)
|
? getInitialProps(ctx.req, namespaces)
|
||||||
: await loadNamespaces({
|
: await loadNamespaces({
|
||||||
components: [{ props: { namespaces } }],
|
components: [{ props: { namespaces } }],
|
||||||
i18n: I18n,
|
i18n: I18n
|
||||||
});
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...composedInitialProps,
|
...composedInitialProps,
|
||||||
|
|
|
@ -29,7 +29,7 @@ export default (App) => {
|
||||||
|
|
||||||
let appProps = {}
|
let appProps = {}
|
||||||
if (typeof App.getInitialProps === 'function') {
|
if (typeof App.getInitialProps === 'function') {
|
||||||
appProps = await App.getInitialProps.call(App, appContext)
|
appProps = await App.getInitialProps(appContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -9,7 +9,7 @@ function fetchQuery (
|
||||||
operation,
|
operation,
|
||||||
variables,
|
variables,
|
||||||
cacheConfig,
|
cacheConfig,
|
||||||
uploadables,
|
uploadables
|
||||||
) {
|
) {
|
||||||
return fetch(process.env.RELAY_ENDPOINT, {
|
return fetch(process.env.RELAY_ENDPOINT, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
export default ('undefined' !== typeof window ? window.__ENV__ : process.env)
|
export default (typeof window !== 'undefined' ? window.__ENV__ : process.env)
|
||||||
|
|
|
@ -46,7 +46,6 @@
|
||||||
"parser": "babel-eslint",
|
"parser": "babel-eslint",
|
||||||
"ignore": [
|
"ignore": [
|
||||||
"**/node_modules/**",
|
"**/node_modules/**",
|
||||||
"**/examples/**/lib/**",
|
|
||||||
"**/examples/with-ioc/**",
|
"**/examples/with-ioc/**",
|
||||||
"**/examples/with-kea/**",
|
"**/examples/with-kea/**",
|
||||||
"**/examples/with-mobx/**",
|
"**/examples/with-mobx/**",
|
||||||
|
|
Loading…
Reference in a new issue