Lint fixes.
This commit is contained in:
parent
12b97edb99
commit
0e7723a00e
@ -8,14 +8,16 @@ const MultipleUploader = ({mutate}) => {
|
|||||||
variables: {
|
variables: {
|
||||||
files: target.files
|
files: target.files
|
||||||
},
|
},
|
||||||
refetchQueries: [{
|
refetchQueries: [
|
||||||
|
{
|
||||||
query: uploadsQuery
|
query: uploadsQuery
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return <input type='file' multiple required onChange={handleChange} />
|
return <input type="file" multiple required onChange={handleChange} />
|
||||||
}
|
}
|
||||||
|
|
||||||
export default graphql(gql`
|
export default graphql(gql`
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
export default ({heading, children}) => (
|
const Section = ({ heading, children }) =>
|
||||||
<section>
|
<section>
|
||||||
<h2>{heading}</h2>
|
<h2>
|
||||||
|
{heading}
|
||||||
|
</h2>
|
||||||
{children}
|
{children}
|
||||||
<style jsx>{`
|
<style jsx>{`
|
||||||
section {
|
section {
|
||||||
@ -8,4 +10,5 @@ export default ({heading, children}) => (
|
|||||||
}
|
}
|
||||||
`}</style>
|
`}</style>
|
||||||
</section>
|
</section>
|
||||||
)
|
|
||||||
|
export default Section
|
||||||
|
|||||||
@ -8,14 +8,16 @@ const SingleUploader = ({mutate}) => {
|
|||||||
variables: {
|
variables: {
|
||||||
file: target.files[0]
|
file: target.files[0]
|
||||||
},
|
},
|
||||||
refetchQueries: [{
|
refetchQueries: [
|
||||||
|
{
|
||||||
query: uploadsQuery
|
query: uploadsQuery
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return <input type='file' required onChange={handleChange} />
|
return <input type="file" required onChange={handleChange} />
|
||||||
}
|
}
|
||||||
|
|
||||||
export default graphql(gql`
|
export default graphql(gql`
|
||||||
|
|||||||
@ -14,14 +14,22 @@ const UploadList = ({data: {uploads}}) => {
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{uploads.map(({id, name, type, size, path}) => (
|
{uploads.map(({ id, name, type, size, path }) =>
|
||||||
<tr key={id}>
|
<tr key={id}>
|
||||||
<td>{name}</td>
|
<td>
|
||||||
<td>{type}</td>
|
{name}
|
||||||
<td>{size}</td>
|
</td>
|
||||||
<td>{path}</td>
|
<td>
|
||||||
|
{type}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{size}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{path}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
)}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<style jsx>{`
|
<style jsx>{`
|
||||||
|
|||||||
@ -1,10 +1,6 @@
|
|||||||
import 'isomorphic-fetch'
|
import 'isomorphic-fetch'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {
|
import { ApolloClient, ApolloProvider, getDataFromTree } from 'react-apollo'
|
||||||
ApolloClient,
|
|
||||||
ApolloProvider,
|
|
||||||
getDataFromTree
|
|
||||||
} from 'react-apollo'
|
|
||||||
import { createNetworkInterface } from 'apollo-upload-client'
|
import { createNetworkInterface } from 'apollo-upload-client'
|
||||||
|
|
||||||
const ssrMode = !process.browser
|
const ssrMode = !process.browser
|
||||||
@ -26,7 +22,7 @@ function getClient (headers, initialState = {}) {
|
|||||||
return apolloClient
|
return apolloClient
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Component => (
|
export default Component =>
|
||||||
class extends React.Component {
|
class extends React.Component {
|
||||||
static async getInitialProps(ctx) {
|
static async getInitialProps(ctx) {
|
||||||
const headers = ctx.req ? ctx.req.headers : {}
|
const headers = ctx.req ? ctx.req.headers : {}
|
||||||
@ -37,7 +33,9 @@ export default Component => (
|
|||||||
query: ctx.query,
|
query: ctx.query,
|
||||||
pathname: ctx.pathname
|
pathname: ctx.pathname
|
||||||
},
|
},
|
||||||
...await (Component.getInitialProps ? Component.getInitialProps(ctx) : {})
|
...(await (Component.getInitialProps
|
||||||
|
? Component.getInitialProps(ctx)
|
||||||
|
: {}))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ssrMode) {
|
if (ssrMode) {
|
||||||
@ -73,4 +71,3 @@ export default Component => (
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
/* eslint-disable import/unambiguous */
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
webpack: config => {
|
webpack: config => {
|
||||||
// See https://github.com/webpack/webpack/issues/5135
|
// See https://github.com/webpack/webpack/issues/5135
|
||||||
|
|||||||
660
app/package-lock.json
generated
660
app/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -12,10 +12,16 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-eslint": "^7.2.3",
|
"babel-eslint": "^7.2.3",
|
||||||
"standard": "^10.0.2"
|
"eslint": "^4.1.1",
|
||||||
|
"eslint-config-standard-jsx": "^4.0.2",
|
||||||
|
"eslint-plugin-import": "^2.7.0",
|
||||||
|
"eslint-plugin-node": "^5.1.0",
|
||||||
|
"eslint-plugin-prettier": "^2.1.2",
|
||||||
|
"eslint-plugin-react": "^7.1.0",
|
||||||
|
"prettier": "^1.5.2"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "standard",
|
"lint": "eslint .",
|
||||||
"dev": "zoo next",
|
"dev": "zoo next",
|
||||||
"build": "zoo next build",
|
"build": "zoo next build",
|
||||||
"start": "zoo next start"
|
"start": "zoo next start"
|
||||||
@ -32,10 +38,45 @@
|
|||||||
"transform-inline-environment-variables"
|
"transform-inline-environment-variables"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"standard": {
|
"eslintConfig": {
|
||||||
"parser": "babel-eslint",
|
"parser": "babel-eslint",
|
||||||
"ignore": [
|
"parserOptions": {
|
||||||
".next/**"
|
"sourceType": "module",
|
||||||
|
"ecmaVersion": 2017,
|
||||||
|
"ecmaFeatures": {
|
||||||
|
"experimentalObjectRestSpread": true,
|
||||||
|
"jsx": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"env": {
|
||||||
|
"es6": true,
|
||||||
|
"node": true,
|
||||||
|
"browser": true
|
||||||
|
},
|
||||||
|
"extends": [
|
||||||
|
"eslint:recommended",
|
||||||
|
"plugin:import/recommended",
|
||||||
|
"plugin:node/recommended",
|
||||||
|
"plugin:react/recommended"
|
||||||
|
],
|
||||||
|
"plugins": [
|
||||||
|
"import",
|
||||||
|
"node",
|
||||||
|
"react",
|
||||||
|
"prettier"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"node/no-missing-require": "off",
|
||||||
|
"node/no-unsupported-features": "off",
|
||||||
|
"react/react-in-jsx-scope": "off",
|
||||||
|
"react/prop-types": "off",
|
||||||
|
"prettier/prettier": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"semi": false,
|
||||||
|
"singleQuote": true
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import SingleUploader from '../components/single-uploader'
|
|||||||
import MultipleUploader from '../components/multiple-uploader'
|
import MultipleUploader from '../components/multiple-uploader'
|
||||||
import UploadList from '../components/upload-list'
|
import UploadList from '../components/upload-list'
|
||||||
|
|
||||||
export default withData(props => (
|
const HomePage = () =>
|
||||||
<div>
|
<div>
|
||||||
<Head>
|
<Head>
|
||||||
<title>Apollo upload examples</title>
|
<title>Apollo upload examples</title>
|
||||||
@ -19,16 +19,19 @@ export default withData(props => (
|
|||||||
`}</style>
|
`}</style>
|
||||||
</Head>
|
</Head>
|
||||||
<h1>Apollo upload examples</h1>
|
<h1>Apollo upload examples</h1>
|
||||||
<Section heading='Single file upload'>
|
<Section heading="Single file upload">
|
||||||
<p>Select an file to upload and view the response in the console.</p>
|
<p>Select an file to upload and view the response in the console.</p>
|
||||||
<SingleUploader />
|
<SingleUploader />
|
||||||
</Section>
|
</Section>
|
||||||
<Section heading='Multiple file upload'>
|
<Section heading="Multiple file upload">
|
||||||
<p>Select multiple files to upload and view the response in the console.</p>
|
<p>
|
||||||
|
Select multiple files to upload and view the response in the console.
|
||||||
|
</p>
|
||||||
<MultipleUploader />
|
<MultipleUploader />
|
||||||
</Section>
|
</Section>
|
||||||
<Section heading='Uploaded files'>
|
<Section heading="Uploaded files">
|
||||||
<UploadList />
|
<UploadList />
|
||||||
</Section>
|
</Section>
|
||||||
</div>
|
</div>
|
||||||
))
|
|
||||||
|
export default withData(HomePage)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user