From db4211856f22d4e6c3cbec79aba266fdf8fa25e0 Mon Sep 17 00:00:00 2001 From: Katerina Koukiou Date: Fri, 11 Feb 2022 17:58:53 +0100 Subject: [PATCH] feat: support ESLint 8.x Fixes #68 --- package.json | 10 +++++----- test/validate-config.js | 17 +++++++++-------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 39ddf19..cf62fee 100644 --- a/package.json +++ b/package.json @@ -11,9 +11,9 @@ "url": "https://github.com/feross/eslint-config-standard-react/issues" }, "devDependencies": { - "eslint": "^7.12.1", - "eslint-plugin-react": "^7.21.5", - "tape": "^5.0.1" + "eslint": "^8.8.0", + "eslint-plugin-react": "^7.28.0", + "tape": "^5.5.0" }, "homepage": "https://github.com/feross/eslint-config-standard-react", "keywords": [ @@ -47,8 +47,8 @@ "license": "MIT", "main": "index.js", "peerDependencies": { - "eslint": "^7.12.1", - "eslint-plugin-react": "^7.21.5" + "eslint": "^8.8.0", + "eslint-plugin-react": "^7.28.0" }, "repository": { "type": "git", diff --git a/test/validate-config.js b/test/validate-config.js index 39c7ce9..2a5d6c9 100644 --- a/test/validate-config.js +++ b/test/validate-config.js @@ -1,16 +1,17 @@ -const eslint = require('eslint') +const { ESLint } = require('eslint') const test = require('tape') -test('load config in eslint to validate all rule syntax is correct', function (t) { - const CLIEngine = eslint.CLIEngine - - const cli = new CLIEngine({ - useEslintrc: false, - configFile: 'eslintrc.json' +test('load config in eslint to validate all rule syntax is correct', async t => { + const cli = new ESLint({ + useEslintrc: false, + overrideConfigFile: 'eslintrc.json' }) + const code = 'var foo = 1\nvar bar = function () {}\nbar(foo)\n' + const result = await cli.lintText(code) - t.equal(cli.executeOnText(code).errorCount, 0) + t.equal(result.length, 1, 'Should return a single result item') + t.equal(result[0].errorCount, 0, 'The result item should show no errors') t.end() })