1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Fix linter (#5350)

* Fix linter

* Add test env

* Fix lint errors
This commit is contained in:
Henrik Wenz 2018-10-20 17:00:01 +02:00 committed by Tim Neutkens
parent 9a09de2feb
commit 18488f47b0
50 changed files with 69 additions and 83 deletions

View file

@ -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}`)
})
})

View 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": {

View file

@ -1,4 +1,3 @@
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'

View file

@ -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",

View file

@ -1,5 +1,5 @@
/* 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'

View file

@ -1,4 +1,4 @@
/* global describe, it, expect */
/* eslint-env jest */
import webdriver from 'next-webdriver'
import { readFileSync, writeFileSync } from 'fs'

View file

@ -1,4 +1,4 @@
/* global describe, it, expect */
/* eslint-env jest */
import webdriver from 'next-webdriver'

View file

@ -1,5 +1,5 @@
/* global jasmine, describe, beforeAll, afterAll */
/* eslint-env jest */
/* global jasmine */
import { join } from 'path'
import {
renderViaHTTP,

View file

@ -1,4 +1,4 @@
/* global describe, test, expect */
/* eslint-env jest */
import cheerio from 'cheerio'

View file

@ -1,5 +1,5 @@
/* global jasmine, describe, beforeAll, afterAll */
/* eslint-env jest */
/* global jasmine */
import { join } from 'path'
import {
renderViaHTTP,

View file

@ -1,4 +1,4 @@
/* global describe, it, expect */
/* eslint-env jest */
import cheerio from 'cheerio'

View file

@ -1,4 +1,4 @@
/* global describe, it, expect */
/* eslint-env jest */
import cheerio from 'cheerio'
import {
renderViaHTTP

View file

@ -1,4 +1,4 @@
/* global describe, it, expect */
/* eslint-env jest */
import webdriver from 'next-webdriver'
import {waitFor, getReactErrorOverlayContent} from 'next-test-utils'

View file

@ -1,4 +1,4 @@
/* global describe, it, expect */
/* eslint-env jest */
import webdriver from 'next-webdriver'
import cheerio from 'cheerio'
import { waitFor, check } from 'next-test-utils'

View file

@ -1,4 +1,4 @@
/* 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'

View file

@ -1,4 +1,4 @@
/* global describe, it, expect */
/* eslint-env jest */
import webdriver from 'next-webdriver'
import { readFileSync, writeFileSync, renameSync, existsSync } from 'fs'
import { join } from 'path'

View file

@ -1,5 +1,5 @@
/* global jasmine, describe, beforeAll, afterAll */
/* eslint-env jest */
/* global jasmine */
import { join } from 'path'
import {
renderViaHTTP,

View file

@ -1,4 +1,4 @@
/* global describe, it, expect */
/* eslint-env jest */
import webdriver from 'next-webdriver'
export default (context, render) => {

View file

@ -1,4 +1,4 @@
/* global describe, test, it, expect */
/* eslint-env jest */
import cheerio from 'cheerio'
import {BUILD_MANIFEST, REACT_LOADABLE_MANIFEST} from 'next-server/constants'

View file

@ -1,4 +1,4 @@
/* global describe, it, expect */
/* eslint-env jest */
import webdriver from 'next-webdriver'
import { waitFor, check, File } from 'next-test-utils'

View file

@ -1,5 +1,5 @@
/* global jasmine, describe, beforeAll, afterAll */
/* eslint-env jest */
/* global jasmine */
import { join } from 'path'
import {
renderViaHTTP,

View file

@ -1,4 +1,4 @@
/* global describe, test, expect */
/* eslint-env jest */
import cheerio from 'cheerio'

View file

@ -1,5 +1,5 @@
/* 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'

View file

@ -1,5 +1,5 @@
/* 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'

View file

@ -1,4 +1,4 @@
/* global describe, it, expect */
/* eslint-env jest */
import webdriver from 'next-webdriver'
import { check, getBrowserBodyText } from 'next-test-utils'

View file

@ -1,4 +1,4 @@
/* global describe, it, expect */
/* eslint-env jest */
import webdriver from 'next-webdriver'
import { renderViaHTTP, getBrowserBodyText, check } from 'next-test-utils'
import cheerio from 'cheerio'

View file

@ -1,5 +1,5 @@
/* global jasmine, describe, beforeAll, afterAll */
/* eslint-env jest */
/* global jasmine */
import { join } from 'path'
import {
nextBuild,

View file

@ -1,4 +1,4 @@
/* global describe, it, expect */
/* eslint-env jest */
import { renderViaHTTP } from 'next-test-utils'
import cheerio from 'cheerio'

View file

@ -1,5 +1,5 @@
/* global jasmine, describe, it, expect, beforeAll, afterAll */
/* eslint-env jest */
/* global jasmine */
import { join } from 'path'
import getPort from 'get-port'
import {

View file

@ -1,4 +1,5 @@
/* 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'

View file

@ -1,4 +1,4 @@
/* global describe, it, expect */
/* eslint-env jest */
import webdriver from 'next-webdriver'
import { readFileSync, writeFileSync } from 'fs'
import { join } from 'path'

View file

@ -1,5 +1,5 @@
/* global jasmine, describe, beforeAll, afterAll */
/* eslint-env jest */
/* global jasmine */
import { join } from 'path'
import {
renderViaHTTP,

View file

@ -1,6 +1,5 @@
/* eslint-env jest */
/* global jasmine */
import { join } from 'path'
import {
nextServer,

View file

@ -1,4 +1,4 @@
/* global describe, it, expect */
/* eslint-env jest */
import webdriver from 'next-webdriver'
import cheerio from 'cheerio'
import { waitFor, check } from 'next-test-utils'

View file

@ -1,5 +1,5 @@
/* global jasmine, describe, it, expect, beforeAll, afterAll */
/* eslint-env jest */
/* global jasmine */
import { readFileSync } from 'fs'
import { join } from 'path'
import {

View file

@ -1,4 +1,4 @@
/* global describe, it, expect */
/* eslint-env jest */
import webdriver from 'next-webdriver'
import { readFile } from 'fs'
import { promisify } from 'util'

View file

@ -1,17 +1,15 @@
/* 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()
})

View file

@ -1,5 +1,5 @@
/* global jasmine, describe, it, expect, beforeAll, afterAll */
/* eslint-env jest */
/* global jasmine */
import { join } from 'path'
import {
nextServer,

View file

@ -1,4 +1,4 @@
/* global describe, it, expect */
/* eslint-env jest */
import {join} from 'path'
import loadConfig from 'next-server/next-config'

View file

@ -1,4 +1,4 @@
/* global describe, it, expect */
/* eslint-env jest */
import { join } from 'path'
import {SERVER_DIRECTORY, CLIENT_STATIC_FILES_PATH} from 'next-server/constants'

View file

@ -1,4 +1,4 @@
/* global describe, it, expect */
/* eslint-env jest */
import {normalize, join} from 'path'
import {getPageEntries, createEntry} from 'next/dist/build/webpack/utils'

View file

@ -1,4 +1,4 @@
/* global describe, it, expect */
/* eslint-env jest */
import EventEmitter from 'next-server/dist/lib/EventEmitter'
describe('EventEmitter', () => {

View file

@ -1,4 +1,4 @@
/* global describe, it, expect */
/* eslint-env jest */
import { Component } from 'react'
import { getDisplayName } from 'next-server/dist/lib/utils'

View file

@ -1,4 +1,4 @@
/* global describe, it, expect */
/* eslint-env jest */
import { loadGetInitialProps } from 'next-server/dist/lib/utils'
describe('loadGetInitialProps', () => {

View file

@ -1,4 +1,4 @@
/* global describe, it, expect */
/* eslint-env jest */
import Router from 'next-server/dist/lib/router/router'
class PageLoader {

View file

@ -1,4 +1,4 @@
/* global describe, it, expect */
/* eslint-env jest */
import shallowEquals from 'next-server/dist/lib/shallow-equals'