Commit 18488f47 authored by Henrik Wenz's avatar Henrik Wenz Committed by Tim Neutkens

Fix linter (#5350)

* Fix linter

* Add test env

* Fix lint errors
parent 9a09de2f
...@@ -15,8 +15,8 @@ app.prepare().then(() => { ...@@ -15,8 +15,8 @@ app.prepare().then(() => {
server.get('*', (req, res) => handle(req, res)) server.get('*', (req, res) => handle(req, res))
server.listen(PORT, err => { server.listen(port, err => {
if (err) throw err; if (err) throw err
console.log(`> Ready on http://localhost:${PORT}`) console.log(`> Ready on http://localhost:${port}`)
}) })
}) })
...@@ -22,4 +22,4 @@ export default class MyDocument extends Document { ...@@ -22,4 +22,4 @@ export default class MyDocument extends Document {
</html> </html>
) )
} }
} }
\ No newline at end of file
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
"pretest": "npm run lint", "pretest": "npm run lint",
"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 lint", "lint": "standard",
"prepublish": "lerna run prepublish", "prepublish": "lerna run prepublish",
"lint-staged": "lint-staged" "lint-staged": "lint-staged"
}, },
...@@ -26,9 +26,9 @@ ...@@ -26,9 +26,9 @@
"parser": "babel-eslint", "parser": "babel-eslint",
"ignore": [ "ignore": [
"**/node_modules/**", "**/node_modules/**",
"**/examples/with-ioc/**", "examples/with-ioc/**",
"**/examples/with-kea/**", "examples/with-kea/**",
"**/examples/with-mobx/**" "examples/with-mobx/**"
] ]
}, },
"devDependencies": { "devDependencies": {
......
module.exports = require('./dist/lib/constants') module.exports = require('./dist/lib/constants')
\ No newline at end of file
import {join} from 'path'
export const PHASE_EXPORT = 'phase-export' export const PHASE_EXPORT = 'phase-export'
export const PHASE_PRODUCTION_BUILD = 'phase-production-build' export const PHASE_PRODUCTION_BUILD = 'phase-production-build'
export const PHASE_PRODUCTION_SERVER = 'phase-production-server' export const PHASE_PRODUCTION_SERVER = 'phase-production-server'
...@@ -24,4 +23,4 @@ export const CLIENT_STATIC_FILES_RUNTIME_WEBPACK = `${CLIENT_STATIC_FILES_RUNTIM ...@@ -24,4 +23,4 @@ export const CLIENT_STATIC_FILES_RUNTIME_WEBPACK = `${CLIENT_STATIC_FILES_RUNTIM
// matches static/<buildid>/pages/<page>.js // matches static/<buildid>/pages/<page>.js
export const IS_BUNDLED_PAGE_REGEX = /^static[/\\][^/\\]+[/\\]pages.*\.js$/ export const IS_BUNDLED_PAGE_REGEX = /^static[/\\][^/\\]+[/\\]pages.*\.js$/
// matches static/<buildid>/pages/:page*.js // matches static/<buildid>/pages/:page*.js
export const ROUTE_NAME_REGEX = /^static[/\\][^/\\]+[/\\]pages[/\\](.*)\.js$/ export const ROUTE_NAME_REGEX = /^static[/\\][^/\\]+[/\\]pages[/\\](.*)\.js$/
\ No newline at end of file
module.exports = require('./dist/server/config') module.exports = require('./dist/server/config')
\ No newline at end of file
module.exports = require('next-server/head') module.exports = require('next-server/head')
\ No newline at end of file
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
"build": "taskr", "build": "taskr",
"release": "taskr release", "release": "taskr release",
"flow": "flow check", "flow": "flow check",
"lint": "standard 'bin/*' 'client/**/*.js' 'examples/**/*.js' 'lib/**/*.js' 'pages/**/*.js' 'server/**/*.js' 'build/**/*.js' 'test/**/*.js'",
"prepublish": "npm run release" "prepublish": "npm run release"
}, },
"taskr": { "taskr": {
...@@ -37,15 +36,6 @@ ...@@ -37,15 +36,6 @@
"./taskfile-babel.js" "./taskfile-babel.js"
] ]
}, },
"standard": {
"parser": "babel-eslint",
"ignore": [
"**/node_modules/**",
"**/examples/with-ioc/**",
"**/examples/with-kea/**",
"**/examples/with-mobx/**"
]
},
"dependencies": { "dependencies": {
"@babel/core": "7.1.2", "@babel/core": "7.1.2",
"@babel/plugin-proposal-class-properties": "7.1.0", "@babel/plugin-proposal-class-properties": "7.1.0",
......
/* global jasmine, describe, it, expect, beforeAll, afterAll */ /* eslint-env jest */
/* global jasmine */
import webdriver from 'next-webdriver' import webdriver from 'next-webdriver'
import { readFileSync, writeFileSync } from 'fs' import { readFileSync, writeFileSync } from 'fs'
import { join } from 'path' import { join } from 'path'
......
/* global describe, it, expect */ /* eslint-env jest */
import webdriver from 'next-webdriver' import webdriver from 'next-webdriver'
import { readFileSync, writeFileSync } from 'fs' import { readFileSync, writeFileSync } from 'fs'
......
/* global describe, it, expect */ /* eslint-env jest */
import webdriver from 'next-webdriver' import webdriver from 'next-webdriver'
......
/* global jasmine, describe, beforeAll, afterAll */ /* eslint-env jest */
/* global jasmine */
import { join } from 'path' import { join } from 'path'
import { import {
renderViaHTTP, renderViaHTTP,
......
/* global describe, test, expect */ /* eslint-env jest */
import cheerio from 'cheerio' import cheerio from 'cheerio'
......
/* global jasmine, describe, beforeAll, afterAll */ /* eslint-env jest */
/* global jasmine */
import { join } from 'path' import { join } from 'path'
import { import {
renderViaHTTP, renderViaHTTP,
......
/* global describe, it, expect */ /* eslint-env jest */
import cheerio from 'cheerio' import cheerio from 'cheerio'
......
/* global describe, it, expect */ /* eslint-env jest */
import cheerio from 'cheerio' import cheerio from 'cheerio'
import { import {
renderViaHTTP renderViaHTTP
......
/* global describe, it, expect */ /* eslint-env jest */
import webdriver from 'next-webdriver' import webdriver from 'next-webdriver'
import {waitFor, getReactErrorOverlayContent} from 'next-test-utils' import {waitFor, getReactErrorOverlayContent} from 'next-test-utils'
......
/* global describe, it, expect */ /* eslint-env jest */
import webdriver from 'next-webdriver' import webdriver from 'next-webdriver'
import cheerio from 'cheerio' import cheerio from 'cheerio'
import { waitFor, check } from 'next-test-utils' import { waitFor, check } from 'next-test-utils'
......
/* global describe, it, expect */ /* eslint-env jest */
import webdriver from 'next-webdriver' import webdriver from 'next-webdriver'
import { join } from 'path' import { join } from 'path'
import { check, File, waitFor, getReactErrorOverlayContent, getBrowserBodyText } from 'next-test-utils' import { check, File, waitFor, getReactErrorOverlayContent, getBrowserBodyText } from 'next-test-utils'
......
/* global describe, it, expect */ /* eslint-env jest */
import webdriver from 'next-webdriver' import webdriver from 'next-webdriver'
import { readFileSync, writeFileSync, renameSync, existsSync } from 'fs' import { readFileSync, writeFileSync, renameSync, existsSync } from 'fs'
import { join } from 'path' import { join } from 'path'
......
/* global jasmine, describe, beforeAll, afterAll */ /* eslint-env jest */
/* global jasmine */
import { join } from 'path' import { join } from 'path'
import { import {
renderViaHTTP, renderViaHTTP,
......
/* global describe, it, expect */ /* eslint-env jest */
import webdriver from 'next-webdriver' import webdriver from 'next-webdriver'
export default (context, render) => { export default (context, render) => {
......
/* global describe, test, it, expect */ /* eslint-env jest */
import cheerio from 'cheerio' import cheerio from 'cheerio'
import {BUILD_MANIFEST, REACT_LOADABLE_MANIFEST} from 'next-server/constants' import {BUILD_MANIFEST, REACT_LOADABLE_MANIFEST} from 'next-server/constants'
......
/* global describe, it, expect */ /* eslint-env jest */
import webdriver from 'next-webdriver' import webdriver from 'next-webdriver'
import { waitFor, check, File } from 'next-test-utils' import { waitFor, check, File } from 'next-test-utils'
......
/* global jasmine, describe, beforeAll, afterAll */ /* eslint-env jest */
/* global jasmine */
import { join } from 'path' import { join } from 'path'
import { import {
renderViaHTTP, renderViaHTTP,
......
/* global describe, test, expect */ /* eslint-env jest */
import cheerio from 'cheerio' import cheerio from 'cheerio'
......
/* global jasmine, describe, it, expect, beforeAll, afterAll */ /* eslint-env jest */
/* global jasmine */
import { join } from 'path' import { join } from 'path'
import getPort from 'get-port' import getPort from 'get-port'
import clone from 'clone' import clone from 'clone'
......
/* global jasmine, describe, it, expect, beforeAll, afterAll */ /* eslint-env jest */
/* global jasmine */
import { join } from 'path' import { join } from 'path'
import { existsSync } from 'fs' import { existsSync } from 'fs'
import {BUILD_ID_FILE} from 'next-server/constants' import {BUILD_ID_FILE} from 'next-server/constants'
......
/* global describe, it, expect */ /* eslint-env jest */
import webdriver from 'next-webdriver' import webdriver from 'next-webdriver'
import { check, getBrowserBodyText } from 'next-test-utils' import { check, getBrowserBodyText } from 'next-test-utils'
......
/* global describe, it, expect */ /* eslint-env jest */
import webdriver from 'next-webdriver' import webdriver from 'next-webdriver'
import { renderViaHTTP, getBrowserBodyText, check } from 'next-test-utils' import { renderViaHTTP, getBrowserBodyText, check } from 'next-test-utils'
import cheerio from 'cheerio' import cheerio from 'cheerio'
......
/* global jasmine, describe, beforeAll, afterAll */ /* eslint-env jest */
/* global jasmine */
import { join } from 'path' import { join } from 'path'
import { import {
nextBuild, nextBuild,
......
/* global describe, it, expect */ /* eslint-env jest */
import { renderViaHTTP } from 'next-test-utils' import { renderViaHTTP } from 'next-test-utils'
import cheerio from 'cheerio' import cheerio from 'cheerio'
......
/* global jasmine, describe, it, expect, beforeAll, afterAll */ /* eslint-env jest */
/* global jasmine */
import { join } from 'path' import { join } from 'path'
import getPort from 'get-port' import getPort from 'get-port'
import { import {
......
/* global jasmine, describe, beforeAll, afterAll, it, expect */ /* eslint-env jest */
/* global jasmine */
import { join, resolve } from 'path' import { join, resolve } from 'path'
import { existsSync } from 'fs' import { existsSync } from 'fs'
import webdriver from 'next-webdriver' import webdriver from 'next-webdriver'
......
/* global describe, it, expect */ /* eslint-env jest */
import webdriver from 'next-webdriver' import webdriver from 'next-webdriver'
import { readFileSync, writeFileSync } from 'fs' import { readFileSync, writeFileSync } from 'fs'
import { join } from 'path' import { join } from 'path'
......
/* global jasmine, describe, beforeAll, afterAll */ /* eslint-env jest */
/* global jasmine */
import { join } from 'path' import { join } from 'path'
import { import {
renderViaHTTP, renderViaHTTP,
......
/* eslint-env jest */ /* eslint-env jest */
/* global jasmine */ /* global jasmine */
import { join } from 'path' import { join } from 'path'
import { import {
nextServer, nextServer,
......
/* global describe, it, expect */ /* eslint-env jest */
import webdriver from 'next-webdriver' import webdriver from 'next-webdriver'
import cheerio from 'cheerio' import cheerio from 'cheerio'
import { waitFor, check } from 'next-test-utils' import { waitFor, check } from 'next-test-utils'
......
/* global jasmine, describe, it, expect, beforeAll, afterAll */ /* eslint-env jest */
/* global jasmine */
import { readFileSync } from 'fs' import { readFileSync } from 'fs'
import { join } from 'path' import { join } from 'path'
import { import {
......
/* global describe, it, expect */ /* eslint-env jest */
import webdriver from 'next-webdriver' import webdriver from 'next-webdriver'
import { readFile } from 'fs' import { readFile } from 'fs'
import { promisify } from 'util' import { promisify } from 'util'
......
/* global describe, it, expect /* eslint-env jest */
*/
import { readFileSync } from 'fs' import { readFileSync } from 'fs'
import { join } from 'path' import { join } from 'path'
import { renderViaHTTP, getBrowserBodyText, waitFor } from 'next-test-utils' import { renderViaHTTP, getBrowserBodyText, waitFor } from 'next-test-utils'
import webdriver from 'next-webdriver' import webdriver from 'next-webdriver'
// Does the same evaluation checking for INJECTED for 15 seconds, triggering every 500ms // Does the same evaluation checking for INJECTED for 15 seconds, triggering every 500ms
async function checkInjected(browser) { async function checkInjected (browser) {
const start = Date.now() const start = Date.now()
while(Date.now() - start < 15000) { while (Date.now() - start < 15000) {
const bodyText = await getBrowserBodyText(browser) const bodyText = await getBrowserBodyText(browser)
if(/INJECTED/.test(bodyText)) { if (/INJECTED/.test(bodyText)) {
throw new Error('Vulnerable to XSS attacks') throw new Error('Vulnerable to XSS attacks')
} }
await waitFor(500) await waitFor(500)
...@@ -69,7 +67,6 @@ module.exports = (context) => { ...@@ -69,7 +67,6 @@ module.exports = (context) => {
const browser = await webdriver(context.appPort, `/;'-(document.body.innerHTML='INJECTED')-'`) const browser = await webdriver(context.appPort, `/;'-(document.body.innerHTML='INJECTED')-'`)
await checkInjected(browser) await checkInjected(browser)
browser.close() browser.close()
}) })
......
/* global jasmine, describe, it, expect, beforeAll, afterAll */ /* eslint-env jest */
/* global jasmine */
import { join } from 'path' import { join } from 'path'
import { import {
nextServer, nextServer,
......
/* global describe, it, expect */ /* eslint-env jest */
import {join} from 'path' import {join} from 'path'
import loadConfig from 'next-server/next-config' import loadConfig from 'next-server/next-config'
......
/* global describe, it, expect */ /* eslint-env jest */
import { join } from 'path' import { join } from 'path'
import {SERVER_DIRECTORY, CLIENT_STATIC_FILES_PATH} from 'next-server/constants' import {SERVER_DIRECTORY, CLIENT_STATIC_FILES_PATH} from 'next-server/constants'
......
/* global describe, it, expect */ /* eslint-env jest */
import {normalize, join} from 'path' import {normalize, join} from 'path'
import {getPageEntries, createEntry} from 'next/dist/build/webpack/utils' import {getPageEntries, createEntry} from 'next/dist/build/webpack/utils'
......
/* global describe, it, expect */ /* eslint-env jest */
import EventEmitter from 'next-server/dist/lib/EventEmitter' import EventEmitter from 'next-server/dist/lib/EventEmitter'
describe('EventEmitter', () => { describe('EventEmitter', () => {
......
/* global describe, it, expect */ /* eslint-env jest */
import { Component } from 'react' import { Component } from 'react'
import { getDisplayName } from 'next-server/dist/lib/utils' import { getDisplayName } from 'next-server/dist/lib/utils'
......
/* global describe, it, expect */ /* eslint-env jest */
import { loadGetInitialProps } from 'next-server/dist/lib/utils' import { loadGetInitialProps } from 'next-server/dist/lib/utils'
describe('loadGetInitialProps', () => { describe('loadGetInitialProps', () => {
......
/* global describe, it, expect */ /* eslint-env jest */
import Router from 'next-server/dist/lib/router/router' import Router from 'next-server/dist/lib/router/router'
class PageLoader { class PageLoader {
......
/* global describe, it, expect */ /* eslint-env jest */
import shallowEquals from 'next-server/dist/lib/shallow-equals' import shallowEquals from 'next-server/dist/lib/shallow-equals'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment