Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
18488f47
Commit
18488f47
authored
Oct 20, 2018
by
Henrik Wenz
Committed by
Tim Neutkens
Oct 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix linter (#5350)
* Fix linter * Add test env * Fix lint errors
parent
9a09de2f
Hide whitespace changes
Inline
Side-by-side
Showing
50 changed files
with
69 additions
and
83 deletions
+69
-83
server.js
examples/custom-server-polka/server.js
+3
-3
_document.js
examples/with-styled-components/pages/_document.js
+1
-1
package.json
package.json
+4
-4
constants.js
packages/next-server/constants.js
+1
-1
constants.js
packages/next-server/lib/constants.js
+1
-2
next-config.js
packages/next-server/next-config.js
+1
-1
head.js
packages/next/head.js
+1
-1
package.json
packages/next/package.json
+0
-10
index.test.js
test/integration/app-aspath/test/index.test.js
+2
-2
client.js
test/integration/app-document/test/client.js
+1
-1
csp.js
test/integration/app-document/test/csp.js
+1
-1
index.test.js
test/integration/app-document/test/index.test.js
+2
-2
rendering.js
test/integration/app-document/test/rendering.js
+1
-1
index.test.js
test/integration/babel/test/index.test.js
+2
-2
rendering.js
test/integration/babel/test/rendering.js
+1
-1
asset.js
test/integration/basic/test/asset.js
+1
-1
client-navigation.js
test/integration/basic/test/client-navigation.js
+1
-1
dynamic.js
test/integration/basic/test/dynamic.js
+1
-1
error-recovery.js
test/integration/basic/test/error-recovery.js
+1
-1
hmr.js
test/integration/basic/test/hmr.js
+1
-1
index.test.js
test/integration/basic/test/index.test.js
+2
-2
process-env.js
test/integration/basic/test/process-env.js
+1
-1
rendering.js
test/integration/basic/test/rendering.js
+1
-1
client.js
test/integration/config/test/client.js
+1
-1
index.test.js
test/integration/config/test/index.test.js
+2
-2
rendering.js
test/integration/config/test/rendering.js
+1
-1
index.test.js
test/integration/custom-server/test/index.test.js
+2
-2
index.test.js
test/integration/dist-dir/test/index.test.js
+2
-2
browser.js
test/integration/export/test/browser.js
+1
-1
dev.js
test/integration/export/test/dev.js
+1
-1
index.test.js
test/integration/export/test/index.test.js
+2
-2
ssr.js
test/integration/export/test/ssr.js
+1
-1
index.test.js
test/integration/filesystempublicroutes/test/index.test.js
+2
-2
index.test.js
test/integration/ondemand/test/index.test.js
+2
-1
hmr.js
test/integration/page-extensions/test/hmr.js
+1
-1
index.test.js
test/integration/page-extensions/test/index.test.js
+2
-2
index.test.js
test/integration/production-config/test/index.test.js
+0
-1
dynamic.js
test/integration/production/test/dynamic.js
+1
-1
index.test.js
test/integration/production/test/index.test.js
+2
-2
process-env.js
test/integration/production/test/process-env.js
+1
-1
security.js
test/integration/production/test/security.js
+4
-7
index.test.js
test/integration/with-router/test/index.test.js
+2
-2
config.test.js
test/isolated/config.test.js
+1
-1
require-page.test.js
test/isolated/require-page.test.js
+1
-1
webpack-utils.test.js
test/isolated/webpack-utils.test.js
+1
-1
EventEmitter.test.js
test/unit/EventEmitter.test.js
+1
-1
getDisplayName.test.js
test/unit/getDisplayName.test.js
+1
-1
loadGetInitialProps.test.js
test/unit/loadGetInitialProps.test.js
+1
-1
router.test.js
test/unit/router.test.js
+1
-1
shallow-equal.test.js
test/unit/shallow-equal.test.js
+1
-1
No files found.
examples/custom-server-polka/server.js
View file @
18488f47
...
...
@@ -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
}
`
)
})
})
examples/with-styled-components/pages/_document.js
View file @
18488f47
...
...
@@ -22,4 +22,4 @@ export default class MyDocument extends Document {
<
/html
>
)
}
}
\ No newline at end of file
}
package.json
View file @
18488f47
...
...
@@ -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"
:
{
...
...
packages/next-server/constants.js
View file @
18488f47
module
.
exports
=
require
(
'./dist/lib/constants'
)
\ No newline at end of file
module
.
exports
=
require
(
'./dist/lib/constants'
)
packages/next-server/lib/constants.js
View file @
18488f47
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$/
packages/next-server/next-config.js
View file @
18488f47
module
.
exports
=
require
(
'./dist/server/config'
)
\ No newline at end of file
module
.
exports
=
require
(
'./dist/server/config'
)
packages/next/head.js
View file @
18488f47
module
.
exports
=
require
(
'next-server/head'
)
\ No newline at end of file
module
.
exports
=
require
(
'next-server/head'
)
packages/next/package.json
View file @
18488f47
...
...
@@ -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"
,
...
...
test/integration/app-aspath/test/index.test.js
View file @
18488f47
/*
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'
...
...
test/integration/app-document/test/client.js
View file @
18488f47
/*
global describe, it, expec
t */
/*
eslint-env jes
t */
import
webdriver
from
'next-webdriver'
import
{
readFileSync
,
writeFileSync
}
from
'fs'
...
...
test/integration/app-document/test/csp.js
View file @
18488f47
/*
global describe, it, expec
t */
/*
eslint-env jes
t */
import
webdriver
from
'next-webdriver'
...
...
test/integration/app-document/test/index.test.js
View file @
18488f47
/*
global jasmine, describe, beforeAll, afterAll
*/
/*
eslint-env jest
*/
/* global jasmine */
import
{
join
}
from
'path'
import
{
renderViaHTTP
,
...
...
test/integration/app-document/test/rendering.js
View file @
18488f47
/*
global describe, test, expec
t */
/*
eslint-env jes
t */
import
cheerio
from
'cheerio'
...
...
test/integration/babel/test/index.test.js
View file @
18488f47
/*
global jasmine, describe, beforeAll, afterAll
*/
/*
eslint-env jest
*/
/* global jasmine */
import
{
join
}
from
'path'
import
{
renderViaHTTP
,
...
...
test/integration/babel/test/rendering.js
View file @
18488f47
/*
global describe, it, expec
t */
/*
eslint-env jes
t */
import
cheerio
from
'cheerio'
...
...
test/integration/basic/test/asset.js
View file @
18488f47
/*
global describe, it, expec
t */
/*
eslint-env jes
t */
import
cheerio
from
'cheerio'
import
{
renderViaHTTP
...
...
test/integration/basic/test/client-navigation.js
View file @
18488f47
/*
global describe, it, expec
t */
/*
eslint-env jes
t */
import
webdriver
from
'next-webdriver'
import
{
waitFor
,
getReactErrorOverlayContent
}
from
'next-test-utils'
...
...
test/integration/basic/test/dynamic.js
View file @
18488f47
/*
global describe, it, expec
t */
/*
eslint-env jes
t */
import
webdriver
from
'next-webdriver'
import
cheerio
from
'cheerio'
import
{
waitFor
,
check
}
from
'next-test-utils'
...
...
test/integration/basic/test/error-recovery.js
View file @
18488f47
/*
global describe, it, expec
t */
/*
eslint-env jes
t */
import
webdriver
from
'next-webdriver'
import
{
join
}
from
'path'
import
{
check
,
File
,
waitFor
,
getReactErrorOverlayContent
,
getBrowserBodyText
}
from
'next-test-utils'
...
...
test/integration/basic/test/hmr.js
View file @
18488f47
/*
global describe, it, expec
t */
/*
eslint-env jes
t */
import
webdriver
from
'next-webdriver'
import
{
readFileSync
,
writeFileSync
,
renameSync
,
existsSync
}
from
'fs'
import
{
join
}
from
'path'
...
...
test/integration/basic/test/index.test.js
View file @
18488f47
/*
global jasmine, describe, beforeAll, afterAll
*/
/*
eslint-env jest
*/
/* global jasmine */
import
{
join
}
from
'path'
import
{
renderViaHTTP
,
...
...
test/integration/basic/test/process-env.js
View file @
18488f47
/*
global describe, it, expec
t */
/*
eslint-env jes
t */
import
webdriver
from
'next-webdriver'
export
default
(
context
,
render
)
=>
{
...
...
test/integration/basic/test/rendering.js
View file @
18488f47
/*
global describe, test, it, expec
t */
/*
eslint-env jes
t */
import
cheerio
from
'cheerio'
import
{
BUILD_MANIFEST
,
REACT_LOADABLE_MANIFEST
}
from
'next-server/constants'
...
...
test/integration/config/test/client.js
View file @
18488f47
/*
global describe, it, expec
t */
/*
eslint-env jes
t */
import
webdriver
from
'next-webdriver'
import
{
waitFor
,
check
,
File
}
from
'next-test-utils'
...
...
test/integration/config/test/index.test.js
View file @
18488f47
/*
global jasmine, describe, beforeAll, afterAll
*/
/*
eslint-env jest
*/
/* global jasmine */
import
{
join
}
from
'path'
import
{
renderViaHTTP
,
...
...
test/integration/config/test/rendering.js
View file @
18488f47
/*
global describe, test, expec
t */
/*
eslint-env jes
t */
import
cheerio
from
'cheerio'
...
...
test/integration/custom-server/test/index.test.js
View file @
18488f47
/*
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'
...
...
test/integration/dist-dir/test/index.test.js
View file @
18488f47
/*
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'
...
...
test/integration/export/test/browser.js
View file @
18488f47
/*
global describe, it, expec
t */
/*
eslint-env jes
t */
import
webdriver
from
'next-webdriver'
import
{
check
,
getBrowserBodyText
}
from
'next-test-utils'
...
...
test/integration/export/test/dev.js
View file @
18488f47
/*
global describe, it, expec
t */
/*
eslint-env jes
t */
import
webdriver
from
'next-webdriver'
import
{
renderViaHTTP
,
getBrowserBodyText
,
check
}
from
'next-test-utils'
import
cheerio
from
'cheerio'
...
...
test/integration/export/test/index.test.js
View file @
18488f47
/*
global jasmine, describe, beforeAll, afterAll
*/
/*
eslint-env jest
*/
/* global jasmine */
import
{
join
}
from
'path'
import
{
nextBuild
,
...
...
test/integration/export/test/ssr.js
View file @
18488f47
/*
global describe, it, expec
t */
/*
eslint-env jes
t */
import
{
renderViaHTTP
}
from
'next-test-utils'
import
cheerio
from
'cheerio'
...
...
test/integration/filesystempublicroutes/test/index.test.js
View file @
18488f47
/*
global jasmine, describe, it, expect, beforeAll, afterAll
*/
/*
eslint-env jest
*/
/* global jasmine */
import
{
join
}
from
'path'
import
getPort
from
'get-port'
import
{
...
...
test/integration/ondemand/test/index.test.js
View file @
18488f47
/* 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'
...
...
test/integration/page-extensions/test/hmr.js
View file @
18488f47
/*
global describe, it, expec
t */
/*
eslint-env jes
t */
import
webdriver
from
'next-webdriver'
import
{
readFileSync
,
writeFileSync
}
from
'fs'
import
{
join
}
from
'path'
...
...
test/integration/page-extensions/test/index.test.js
View file @
18488f47
/*
global jasmine, describe, beforeAll, afterAll
*/
/*
eslint-env jest
*/
/* global jasmine */
import
{
join
}
from
'path'
import
{
renderViaHTTP
,
...
...
test/integration/production-config/test/index.test.js
View file @
18488f47
/* eslint-env jest */
/* global jasmine */
import
{
join
}
from
'path'
import
{
nextServer
,
...
...
test/integration/production/test/dynamic.js
View file @
18488f47
/*
global describe, it, expec
t */
/*
eslint-env jes
t */
import
webdriver
from
'next-webdriver'
import
cheerio
from
'cheerio'
import
{
waitFor
,
check
}
from
'next-test-utils'
...
...
test/integration/production/test/index.test.js
View file @
18488f47
/*
global jasmine, describe, it, expect, beforeAll, afterAll
*/
/*
eslint-env jest
*/
/* global jasmine */
import
{
readFileSync
}
from
'fs'
import
{
join
}
from
'path'
import
{
...
...
test/integration/production/test/process-env.js
View file @
18488f47
/*
global describe, it, expec
t */
/*
eslint-env jes
t */
import
webdriver
from
'next-webdriver'
import
{
readFile
}
from
'fs'
import
{
promisify
}
from
'util'
...
...
test/integration/production/test/security.js
View file @
18488f47
/* 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
()
})
...
...
test/integration/with-router/test/index.test.js
View file @
18488f47
/*
global jasmine, describe, it, expect, beforeAll, afterAll
*/
/*
eslint-env jest
*/
/* global jasmine */
import
{
join
}
from
'path'
import
{
nextServer
,
...
...
test/isolated/config.test.js
View file @
18488f47
/*
global describe, it, expec
t */
/*
eslint-env jes
t */
import
{
join
}
from
'path'
import
loadConfig
from
'next-server/next-config'
...
...
test/isolated/require-page.test.js
View file @
18488f47
/*
global describe, it, expec
t */
/*
eslint-env jes
t */
import
{
join
}
from
'path'
import
{
SERVER_DIRECTORY
,
CLIENT_STATIC_FILES_PATH
}
from
'next-server/constants'
...
...
test/isolated/webpack-utils.test.js
View file @
18488f47
/*
global describe, it, expec
t */
/*
eslint-env jes
t */
import
{
normalize
,
join
}
from
'path'
import
{
getPageEntries
,
createEntry
}
from
'next/dist/build/webpack/utils'
...
...
test/unit/EventEmitter.test.js
View file @
18488f47
/*
global describe, it, expec
t */
/*
eslint-env jes
t */
import
EventEmitter
from
'next-server/dist/lib/EventEmitter'
describe
(
'EventEmitter'
,
()
=>
{
...
...
test/unit/getDisplayName.test.js
View file @
18488f47
/*
global describe, it, expec
t */
/*
eslint-env jes
t */
import
{
Component
}
from
'react'
import
{
getDisplayName
}
from
'next-server/dist/lib/utils'
...
...
test/unit/loadGetInitialProps.test.js
View file @
18488f47
/*
global describe, it, expec
t */
/*
eslint-env jes
t */
import
{
loadGetInitialProps
}
from
'next-server/dist/lib/utils'
describe
(
'loadGetInitialProps'
,
()
=>
{
...
...
test/unit/router.test.js
View file @
18488f47
/*
global describe, it, expec
t */
/*
eslint-env jes
t */
import
Router
from
'next-server/dist/lib/router/router'
class
PageLoader
{
...
...
test/unit/shallow-equal.test.js
View file @
18488f47
/*
global describe, it, expec
t */
/*
eslint-env jes
t */
import
shallowEquals
from
'next-server/dist/lib/shallow-equals'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment