From da01a4ed05ab8be785b27b909b99f8f7c514700c Mon Sep 17 00:00:00 2001 From: James Baxley Date: Tue, 28 Jun 2016 15:48:06 -0400 Subject: [PATCH] lint fixes --- package.json | 2 +- src/index.ts | 3 +- test/server/index.tsx | 71 ++++++++++++++++++++++--------------------- tslint.json | 1 - 4 files changed, 38 insertions(+), 39 deletions(-) diff --git a/package.json b/package.json index 6086658365..58b34583cd 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "compile:browser": "rm -rf ./dist && mkdir ./dist && browserify ./lib/src/index.js --i react --i apollo-client -o=./dist/index.js && npm run minify:browser", "minify:browser": "uglifyjs --compress --mangle --screw-ie8 -o=./dist/index.min.js -- ./dist/index.js", "watch": "tsc -w", - "lint": "tslint src/*.ts* && tslint test/*.ts*", + "lint": "tslint 'src/*.ts*' && tslint 'test/*.ts*'", "coverage": "istanbul cover ./node_modules/mocha/bin/_mocha -- --require ./test/fixtures/setup.js --reporter spec --full-trace --recursive ./lib/test", "postcoverage": "remap-istanbul --input coverage/coverage.json --type lcovonly --output coverage/lcov.info" }, diff --git a/src/index.ts b/src/index.ts index fb40df082e..27d96529fe 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,4 @@ import ApolloProvider from './ApolloProvider'; import connect from './connect'; -import { getData, renderToStringWithData } from './server'; -export { ApolloProvider, connect, getData, renderToStringWithData }; +export { ApolloProvider, connect }; diff --git a/test/server/index.tsx b/test/server/index.tsx index 65049b2204..06ea8693c8 100644 --- a/test/server/index.tsx +++ b/test/server/index.tsx @@ -2,7 +2,8 @@ import * as chai from 'chai'; import * as React from 'react'; import * as ReactDOM from 'react-dom/server'; import ApolloClient, { createNetworkInterface } from 'apollo-client'; -import { connect, ApolloProvider, getData, renderToStringWithData } from '../../src'; +import { connect, ApolloProvider } from '../../src'; +import { getData, renderToStringWithData } from '../../src/server'; import 'isomorphic-fetch'; import gql from 'graphql-tag'; @@ -12,17 +13,17 @@ import mockNetworkInterface from '../mocks/mockNetworkInterface'; const { expect } = chai; const client = new ApolloClient({ - networkInterface: createNetworkInterface('https://www.graphqlhub.com/playground') + networkInterface: createNetworkInterface('https://www.graphqlhub.com/playground'), }); describe('SSR', () => { it('should render the expected markup', (done) => { const Element = ({ data }) => { return
{data.loading ? 'loading' : 'loaded'}
; - } + }; const WrappedElement = connect({ - mapQueriesToProps: ({ ownProps }) => ({ + mapQueriesToProps: () => ({ data: { query: gql` query Feed { @@ -30,9 +31,9 @@ describe('SSR', () => { login } } - ` - } - }) + `, + }, + }), })(Element); const component = ( @@ -82,7 +83,7 @@ describe('SSR', () => { } ); - const client = new ApolloClient({ + const apolloClient = new ApolloClient({ networkInterface, }); @@ -92,11 +93,11 @@ describe('SSR', () => { query, ssr: true, // block during SSR render }, - }) + }), })(Element); const app = ( - + ); @@ -136,18 +137,18 @@ describe('SSR', () => { } ); - const client = new ApolloClient({ + const apolloClient = new ApolloClient({ networkInterface, }); const WrappedElement = connect({ mapQueriesToProps: () => ({ data: { query }, - }) + }), })(Element); const app = ( - + ); @@ -186,18 +187,18 @@ describe('SSR', () => { } ); - const client = new ApolloClient({ + const apolloClient = new ApolloClient({ networkInterface, }); const WrappedElement = connect({ mapQueriesToProps: () => ({ data: { query, ssr: false }, - }) + }), })(Element); const app = ( - + ); @@ -216,18 +217,18 @@ describe('SSR', () => { // XXX mock all queries it('should work on a non trivial example', function(done) { this.timeout(10000); - const networkInterface = createNetworkInterface("http://graphql-swapi.parseapp.com/"); - const client = new ApolloClient({ + const networkInterface = createNetworkInterface('http://graphql-swapi.parseapp.com/'); + const apolloClient = new ApolloClient({ networkInterface, // shouldBatch: true, }); - class Film extends React.Component{ - render(){ + class Film extends React.Component { + render() { const { data } = this.props; - if (data.loading) return null + if (data.loading) return null; const { film } = data; - return
{film.title}
+ return
{film.title}
; } }; @@ -248,8 +249,8 @@ describe('SSR', () => { }), })(Film); - class Starship extends React.Component{ - render(){ + class Starship extends React.Component { + render() { const { data } = this.props; if (data.loading) return null; const { ship } = data; @@ -265,7 +266,7 @@ describe('SSR', () => { ))} - ) + ); } }; @@ -291,8 +292,8 @@ describe('SSR', () => { }), })(Starship); - class Element extends React.Component{ - render(){ + class Element extends React.Component { + render() { const { data } = this.props; return (
    @@ -302,7 +303,7 @@ describe('SSR', () => { ))}
- ) + ); } } @@ -319,7 +320,7 @@ describe('SSR', () => { } `, }, - }) + }), })(Element); class Planet extends React.Component { @@ -334,7 +335,7 @@ describe('SSR', () => {
{planet.name}
))} - ) + ); } } const AllPlanetsWithData = connect({ @@ -351,14 +352,14 @@ describe('SSR', () => { `, }, }), - })(Planet) + })(Planet); const Foo = () => (

Foo

- ) + ); class Bar extends React.Component { render() { @@ -367,12 +368,12 @@ describe('SSR', () => {

Bar

- ) + ); } } const app = ( - +

@@ -391,7 +392,7 @@ describe('SSR', () => { expect(markup).to.match(/__apollo_data__/); done(); }) - .catch(done) + .catch(done); }); }); }); diff --git a/tslint.json b/tslint.json index 0ea561efcf..0f00049367 100644 --- a/tslint.json +++ b/tslint.json @@ -15,7 +15,6 @@ true, "spaces" ], - "interface-name": false, "jsdoc-format": true, "label-position": true, "label-undefined": true,