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

no-slash-div #5368

Closed
jrr opened this issue Jun 9, 2021 · 2 comments
Closed

no-slash-div #5368

jrr opened this issue Jun 9, 2021 · 2 comments

Comments

@jrr
Copy link

jrr commented Jun 9, 2021

What is the problem you're trying to solve?

My current frontend tooling (w/ Dart Sass) doesn't like division with /:

[CRA] 21 │   padding: 0 ($COL_SPACING / 2);
[CRA]    │               ^^^^^^^^^^^^^^^^
[CRA]    ╵
[CRA]     src/client/styles/modules/Foo.module.scss 21:15  root stylesheet
[CRA]
[CRA] DEPRECATION WARNING: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.
[CRA]
[CRA] Recommendation: math.div($COL-SPACING, 2)
[CRA]
[CRA] More info and automated migrator: https://sass-lang.com/d/slash-div

It currently logs a runtime warning, but presumably in the future it will completely break.

This will probably be caught by our tests, but it would be great if it could also be handled by styelint.

What solution would you like to see?

A new rule that shares the opinion of Dart Sass, squiggling offending uses of the /.

Is this something that stylint would be interested in?

https://sass-lang.com/documentation/breaking-changes/slash-div

@jeddy3
Copy link
Member

jeddy3 commented Jun 10, 2021

@jrr Thanks for the request and for using the template.

Yes, I think it's a good candidate for a lint rule within the stylelint-scss community plugin. I suggest opening an issue in their issue tracker.

The rules built-in to stylelint are geared towards standard CSS. This will be clearer in the next major release.

@jeddy3 jeddy3 closed this as completed Jun 10, 2021
@jeddy3
Copy link
Member

jeddy3 commented Jun 10, 2021

Incidentally, the built-in color-function-notation rule is relevant here and can be used to encourage writing modern CSS color functions with a slash, e.g. a { color: hsl(20deg 20% 5% / 50%) }. Whereas a rule that warns about the deprecated slash feature of the SCSS syntax belongs in a plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants