AndyOGo / stylelint-declaration-strict-value

Specify properties for which a variable, function, keyword or value must be used.
MIT License
134 stars 10 forks source link

DeprecationWarning: `context.fix` is being deprecated with stylelint 16.8.2 #379

Open sebbayer opened 2 months ago

sebbayer commented 2 months ago

With the latest stylelint version 16.8.2 I get lots of deprecation warnings because context.fix is being deprecated:

(node:4037) [stylelint:005] DeprecationWarning: context.fix is being deprecated. Please pass a fix callback to the report utility of "scale-unlimited/declaration-strict-value" instead.

See 16.8.2 changelog: https://stylelint.io/changelog/ And the PR: https://github.com/stylelint/stylelint/pull/7895

AndyOGo commented 2 months ago

Thx a lot. https://stylelint.io/developer-guide/rules/#add-autofix

silverwind commented 2 months ago

FYI, with Stylelint v16.9.0, a workaround is available via NODE_OPTIONS=--no-deprecation to suppress the warnings.

kliehm commented 1 month ago

Yeah, so it's deprecated. As an end user, I call it with the CLI and the --fix suffix. Is there anything else I can do to make this annoying message go away? Should I edit my .stylelintrc.cjs file? I don't use context.fix anywhere, I'm not a Stylelint contributor.

silverwind commented 1 month ago

Is there anything else I can do to make this annoying message go away

You could downgrade stylint to 16.8.1, before the deprecation was introduced.

kliehm commented 2 weeks ago

@silverwind @AndyOGo I don't understand, aren't you going to fix this? Or did you already fix it? If so, in which release?

AndyOGo commented 2 weeks ago

@kliehm You find the answer to your question in the release notes of stylelint.

Fixed: honour Node.js --no-deprecation flag for rule deprecation warnings (https://github.com/stylelint/stylelint/pull/7943) (@Mouvedia). https://github.com/stylelint/stylelint/releases/tag/16.9.0

Thank you.

bencebkiss commented 2 weeks ago

@kliehm You find the answer to your question in the release notes of stylelint.

Fixed: honour Node.js --no-deprecation flag for rule deprecation warnings (stylelint/stylelint#7943) (@Mouvedia). https://github.com/stylelint/stylelint/releases/tag/16.9.0

Thank you.

With all due respect, it's just a workaround, not an actual fix.

I think it's better to fix the root cause instead of just ignoring the deprecation warnings. That's what most of us need in order to use this package properly.

AndyOGo commented 2 weeks ago

Thank you for sharing your idea.

Please understand that this is a deprecation, it's not a bug or something broken. You get a warning and styelint provides a way to hide those - the new API will be enforced in the next major version and then this plugin will update.

(computing) the fact of a software feature becoming outdated and best avoided because it has been replaced with something newer https://www.oxfordlearnersdictionaries.com/definition/english/deprecation

kliehm commented 2 weeks ago

Thank you for sharing you idea.

Please understand that this is a deprecation, it's not a bug or something broken. You get a warning and styelint provides a way to hide those - the new API will be enforced in the next major version and then this plugin will update.

(computing) the fact of a software feature becoming outdated and best avoided because it has been replaced with something newer https://www.oxfordlearnersdictionaries.com/definition/english/deprecation

I know what deprecation means. It also means that you need to change something so that it's still compatible in the future. You can't just sit it out. 😄

AndyOGo commented 2 weeks ago

@kliehm next time before you spam an issue thread.

Please make sure to carefully read and understand the official documentation and release notes. Then please make sure that you are able to evaluate the importance of different aspects of software engineering. Last but not least work on your social competence.

Thank you.

kliehm commented 2 weeks ago

I would suggest the same. I was asking a reasonable question what your intention is to be forward compatible since there these deprecation warnings which will lead to incompatibility. All you suggested was “switch the warnings off”. That's neither helpful, nor respectful, just ignorant. I'm a senior programmer, not an idiot.

AndyOGo commented 2 weeks ago

@kliehm No, that is incorrect.

Your question has already been answered two ways.

  1. I added a maintenance label on Aug 19
  2. That comment on Aug 29 referenced the stylelint release notes and the official way to deal with this until the context.fix API is completely removed

Frankly, you have not accomplished a senior level in programming - that becomes obvious by your lack of understanding of these clear and simple information.

kliehm commented 1 week ago

@kliehm No, that is incorrect.

Frankly, you have not accomplished a senior level in programming - that becomes obvious by your lack of understanding of these clear and simple information.

Please refrain from depreciating people whom you don't know, and stick to the topic.

AndyOGo commented 1 week ago

@kliehm Why is your behavior okay? Why is your cynical and derisive comment acceptable?

You can't just sit it out. 😄

To me it's not acceptable and I insist that you

  1. make sure to read and understand official documentation to improve your technical competence
  2. work on your manners and your social competence and treat social people with respect and dignity
kliehm commented 1 week ago

I don't need your advice on technical competence. That is beyond your knowledge and competence to give such advice. You don't appear to be very social competent yourself. I hope your future employer reads this embarrassing dialogue.

AndyOGo commented 1 week ago

@kliehm Alright, I got that.

What are log levels? What is verbosity? What are syntactical and lexical grammars? What makes a grammar context free? What is and how to read the Backus–Naur form? What is the visitor pattern? Did you study the syntax specifications of CSS, SASS, Less and other CSS-like grammars?

You know the 101 of them by heart?

Well, you called me ignorant? To carefully study, understand and apply the above one has to be quite the opposite of ignorant.

Maybe you don't realize how invalidating that term really is.

  1. (often disapproving) not having or showing much knowledge or information about things; not educated
  2. not having any knowledge or information about a particular thing https://www.oxfordlearnersdictionaries.com/definition/english/ignorant

Or you just don't know how much work goes into open source software. This is a social project, free of charge.

ScorpAL commented 1 week ago

OMG... Stop arguing please.

...
"stylelint": "^16.10.0",
"stylelint-config-clean-order": "^6.1.0",
"stylelint-config-standard-scss": "^13.1.0",
"stylelint-declaration-strict-value": "^1.10.6",
"stylelint-use-logical-spec": "^5.0.1",
...

I still see

...
(node:16392) [stylelint:005] DeprecationWarning: `context.fix` is being deprecated.
Please pass a `fix` callback to the `report` utility of "scale-unlimited/declaration-strict-value" instead.
(node:16392) [stylelint:005] DeprecationWarning: `context.fix` is being deprecated.
Please pass a `fix` callback to the `report` utility of "scale-unlimited/declaration-strict-value" instead.
(node:16392) [stylelint:005] DeprecationWarning: `context.fix` is being deprecated.
Please pass a `fix` callback to the `report` utility of "scale-unlimited/declaration-strict-value" instead.
...

just when scale-unlimited/declaration-strict-value config added. Like:

'scale-unlimited/declaration-strict-value': [
    ['/color$/', 'fill'],
    {
        expandShorthand: true,
        ignoreValues: ['transparent', 'currentcolor', 'inherit'],
        autoFixFunc: autoFixFunc,
        disableFix: true
    }
]

not matter with or without autoFixFunc or disableFix: true

Firstly I thinking that disableFix: true should help me,

While you continue fighting, for me better to comment this config (or disable 'scale-unlimited/declaration-strict-value') rather then downgrading for styleint.

AndyOGo commented 1 week ago

@ScorpAL

Stylelint offers a workaround to suppress those deprecation warnings. This has been pointed out first by @silverwind

FYI, with Stylelint v16.9.0, a workaround is available via NODE_OPTIONS=--no-deprecation to suppress the warnings. https://github.com/AndyOGo/stylelint-declaration-strict-value/issues/379#issuecomment-2317074368

Then a second time by myself.

@kliehm You find the answer to your question in the release notes of stylelint.

Fixed: honour Node.js --no-deprecation flag for rule deprecation warnings (stylelint/stylelint#7943) (@Mouvedia). https://github.com/stylelint/stylelint/releases/tag/16.9.0

Thank you. https://github.com/AndyOGo/stylelint-declaration-strict-value/issues/379#issuecomment-2445259247


The migration will happen with the next major version of stylelint.

ScorpAL commented 1 week ago

@AndyOGo thanks.

I have used --quiet-deprecation-warnings temporarily in my package.json scripts

"scripts": {
    ...
    "lint:css": "stylelint src/**/*.{css,scss} --quiet-deprecation-warnings",
    ...
},

https://stylelint.io/user-guide/options#quietdeprecationwarnings

myovchev commented 1 week ago

I was forced to completely disable the rule in our stylelint config package because:

Why was important to get rid of the warnings:

I'm not aware of the context so I can't participate in the discussion. My desire is to use a package and get a clear but useful solution - a simple configuration, that solves a problem in hand. The simple principle that I'm following is: the fellow dev didn't do anything wrong (no misconfiguration or stupid code), so everything that comes as a problem after that and is a pain. is something that has to be resolved in a satisfactory for everyone way.

AndyOGo commented 1 week ago

Stylelint offers multiple ways to disable their deprecation warnings.

You find that information in different parts of their documentation (I kindly advise to read the full documentation so that you get the full concept of it).

  1. via quietDeprecationWarnings Option Attention: please note that at the very top it is defined how those options may be used

    Options shared by the:

  2. via NODE_OPTIONS=--no-deprecation environment variable

Note: stylelint configurations are shareable by default (so no need to repeat a config that you want to re-use). https://stylelint.io/user-guide/configure#extends


@myovchev

  • I don't want to add flags to dozens of packages + customers using it.

You can always share styleint configurations - no need to manually update dozens of stylelint configurations manually (npm update is sufficient) https://stylelint.io/user-guide/configure#extends

  • I don't want to do the same once the problem is resolved

When the deprecation is migrated you only need to update. (quietDeprecationWarnings is a core stylelint feature and is in no way related to this plugin)

  • It nearly breaks CI (large codebases).

Okay. This concerns me a lot, are you sure that your CI can be nearly broken by verbose logging? If that is the case, please report it to your CI provider.