mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Fix linting
This commit is contained in:
parent
616c3d7ac8
commit
6b7864e57e
|
@ -1,3 +1,3 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
distDir: '../../dist/functions/next',
|
distDir: '../../dist/functions/next'
|
||||||
};
|
}
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
import React from 'react';
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types'
|
||||||
import Header from './Header';
|
import Header from './Header'
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
children: PropTypes.element,
|
children: PropTypes.element
|
||||||
};
|
}
|
||||||
|
|
||||||
const App = ({ children }) => (
|
const App = ({ children }) => (
|
||||||
<main>
|
<main>
|
||||||
<Header />
|
<Header />
|
||||||
{children}
|
{children}
|
||||||
</main>
|
</main>
|
||||||
);
|
)
|
||||||
|
|
||||||
App.propTypes = propTypes;
|
App.propTypes = propTypes
|
||||||
|
|
||||||
export default App;
|
export default App
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
import React from 'react';
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types'
|
||||||
import Link from 'next/link';
|
import Link from 'next/link'
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
pathname: PropTypes.String,
|
pathname: PropTypes.String
|
||||||
};
|
}
|
||||||
|
|
||||||
const Header = ({ pathname }) => (
|
const Header = ({ pathname }) => (
|
||||||
<header>
|
<header>
|
||||||
<Link href="/">
|
<Link href='/'>
|
||||||
<a className={pathname === '/' ? 'is-active' : ''}>Home</a>
|
<a className={pathname === '/' ? 'is-active' : ''}>Home</a>
|
||||||
</Link>
|
</Link>
|
||||||
<span> - </span>
|
<span> - </span>
|
||||||
<Link href="/about">
|
<Link href='/about'>
|
||||||
<a className={pathname === '/about' ? 'is-active' : ''}>About</a>
|
<a className={pathname === '/about' ? 'is-active' : ''}>About</a>
|
||||||
</Link>
|
</Link>
|
||||||
</header>
|
</header>
|
||||||
);
|
)
|
||||||
|
|
||||||
Header.propTypes = propTypes;
|
Header.propTypes = propTypes
|
||||||
|
|
||||||
export default Header;
|
export default Header
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react'
|
||||||
import App from '../components/App';
|
import App from '../components/App'
|
||||||
|
|
||||||
export default () => (
|
export default () => (
|
||||||
<App>
|
<App>
|
||||||
<p>About Page</p>
|
<p>About Page</p>
|
||||||
</App>
|
</App>
|
||||||
);
|
)
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react'
|
||||||
import App from '../components/App';
|
import App from '../components/App'
|
||||||
|
|
||||||
export default () => (
|
export default () => (
|
||||||
<App>
|
<App>
|
||||||
<p>Index Page</p>
|
<p>Index Page</p>
|
||||||
</App>
|
</App>
|
||||||
);
|
)
|
||||||
|
|
|
@ -1,28 +1,28 @@
|
||||||
/* eslint-disable import/no-unresolved,import/extensions */
|
/* eslint-disable import/no-unresolved,import/extensions */
|
||||||
import next from 'next';
|
import next from 'next'
|
||||||
import express from 'express';
|
import express from 'express'
|
||||||
import compression from 'compression';
|
import compression from 'compression'
|
||||||
import helmet from 'helmet';
|
import helmet from 'helmet'
|
||||||
import cors from 'cors';
|
import cors from 'cors'
|
||||||
import bodyParser from 'body-parser';
|
import bodyParser from 'body-parser'
|
||||||
import { functions } from './lib/firebase';
|
import { functions } from './lib/firebase'
|
||||||
|
|
||||||
const nextApp = next({ dev: false, conf: { distDir: 'next' } });
|
const nextApp = next({ dev: false, conf: { distDir: 'next' } })
|
||||||
const handle = nextApp.getRequestHandler();
|
const handle = nextApp.getRequestHandler()
|
||||||
|
|
||||||
const server = express();
|
const server = express()
|
||||||
server.disable('x-powered-by');
|
server.disable('x-powered-by')
|
||||||
server.use(cors());
|
server.use(cors())
|
||||||
server.use(bodyParser.json());
|
server.use(bodyParser.json())
|
||||||
server.set('trust proxy', 1);
|
server.set('trust proxy', 1)
|
||||||
server.use(compression());
|
server.use(compression())
|
||||||
server.use(helmet());
|
server.use(helmet())
|
||||||
|
|
||||||
server.get('*', (req, res) => handle(req, res));
|
server.get('*', (req, res) => handle(req, res))
|
||||||
|
|
||||||
const app = functions.https.onRequest(async (req, res) => {
|
const app = functions.https.onRequest(async (req, res) => {
|
||||||
await nextApp.prepare();
|
await nextApp.prepare()
|
||||||
return server(req, res);
|
return server(req, res)
|
||||||
});
|
})
|
||||||
|
|
||||||
export { app };
|
export { app }
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import admin from 'firebase-admin';
|
import admin from 'firebase-admin'
|
||||||
import * as functions from 'firebase-functions';
|
import * as functions from 'firebase-functions'
|
||||||
|
|
||||||
export { functions };
|
export { functions }
|
||||||
export const firebase = admin.initializeApp();
|
export const firebase = admin.initializeApp()
|
||||||
|
|
|
@ -9,7 +9,7 @@ function fetchQuery (
|
||||||
operation,
|
operation,
|
||||||
variables,
|
variables,
|
||||||
cacheConfig,
|
cacheConfig,
|
||||||
uploadables,
|
uploadables
|
||||||
) {
|
) {
|
||||||
// Because we implement the graphql server, the client must to point to the same host
|
// Because we implement the graphql server, the client must to point to the same host
|
||||||
const relayServer = process.browser ? '' : process.env.RELAY_SERVER
|
const relayServer = process.browser ? '' : process.env.RELAY_SERVER
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
"test": "npm run testall || npm run testall",
|
"test": "npm run testall || npm run testall",
|
||||||
"coveralls": "cat ./test/coverage/lcov.info | coveralls",
|
"coveralls": "cat ./test/coverage/lcov.info | coveralls",
|
||||||
"lint": "lerna run typescript && standard && standard --parser typescript-eslint-parser --plugin typescript packages/**/*.ts",
|
"lint": "lerna run typescript && standard && standard --parser typescript-eslint-parser --plugin typescript packages/**/*.ts",
|
||||||
|
"lint-fix": "standard --fix && standard --fix --parser typescript-eslint-parser --plugin typescript packages/**/*.ts",
|
||||||
"typescript": "lerna run typescript",
|
"typescript": "lerna run typescript",
|
||||||
"prepublish": "lerna run prepublish",
|
"prepublish": "lerna run prepublish",
|
||||||
"publish-canary": "lerna version prerelease --preid canary --force-publish",
|
"publish-canary": "lerna version prerelease --preid canary --force-publish",
|
||||||
|
|
Loading…
Reference in a new issue