Since the import assertion syntax (e.g. assert {type: 'json'}) is mandatory in the latest Node.js versions, I'm looking for a way to be able to write this new syntax, but I don't want to add Babel just to be able to use the Babel ESLint parser which understands it.
Could this be added by a different ESLint plugin?
You have to use the babel eslint parser for that
npm i -D @babel/eslint-parser @babel/plugin-syntax-import-assertions
then in .eslintrc
"parser": "@babel/eslint-parser",
"parserOptions": {
"requireConfigFile": false,
"babelOptions": {
"plugins": [
"@babel/plugin-syntax-import-assertions"
]
}
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With