From f364e987c1e234a682e8925defa2bfa29f9193cd Mon Sep 17 00:00:00 2001 From: Pelle Wessman Date: Mon, 31 Jan 2022 22:45:55 +0100 Subject: [PATCH] fix: allow top-level `await` support (#212) --- .eslintrc.json | 2 +- package.json | 6 ++++-- test/validate-config.js | 8 ++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 9d14f1d7..f92423cb 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,6 +1,6 @@ { "parserOptions": { - "ecmaVersion": 2021, + "ecmaVersion": 2022, "ecmaFeatures": { "jsx": true }, diff --git a/package.json b/package.json index a4679847..80e0822a 100644 --- a/package.json +++ b/package.json @@ -11,11 +11,13 @@ "url": "https://github.com/standard/eslint-config-standard/issues" }, "devDependencies": { - "eslint": "^8.6.0", + "@types/eslint": "^8.4.1", + "@types/tape": "^4.13.2", + "eslint": "^8.8.0", "eslint-plugin-import": "^2.25.4", "eslint-plugin-n": "^14.0.0", "eslint-plugin-promise": "^6.0.0", - "tape": "^5.4.0" + "tape": "^5.5.0" }, "homepage": "https://github.com/standard/eslint-config-standard", "keywords": [ diff --git a/test/validate-config.js b/test/validate-config.js index 090d1a5b..34b6a431 100644 --- a/test/validate-config.js +++ b/test/validate-config.js @@ -8,3 +8,11 @@ test('load config in eslint to validate all rule syntax is correct', async funct t.equal(lintResult.errorCount, 0) t.end() }) + +test('ensure we allow top level await', async function (t) { + const eslint = new ESLint() + const code = 'const foo = await 1\nconst bar = function () {}\nawait bar(foo)\n' + const [lintResult] = await eslint.lintText(code) + t.equal(lintResult.errorCount, 0) + t.end() +})