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
c8f25ba7
Unverified
Commit
c8f25ba7
authored
Oct 20, 2021
by
Houssein Djirdeh
Committed by
GitHub
Oct 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adds temporary eslint v8 error (#30113)
parent
62895a8b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
66 additions
and
10 deletions
+66
-10
runLintCheck.ts
packages/next/lib/eslint/runLintCheck.ts
+13
-4
.eslintrc
...integration/eslint/invalid-newer-eslint-version/.eslintrc
+4
-0
api.js
...valid-newer-eslint-version/node_modules/eslint/lib/api.js
+1
-0
package.json
...lid-newer-eslint-version/node_modules/eslint/package.json
+5
-0
index.js
...ration/eslint/invalid-newer-eslint-version/pages/index.js
+8
-0
index.test.js
test/integration/eslint/test/index.test.js
+35
-6
No files found.
packages/next/lib/eslint/runLintCheck.ts
View file @
c8f25ba7
...
...
@@ -26,7 +26,7 @@ type Config = {
}
const
requiredPackages
=
[
{
file
:
'eslint
/lib/api.js
'
,
pkg
:
'eslint'
},
{
file
:
'eslint'
,
pkg
:
'eslint'
},
{
file
:
'eslint-config-next'
,
pkg
:
'eslint-config-next'
},
]
...
...
@@ -94,8 +94,8 @@ async function lint(
lintDuringBuild
?
' in order to run during builds:'
:
':'
}
${
chalk
.
bold
.
cyan
(
(
await
isYarn
(
baseDir
))
?
'yarn add --dev eslint
'
:
'npm install --save-dev eslint
'
?
'yarn add --dev eslint
@"<8.0.0"'
// TODO: Remove @"<8.0.0" when ESLint v8 is supported https://github.com/vercel/next.js/pull/29865
:
'npm install --save-dev eslint
@"<8.0.0"'
// TODO: Remove @"<8.0.0" when ESLint v8 is supported https://github.com/vercel/next.js/pull/29865
)}
`
)
return
null
...
...
@@ -111,7 +111,16 @@ async function lint(
'error'
)}
- Your project has an older version of ESLint installed
${
eslintVersion
?
' ('
+
eslintVersion
+
')'
:
''
}
. Please upgrade to ESLint version 7 or later`
}
. Please upgrade to ESLint version 7`
}
else
if
(
semver
.
gte
(
eslintVersion
,
'8.0.0'
))
{
// TODO: Remove this check when ESLint v8 is supported https://github.com/vercel/next.js/pull/29865
return
`
${
chalk
.
red
(
'error'
)}
- ESLint version
${
eslintVersion
?
eslintVersion
:
'8'
}
is not yet supported. Please downgrade to version 7 for the meantime:
${
chalk
.
bold
.
cyan
(
(
await
isYarn
(
baseDir
))
?
'yarn remove eslint && yarn add --dev eslint@"<8.0.0"'
:
'npm uninstall eslint && npm install --save-dev eslint@"<8.0.0"'
)}
`
}
let
options
:
any
=
{
...
...
test/integration/eslint/invalid-newer-eslint-version/.eslintrc
0 → 100644
View file @
c8f25ba7
{
"extends": "next",
"root": true
}
test/integration/eslint/invalid-newer-eslint-version/node_modules/eslint/lib/api.js
0 → 100644
View file @
c8f25ba7
module
.
exports
=
{
ESLint
:
{
version
:
'8.0.1'
}
}
test/integration/eslint/invalid-newer-eslint-version/node_modules/eslint/package.json
0 → 100644
View file @
c8f25ba7
{
"name"
:
"eslint"
,
"main"
:
"./lib/api.js"
,
"version"
:
"8.0.1"
}
test/integration/eslint/invalid-newer-eslint-version/pages/index.js
0 → 100644
View file @
c8f25ba7
const
Home
=
()
=>
(
<
div
>
<
p
>
Home
<
/p
>
/* Badly formatted comment */
<
/div
>
)
export
default
Home
test/integration/eslint/test/index.test.js
View file @
c8f25ba7
...
...
@@ -21,7 +21,14 @@ const dirPluginCoreWebVitalsConfig = join(
const
dirIgnoreDuringBuilds
=
join
(
__dirname
,
'../ignore-during-builds'
)
const
dirCustomDirectories
=
join
(
__dirname
,
'../custom-directories'
)
const
dirConfigInPackageJson
=
join
(
__dirname
,
'../config-in-package-json'
)
const
dirInvalidEslintVersion
=
join
(
__dirname
,
'../invalid-eslint-version'
)
const
dirInvalidOlderEslintVersion
=
join
(
__dirname
,
'../invalid-eslint-version'
)
const
dirInvalidNewerEslintVersion
=
join
(
__dirname
,
'../invalid-newer-eslint-version'
)
const
dirMaxWarnings
=
join
(
__dirname
,
'../max-warnings'
)
const
dirEmptyDirectory
=
join
(
__dirname
,
'../empty-directory'
)
const
dirEslintIgnore
=
join
(
__dirname
,
'../eslint-ignore'
)
...
...
@@ -92,11 +99,15 @@ describe('ESLint', () => {
)
})
test
(
'invalid eslint version'
,
async
()
=>
{
const
{
stdout
,
stderr
}
=
await
nextBuild
(
dirInvalidEslintVersion
,
[],
{
stdout
:
true
,
stderr
:
true
,
})
test
(
'invalid older eslint version'
,
async
()
=>
{
const
{
stdout
,
stderr
}
=
await
nextBuild
(
dirInvalidOlderEslintVersion
,
[],
{
stdout
:
true
,
stderr
:
true
,
}
)
const
output
=
stdout
+
stderr
expect
(
output
).
toContain
(
...
...
@@ -104,6 +115,24 @@ describe('ESLint', () => {
)
})
// TODO: Remove this test when ESLint v8 is supported https://github.com/vercel/next.js/pull/29865
test
(
'invalid newer eslint version'
,
async
()
=>
{
const
{
stdout
,
stderr
}
=
await
nextBuild
(
dirInvalidNewerEslintVersion
,
[],
{
stdout
:
true
,
stderr
:
true
,
}
)
const
output
=
stdout
+
stderr
console
.
log
(
output
)
expect
(
output
).
toContain
(
'ESLint version 8.0.1 is not yet supported. Please downgrade to version 7 for the meantime'
)
})
test
(
'empty directories do not fail the build'
,
async
()
=>
{
const
{
stdout
,
stderr
}
=
await
nextBuild
(
dirEmptyDirectory
,
[],
{
stdout
:
true
,
...
...
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