node-csv icon indicating copy to clipboard operation
node-csv copied to clipboard

"no-unresolved" flagged for import of `csv-stringify`

Open himynameisdave opened this issue 3 years ago • 3 comments

Describe the bug

Not exactly a bug because it's not truly blocking me and I'm sure it's got something to do with my environment, but wanted to post here to help figure it out.

Basically I've upgraded to the latest version of this package and updated my imports to 'csv-stringify/sync', but my editor is flagging it as an unresolved dependency (even tho they path is resolved when I hover it). Everything seems to work fine, it's just annoying that this is being flagged.

Using TypeScript here as well, if that is relevant.

To Reproduce

  • Updated csv-stringify from 5.6.5 to 6.2.3
  • Change imports from...
    import * as stringify from 'csv-stringify/lib/sync';
    
    ...to...
    import { stringify } from 'csv-stringify/sync';
    

Additional context

image

himynameisdave avatar Dec 01 '22 20:12 himynameisdave

I am no export in the TS field, anyone ?

wdavidw avatar Dec 01 '22 21:12 wdavidw

This is because this package now uses exports to declare what files are available, and eslint-plugin-import doesn't yet support that: https://github.com/import-js/eslint-plugin-import/issues/1810.

Adding a file sync.js or sync/index.js to the published version of these packages would resolve this.

nwalters512 avatar Jan 12 '23 20:01 nwalters512

Hm, I just tried upgrading to [email protected] (which also includes the changes from https://github.com/adaltas/node-csv/pull/397) and I no longer need an ESLint disable for import/no-unresolved (not sure if this was caused by this change or some other earlier change) - can anyone else confirm that this is fixed now?

karlhorky avatar Aug 25 '23 10:08 karlhorky