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(() => {
server.get('*', (req, res) => handle(req, res))
server.listen(PORT, err => {
if (err) throw err;
console.log(`> Ready on http://localhost:${PORT}`)
server.listen(port, err => {
if (err) throw err
console.log(`> Ready on http://localhost:${port}`)
})
})
......@@ -22,4 +22,4 @@ export default class MyDocument extends Document {
</html>
)
}
}
\ No newline at end of file
}
......@@ -13,7 +13,7 @@
"pretest": "npm run lint",
"test": "npm run testall || npm run testall",
"coveralls": "cat ./test/coverage/lcov.info | coveralls",
"lint": "lerna run lint",
"lint": "standard",
"prepublish": "lerna run prepublish",
"lint-staged": "lint-staged"
},
......@@ -26,9 +26,9 @@
"parser": "babel-eslint",
"ignore": [
"**/node_modules/**",
"**/examples/with-ioc/**",
"**/examples/with-kea/**",
"**/examples/with-mobx/**"
"examples/with-ioc/**",
"examples/with-kea/**",
"examples/with-mobx/**"
]
},
"devDependencies": {
......
module.exports = require('./dist/lib/constants')
\ No newline at end of file
module.exports = require('./dist/lib/constants')
import {join} from 'path'
export const PHASE_EXPORT = 'phase-export'
export const PHASE_PRODUCTION_BUILD = 'phase-production-build'
export const PHASE_PRODUCTION_SERVER = 'phase-production-server'
......@@ -24,4 +23,4 @@ export const CLIENT_STATIC_FILES_RUNTIME_WEBPACK = `${CLIENT_STATIC_FILES_RUNTIM
// matches static/<buildid>/pages/<page>.js
export const IS_BUNDLED_PAGE_REGEX = /^static[/\\][^/\\]+[/\\]pages.*\.js$/
// matches static/<buildid>/pages/:page*.js
export const ROUTE_NAME_REGEX = /^static[/\\][^/\\]+[/\\]pages[/\\](.*)\.js$/
\ No newline at end of file
export const ROUTE_NAME_REGEX = /^static[/\\][^/\\]+[/\\]pages[/\\](.*)\.js$/
module.exports = require('./dist/server/config')
\ No newline at end of file
module.exports = require('./dist/server/config')
module.exports = require('next-server/head')
\ No newline at end of file
module.exports = require('next-server/head')
......@@ -29,7 +29,6 @@
"build": "taskr",
"release": "taskr release",
"flow": "flow check",
"lint": "standard 'bin/*' 'client/**/*.js' 'examples/**/*.js' 'lib/**/*.js' 'pages/**/*.js' 'server/**/*.js' 'build/**/*.js' 'test/**/*.js'",
"prepublish": "npm run release"
},
"taskr": {
......@@ -37,15 +36,6 @@
"./taskfile-babel.js"
]
},
"standard": {
"parser": "babel-eslint",
"ignore": [
"**/node_modules/**",
"**/examples/with-ioc/**",
"**/examples/with-kea/**",
"**/examples/with-mobx/**"
]
},
"dependencies": {
"@babel/core": "7.1.2",
"@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 { readFileSync, writeFileSync } from 'fs'
import { join } from 'path'
......
/* global describe, it, expect */
/* eslint-env jest */
import webdriver from 'next-webdriver'
import { readFileSync, writeFileSync } from 'fs'
......
/* global describe, it, expect */
/* eslint-env jest */
import webdriver from 'next-webdriver'
......
/* global jasmine, describe, beforeAll, afterAll */
/* eslint-env jest */
/* global jasmine */
import { join } from 'path'
import {
renderViaHTTP,
......
/* global describe, test, expect */
/* eslint-env jest */
import cheerio from 'cheerio'
......
/* global jasmine, describe, beforeAll, afterAll */
/* eslint-env jest */
/* global jasmine */
import { join } from 'path'
import {
renderViaHTTP,
......
/* global describe, it, expect */
/* eslint-env jest */
import cheerio from 'cheerio'
......
/* global describe, it, expect */
/* eslint-env jest */
import cheerio from 'cheerio'
import {
renderViaHTTP
......
/* global describe, it, expect */
/* eslint-env jest */
import webdriver from 'next-webdriver'
import {waitFor, getReactErrorOverlayContent} from 'next-test-utils'
......
/* global describe, it, expect */
/* eslint-env jest */
import webdriver from 'next-webdriver'
import cheerio from 'cheerio'
import { waitFor, check } from 'next-test-utils'
......
/* global describe, it, expect */
/* eslint-env jest */
import webdriver from 'next-webdriver'
import { join } from 'path'
import { check, File, waitFor, getReactErrorOverlayContent, getBrowserBodyText } from 'next-test-utils'
......
/* global describe, it, expect */
/* eslint-env jest */
import webdriver from 'next-webdriver'
import { readFileSync, writeFileSync, renameSync, existsSync } from 'fs'
import { join } from 'path'
......
/* global jasmine, describe, beforeAll, afterAll */
/* eslint-env jest */
/* global jasmine */
import { join } from 'path'
import {
renderViaHTTP,
......
/* global describe, it, expect */
/* eslint-env jest */
import webdriver from 'next-webdriver'
export default (context, render) => {
......
/* global describe, test, it, expect */
/* eslint-env jest */
import cheerio from 'cheerio'
import {BUILD_MANIFEST, REACT_LOADABLE_MANIFEST} from 'next-server/constants'
......
/* global describe, it, expect */
/* eslint-env jest */
import webdriver from 'next-webdriver'
import { waitFor, check, File } from 'next-test-utils'
......
/* global jasmine, describe, beforeAll, afterAll */
/* eslint-env jest */
/* global jasmine */
import { join } from 'path'
import {
renderViaHTTP,
......
/* global describe, test, expect */
/* eslint-env jest */
import cheerio from 'cheerio'
......
/* global jasmine, describe, it, expect, beforeAll, afterAll */
/* eslint-env jest */
/* global jasmine */
import { join } from 'path'
import getPort from 'get-port'
import clone from 'clone'
......
/* global jasmine, describe, it, expect, beforeAll, afterAll */
/* eslint-env jest */
/* global jasmine */
import { join } from 'path'
import { existsSync } from 'fs'
import {BUILD_ID_FILE} from 'next-server/constants'
......
/* global describe, it, expect */
/* eslint-env jest */
import webdriver from 'next-webdriver'
import { check, getBrowserBodyText } from 'next-test-utils'
......
/* global describe, it, expect */
/* eslint-env jest */
import webdriver from 'next-webdriver'
import { renderViaHTTP, getBrowserBodyText, check } from 'next-test-utils'
import cheerio from 'cheerio'
......
/* global jasmine, describe, beforeAll, afterAll */
/* eslint-env jest */
/* global jasmine */
import { join } from 'path'
import {
nextBuild,
......
/* global describe, it, expect */
/* eslint-env jest */
import { renderViaHTTP } from 'next-test-utils'
import cheerio from 'cheerio'
......
/* global jasmine, describe, it, expect, beforeAll, afterAll */
/* eslint-env jest */
/* global jasmine */
import { join } from 'path'
import getPort from 'get-port'
import {
......
/* global jasmine, describe, beforeAll, afterAll, it, expect */
/* eslint-env jest */
/* global jasmine */
import { join, resolve } from 'path'
import { existsSync } from 'fs'
import webdriver from 'next-webdriver'
......
/* global describe, it, expect */
/* eslint-env jest */
import webdriver from 'next-webdriver'
import { readFileSync, writeFileSync } from 'fs'
import { join } from 'path'
......
/* global jasmine, describe, beforeAll, afterAll */
/* eslint-env jest */
/* global jasmine */
import { join } from 'path'
import {
renderViaHTTP,
......
/* eslint-env jest */
/* global jasmine */
import { join } from 'path'
import {
nextServer,
......
/* global describe, it, expect */
/* eslint-env jest */
import webdriver from 'next-webdriver'
import cheerio from 'cheerio'
import { waitFor, check } from 'next-test-utils'
......
/* global jasmine, describe, it, expect, beforeAll, afterAll */
/* eslint-env jest */
/* global jasmine */
import { readFileSync } from 'fs'
import { join } from 'path'
import {
......
/* global describe, it, expect */
/* eslint-env jest */
import webdriver from 'next-webdriver'
import { readFile } from 'fs'
import { promisify } from 'util'
......
/* global describe, it, expect
*/
/* eslint-env jest */
import { readFileSync } from 'fs'
import { join } from 'path'
import { renderViaHTTP, getBrowserBodyText, waitFor } from 'next-test-utils'
import webdriver from 'next-webdriver'
// 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()
while(Date.now() - start < 15000) {
while (Date.now() - start < 15000) {
const bodyText = await getBrowserBodyText(browser)
if(/INJECTED/.test(bodyText)) {
if (/INJECTED/.test(bodyText)) {
throw new Error('Vulnerable to XSS attacks')
}
await waitFor(500)
......@@ -69,7 +67,6 @@ module.exports = (context) => {
const browser = await webdriver(context.appPort, `/;'-(document.body.innerHTML='INJECTED')-'`)
await checkInjected(browser)
browser.close()
})
......
/* global jasmine, describe, it, expect, beforeAll, afterAll */
/* eslint-env jest */
/* global jasmine */
import { join } from 'path'
import {
nextServer,
......
/* global describe, it, expect */
/* eslint-env jest */
import {join} from 'path'
import loadConfig from 'next-server/next-config'
......
/* global describe, it, expect */
/* eslint-env jest */
import { join } from 'path'
import {SERVER_DIRECTORY, CLIENT_STATIC_FILES_PATH} from 'next-server/constants'
......
/* global describe, it, expect */
/* eslint-env jest */
import {normalize, join} from 'path'
import {getPageEntries, createEntry} from 'next/dist/build/webpack/utils'
......
/* global describe, it, expect */
/* eslint-env jest */
import EventEmitter from 'next-server/dist/lib/EventEmitter'
describe('EventEmitter', () => {
......
/* global describe, it, expect */
/* eslint-env jest */
import { Component } from 'react'
import { getDisplayName } from 'next-server/dist/lib/utils'
......
/* global describe, it, expect */
/* eslint-env jest */
import { loadGetInitialProps } from 'next-server/dist/lib/utils'
describe('loadGetInitialProps', () => {
......
/* global describe, it, expect */
/* eslint-env jest */
import Router from 'next-server/dist/lib/router/router'
class PageLoader {
......
/* global describe, it, expect */
/* eslint-env jest */
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