Skip to content
New issue

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

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

Already on GitHub? # to your account

It doesnt work with (import '../styles/mystyle.scss'); #24

Closed
Cauen opened this issue Feb 21, 2020 · 3 comments
Closed

It doesnt work with (import '../styles/mystyle.scss'); #24

Cauen opened this issue Feb 21, 2020 · 3 comments

Comments

@Cauen
Copy link

Cauen commented Feb 21, 2020

Hello,
I'm trying to order my styles imports like:

import '../styles/components/CreditCard.scss';
import 'react-credit-cards/es/styles-compiled.css';

I tried to use this group:
"/\bstyles\b/", and "/css$/"
but its not working.

I think that the imports must have the "from", i'm correct?
There is a plan to add support to css / scss?

@willhoney7
Copy link
Owner

willhoney7 commented Feb 21, 2020

Hi @Cauen,

The documentation talks about this a bit, but I'll be honest, it's hard to find.

On this page: https://github.com/Tibfib/eslint-plugin-import-helpers/blob/master/docs/rules/order-imports.md

Notes:

  • Unassigned imports are ignored (ex: import 'polyfill'), as the order they are imported in may be important.

Because unassigned/bare imports typically contain side-effects the order can be important. So, to avoid potential issues, this ESLint rule ignores bare imports and keeps them in the order you specified.

@Cauen
Copy link
Author

Cauen commented Feb 21, 2020

Hmmmm it makes sense, thanks.
If you find it useful, I would suggest putting another example like (import '../style.css'), for someone (like me) who searched for "css" in the docs.

And...
Do you think that the possibility of adding a group that you did not reorder internally would be useful?
Something like:

"groups": [
  "/^react/",
  "/^@ material-ui/",
  "module",
  ["parent", "sibling", "index"],
  { pattern: "/css$/", sort: false }
],

@willhoney7
Copy link
Owner

Hmmmm it makes sense, thanks.
If you find it useful, I would suggest putting another example like (import '../style.css'), for someone (like me) who searched for "css" in the docs.

I would welcome a PR adding this if you have time.

And...
Do you think that the possibility of adding a group that you did not reorder internally would be useful?

For me personally and my use cases... no. Why don't you open a new issue with this one and we can see if others have interest. @Cauen

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants