Answer the question
In order to leave comments, you need to log in
Eslint Top level await?
Hello, please advise. I use VS Code editor and Node JS 14+. Now Top-Level Await is screwed in the node .
And it is not clear how to configure eslint so that it does not display errors
Parsing error: Cannot use keyword 'await' outside an async function
package.json
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"fastify": "^3.4.1"
},
"devDependencies": {
"@babel/core": "^7.11.6",
"@babel/eslint-parser": "^7.11.5",
"@babel/plugin-syntax-top-level-await": "^7.10.4",
"eslint": "^7.9.0",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-node": "^11.1.0"
}
}
module.exports = {
parserOptions: {
ecmaVersion: 2021,
sourceType: 'module',
parser: "@babel/eslint-parser"
}
};
{
"plugins": ["@babel/plugin-syntax-top-level-await"]
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question