facebook / flow

Adds static typing to JavaScript to improve developer productivity and code quality.
https://flow.org/
MIT License
22.1k stars 1.86k forks source link

importing css files throws no kind of error #7348

Open aryzing opened 5 years ago

aryzing commented 5 years ago

Importing .css files throws no kind of error, is this expected behavior, even when setting all the strict options and linting rules to error? Are .css files given special or preferential treatment?

Sample repo

vicapow commented 5 years ago

You're right, this is a bug. Thanks for reporting!

vicapow commented 5 years ago

I looked into this a bit more and this seems to be working as designed based on https://github.com/facebook/flow/pull/2252

and https://github.com/facebook/flow/commit/14fcdc8424dbea042e388c12fa5ac833959ba0fc

It sounds like you're looking for an additional configuration option to turn off this behavior?

aryzing commented 5 years ago

Personally, I'm not a fan because neither of us knew about this, and probably many others will be confused about this too. Also, this behaviour is not documented.

Also why give any non JS asset preferential treatment? As far as I'm aware, flow is not a bundler, and it's not designed to care about anything other than JS, so why bake it in? Is this "convenience" worth it?

SamChou19815 commented 1 year ago

Expected behavior

aryzing commented 1 year ago

Did you end up documenting this expected behavior?

SamChou19815 commented 1 year ago

That's right. I will reopen and document it. On the longer time, we plan to implement something like declare module '*.css' { ... } so that it's not needed.