Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added note on update to .flowconfig for .scss imports #5321

Merged
merged 2 commits into from
Oct 14, 2018
Merged

Added note on update to .flowconfig for .scss imports #5321

merged 2 commits into from
Oct 14, 2018

Conversation

rlueder
Copy link
Contributor

@rlueder rlueder commented Oct 5, 2018

Added a note aimed at Flow users on how to get Flow to recognize the .scss imports.

Added a note aimed at Flow users on how to get Flow to recognize the .scss imports.
@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@Timer Timer added this to the 2.0.5 milestone Oct 5, 2018
@@ -598,6 +598,13 @@ This will allow you to do imports like

> **Note:** You must prefix imports from `node_modules` with `~` as displayed above.

> **Note:** If you're using Flow, add the following to your .flowconfig so it'll recognize the .scss import.
Copy link
Contributor

@Timer Timer Oct 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Include .sass as well, and wrap these in the inline code back ticks please: `.scss` (and .flowconfig).

Can you please make the code snippet inside of the quote?

@bugzpodder
Copy link

bugzpodder commented Oct 5, 2018

Did you try this with css modules?
Edit: I think I have untyped-import=error turned on. If you turn it off this issue wouldn't arise.

I found I had to do this:
module.name_mapper.extension='scss' -> '<PROJECT_ROOT>/CSSModule.js.flow'

where CSSModule.js.flow is:

// @flow
  
declare export default { [key: string]: string }

otherwise I get:

Importing from an untyped module makes it any and is not safe! Did you mean to add // @flow to the top of
./example-block.module.scss? (untyped-import)

     1│ // @flow
     2│ import React from "react";
     3│ import styles from "./example-block.module.scss";

@gaearon gaearon merged commit a70055f into facebook:master Oct 14, 2018
zmitry pushed a commit to zmitry/create-react-app that referenced this pull request Oct 29, 2018
* Added note on update to .flowconfig for .scss imports

Added a note aimed at Flow users on how to get Flow to recognize the .scss imports.

* Mentioned .sass extension in note, added backticks
@lock lock bot locked and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants