I am developing a REST API backend with express and I need to import some JSON local files, so I used the experimental assert { type: "json" }
syntax.
ESLint still doesn't support it, the solution is to use babel
parser for ESLint.
I added as dev dependencies:
"@babel/core": "^7.22.1",
"@babel/eslint-parser": "^7.21.8",
"@babel/plugin-syntax-import-assertions": "^7.20.0"
I added in .eslintconfi.json
:
"parser": "@babel/eslint-parser",
"parserOptions": {
"requireConfigFile": false,
"babelOptions": {
"plugins": [
"@babel/plugin-syntax-import-assertions"
]
}
},
The linting works just fine but VScode gives me Parsing error: Cannot find module '@babel/plugin-syntax-import-assertions
error on every file: