-
Notifications
You must be signed in to change notification settings - Fork 96
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
slash-no-division #528
Comments
@jrr Thanks for this! We usually try to avoid adding rules that duplicate the work that the compiler is already doing. I understand that it would be nice to catch these already before hitting the compiler, but in addition to doing things twice, a big problem is that the rule might get out of sync with the warning that the compiler is giving. That's why I would prefer not to add such rules to the library. |
Alright, that makes sense, thanks. I could see the difficulty in maintaining a second implementation that agrees perfectly with the reference implementation. Maybe one day another extension (perhaps https://github.com/microsoft/vscode-css-languageservice ) could provide squiggles right out of the sass compiler. |
I would be in favor of adding this to stylelint-scss. I wouldn't expect much maintenance against the compiler because the warning will be removed from Dart Sass 2.0.0 as stated in the deprecation warning. So after Dart Sass 2.0.0 the warning is removed, no maintenance is required where as developers could still benefit from the linter warning when migrating their heads to the new style. Edit: Just for reference, here is the rule in Dart Sass: |
@ahukkanen I will try to explain my view on this, so maybe that will help you to see why adding such rule does not make sense. The For me this kind of rule does not really fall into that normal rule category. The rule would serve as a "migration tool" to the new version of the Sass compiler. The risk with adding the rule is that there might be false positives or false negatives for what the rule is reporting versus what the compiler warns about, and the rule might get quite complex. Even if it would work perfectly, it seems a bit silly that the rule would just be pointing out the same things that compiler is already telling the user. In addition to that, the Sass team is already providing all the necessary info and tools to migrate to the new version:
|
They're providing everything except for editor squiggles ;) For better or worse, this project seems to be the default recipient of "there ought to be a squiggle" issues like this one. |
I agree that stylelint provides a much better developer experience than using the compiler for the errors. Even if the rule does not fit I have written multiple stylelint plugins, and it would probably take 2-3 hours of work to add the rule, write a test suite, and to add the boilerplate (CI etc.) for the Github repo. |
My main concern is the CI pipeline, when we are fixing this dart sass issue for the project. If someone introduces a new slash division after fixing it, it may go unnoticed because there is no way to catch that in the CI. And there we cannot even grep the webpack output because there are still external dependencies that produce these warnings that are outside of the project's control. There's still the possibility to write some rather complex webpack output parser that will automatically detect which warnings come from external dependencies and which come from the project itself. Or just hope for the best. It would be much easier in such cases to rely on stylelint. |
@ahukkanen what about running the migration tool against your project? https://sass-lang.com/documentation/breaking-changes/slash-div#automatic-migration |
@kristerkari Yes, that's what my PR is doing but there are external dependencies that still need to be fixed. And that can take from n days to x years according to my previous experiences. |
@ahukkanen the problem that you have is a very typical software problem when migrating to a newer version that has a breaking change. If you have external dependencies with breaking changes, then those need to be migrated to the new version regardless of if there is a stylelint rule or not. So here's my suggestion:
|
Yep, I understood your point of view @kristerkari. I was only trying to raise the point that it would be a great help if we had this already incorporated into stylelint. Based on this discussion it is clear it won't be part of stylelint-scss, I understand that. |
I also understand how difficult it is to do codebase migrations to newer versions with breaking changes. It takes a lot of time and any kind of tooling will be helpful when doing that. It's just that stylelint is not a compiler/parser/analyzer, so it should not be used as a tool to validate whether a code compiles or not. The Sass compiler can have new versions that make some code invalid that was previously working just fine. It's the Sass team that has the compiler/tools that decides which code is valid and which is not, and provide the necessary tools to do the migration to newer versions with breaking changes. |
My current frontend tooling (w/ Dart Sass) doesn't like division with
/
: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.
A new rule that shares the opinion of Dart Sass, squiggling offending uses of the
/
.Is this something that stylint-scss would be interested in?
https://sass-lang.com/documentation/breaking-changes/slash-div
(originally from stylelint/stylelint#5368)
The text was updated successfully, but these errors were encountered: