Unverified Commit 8610ba4b authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Fix eslint version check for older versions (#26212)

parent 947ee9dd
......@@ -42,7 +42,7 @@ async function lint(
const mod = await import(deps.resolved.get('eslint')!)
const { ESLint } = mod
let eslintVersion = ESLint.version
let eslintVersion = ESLint?.version
if (!ESLint) {
eslintVersion = mod?.CLIEngine?.version
......
{
"name": "eslint",
"main": "./index.js",
"version": "6.0.1"
}
const Home = () => (
<div>
<p>Home</p>
/* Badly formatted comment */
</div>
)
export default Home
......@@ -11,6 +11,7 @@ const dirCustomConfig = join(__dirname, '../custom-config')
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')
describe('ESLint', () => {
describe('Next Build', () => {
......@@ -73,6 +74,18 @@ describe('ESLint', () => {
'Warning: External synchronous scripts are forbidden'
)
})
test.only('invalid eslint version', async () => {
const { stdout, stderr } = await nextBuild(dirInvalidEslintVersion, [], {
stdout: true,
stderr: true,
})
const output = stdout + stderr
expect(output).toContain(
'Your project has an older version of ESLint installed'
)
})
})
describe('Next Lint', () => {
......
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