ESLint not working for json import when using experimental-json-modules

Viewed 277

I have the following in my package.json...

"lint:fix": "node --experimental-json-modules ./node_modules/.bin/eslint **/*.mjs --fix"

And the following in my code

import pkgjson from "../package.json" assert { type: 'json' };

But when I run the lint command I see...

1:39  error  Parsing error: Unexpected token assert

How do I use json imports with eslint?

1 Answers

Eslint Support of assert {type: "json"}

Eslint discussion thread

In the discussion thread you can find several alternatives to solve this problem

Related