Libsass: feature request: : Add a flag to turn off DEPRECATION WARNS

Created on 31 Jan 2019  ·  10Comments  ·  Source: sass/libsass

Since version 4.9 of node-sass the current warning is being shown in a lot of projects. (you may see an open issue asking for a way to silence the warning here)

DEPRECATION WARNING: Passing a string to call() is deprecated and will be illegal
in Sass 4.0. Use call(get-function("variable-exists")) instead.

The warning is ok and i would love to fix all my deprecated functions call but i can't, the main reason is that i don't even know which library is the one with the issue... (is not my code) i understand the need to force everyone to update their deprecated stuff, but that's not feasible. I think every developer is responsible for their own application and taking the risk to be outdated is on their own, i accept the responsibility :)

And so... this feature request is to add somewhere somehow a flag that can be turned on/off the DEPRECATION WARNINGS

I've already mistakenly tried to add an environment variable at the node-sass project, but @nschonni told me that the PR should be done here at libsass, however @xzyfer told me that the acceptable solution to silencing deprecation warnings is to fix the deprecated code, even thought that the code belongs to someone else, a library.

  • You may se the code to add the flag is already available at PR-2587 from node-sass project, is not much.
  • Also the open issue regarding this matter is 2334 (also from node-sass project).

All 10 comments

I think i have a more standard solution, what do you all think about implementing log levels?? (like log4j, winston, etc).

Please tell me if you agree more on this :) (so i'll modify this FR title)

We will not be adding logging levels, nor will we enable silencing deprecation warnings. These warnings are critically important for user code to continue working.

We would however consider solutions that make it easier to find the code using deprecated behaviour.

Thank you for answering all my concerns with this @xzyfer... btw, i've found the library with the problem so the fix is in progress for me :+1:

And so... i guess everyone else use cases it'll have to wait until the library owners decide to fix their deprecated stuff (...)

Please remember that this warnings are not critically important to continue our work as developers... if they were like that, an error would be thrown instead of a warning.

An alternative approach could be https://github.com/sass/libsass/pull/2862 ...

This is really important. I'm currently getting dozens of the same error.

DEPRECATION WARNING on line 29 of sass/elements/image.sass:
#{} interpolation near operators will be simplified in a future version of Sass.
To preserve the current behavior, use quotes:

  unquote("image_size_#{$size}")

with something like this

+_(image_size_#{$size})

I'm not even sure what operator it's referring to, but I would much rather change to the "simplified version" when it comes than write that awful looking alternative.

These warnings are critically important for user code to continue working.

Yes I agree @xzyfer , but I already have read these warnings and I want to put them to the side for the time being and focus on other things, but i cant because these warnings fill up the entire terminal

There is no intention to support this at this time. Deprecation warning are critically important to us evolving the language. Muting deprecation warning is just deferring pain for when the breaking change is introduced which our issue tracker will enjoy flooded. To remove the warning downgrade to a version of Libsass that predates the introduction of the warning.

Warnings are only useful the first time you read them. If someone turns them off is because they already read them and are tired of them and therefore are aware of them, showing it again will not make zero difference, and in the future they will know why it broke.
Not letting people surpress these warnings isnt helping anybody, its just annoying.

Also the warning is about how it will become more simplified and the solution it gives to make it much more overcomplicated.
You can see why someone wouldnt want to follow that suggestion, specially when i use it all over my project

@xzyfer you have a good point on this!! i agree with you :)

Muting deprecation warning is just deferring pain for when the breaking change is introduced which our issue tracker will enjoy flooded

However i think we can still find a solution!! for most developers complaining about this. The main reason is this part (as @luaVolk said):

I'm currently getting dozens of the same error.

What do you think of reducing all those warnings to just one?? at my case when i opened this feature request i was receiving about 100k+ warnings. I think you can remove all of the "detailed warnings" and just print:

Your libsass implementation is deprecated and will be illegal in Sass 4.0, for more details try '--libsass-verbose'.

And maybe add:

The following errors were found:
> 12 errors found: #{} interpolation near operators will be simplified in a future version of Sass
> 4 errors found: Passing a string to call() is deprecated and will be illegal
in Sass 4.0. Use call(get-function("variable-exists")) instead.

Or something like that... i hope you get the idea, what do you think @xzyfer?

I guess my last comment is worth to be a managed as a different feature request (?)

Was this page helpful?
0 / 5 - 0 ratings