frenic / csstype

Strict TypeScript and Flow types for style based on MDN data
MIT License
1.7k stars 69 forks source link

eslint import/no-unresolved error for csstype #140

Open nishantnaagnihotri opened 2 years ago

nishantnaagnihotri commented 2 years ago

Eslint raises compilation error of the rule import/no-unresolved, for the csstype import statement.

This is because the package.json of csstype has a blank value for "main" field. It should have the value as "index.d.ts".

I did the change locally and eslint stopped complaining.

frenic commented 2 years ago

The main field is the same as @types packages which is just "". There could be other issues when adding a .d.ts file to main so I'd say it's better to keep it like this even though @types are used differently. But maybe this will do the trick for you?


import type * as CSS from 'csstype';
nishantnaagnihotri commented 2 years ago

Thanks for the prompt response!!

I tried it out, the error does not go away :disappointed:

frenic commented 2 years ago

Maybe the answer to your issue can be found here https://github.com/import-js/eslint-plugin-import/issues/1341?

tobiaswaltl commented 2 years ago

They suggest to use eslint-import-resolver-typescript and yes, I can confirm that (at least for me) it does the trick. Thanks for pointing this out.