Здравсвтуйте, подскажите пожалуйста. Использую редактор VS Code и Node JS 14+. Сейчас в ноде прикрутили
Top-Level Await.
И непонятно как настроить eslint что бы он не выводил ошибки
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"
}
}
.eslintrc.cjs
module.exports = {
parserOptions: {
ecmaVersion: 2021,
sourceType: 'module',
parser: "@babel/eslint-parser"
}
};
babel.config.json
{
"plugins": ["@babel/plugin-syntax-top-level-await"]
}
Нагуглил вроде
решение, но что-то неработает. Может неправильно плагин babel подключаю.
Спасибо.