eslint / espree

An Esprima-compatible JavaScript parser
BSD 2-Clause "Simplified" License
2.26k stars 189 forks source link

support import assertions #549

Closed wmertens closed 2 years ago

wmertens commented 2 years ago

to import json in an ESM project under Node 18, you can use import assertions, and Espree doesn't seem to parse this syntax (I couldn't find a fixture and eslint doesn't parse either of these syntaxes).

https://v8.dev/features/import-assertions

import json from './foo.json' assert { type: 'json' };

await import('./foo.json', {
  assert: { type: 'json' }
});
nzakas commented 2 years ago

Import assertions are stage 3 at the moment, and we don't implement new syntax until they reach stage 4.

You can still open an issue on ESLint for this to prepare for the stage change.