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

DeprecationWarning: Partial position information in the utils.report() function is deprecated ("prettier/prettier"). #383

Closed
coderaiser opened this issue Jan 22, 2025 · 6 comments · Fixed by #385

Comments

@coderaiser
Copy link

Looks like deprecated method is used:

(node:57862) [stylelint:007] DeprecationWarning: Partial position information in the `utils.report()` function is deprecated ("prettier/prettier").
    at emitDeprecationWarning (file:///Users/coderaiser/putout/node_modules/stylelint/lib/utils/emitDeprecationWarning.mjs:36:10)
    at checkProblemRangeDeprecations (file:///Users/coderaiser/putout/node_modules/stylelint/lib/utils/report.mjs:151:3)
    at Object.report (file:///Users/coderaiser/putout/node_modules/stylelint/lib/utils/report.mjs:36:2)
    at file:///Users/coderaiser/putout/node_modules/stylelint-prettier/index.js:130:23
    at async Promise.all (index 0)
    at async Promise.all (index 0)
    at async lintSource (file:///Users/coderaiser/putout/node_modules/stylelint/lib/lintSource.mjs:103:2)
    at async Function.standalone [as lint] (file:///Users/coderaiser/putout/node_modules/stylelint/lib/standalone.mjs:146:26)
    at async lint (file:///Users/coderaiser/putout/packages/processor-css/lib/css.js:14:33)
    at async getFiles (/Users/coderaiser/putout/packages/engine-processor/lib/processor.js:137:41)
Please pass both `index` and `endIndex` as arguments in the `utils.report()` function of "prettier/prettier".
@BPScott
Copy link
Member

BPScott commented Jan 23, 2025

Can you please provide an example of the misshapen code that you used to trigger this codepath?

I'm trying to recreate this locally.

@romainmenke
Copy link

@BPScott see the discussion upstream: stylelint/stylelint#8126

We found that providing only index can behave weirdly.

To improve the experience for end users we are moving away from position arguments that are ambiguous and could lead to bugs.

The deprecation warning is triggered by running with the latest version of stylelint and for example only providing index without endIndex.

Hopefully it isn't too disruptive to adapt to this new requirement.
Thank you in advance!

@BPScott
Copy link
Member

BPScott commented Jan 23, 2025

Oh yeah it's no problem, I'm happy to add endIndex.

It's just my test fixture that I'm sure used to exercise this code path no longer seems to error in modern stylelint versions, so I'd like to find a case where this code path does get hit so I can test it. (I suspect that these days the invalid code is being caught somewhere in postcss-styled-syntax and so it never gets to running the prettier rule)

@coderaiser
Copy link
Author

It's just my test fixture that I'm sure used to exercise this code path no longer seems to error in modern stylelint versions, so I'd like to find a case where this code path does get hit so I can test it.

I trap on this when during running tests in @putout/processor-css before adding the flag, you can take a look at fixture files, as examples.

@romainmenke
Copy link

@coderaiser or you can provide a reproducible bug report? :)
I don't think anyone will take the time to dig through your project in search of samples that will trigger this code path 😛

@coderaiser
Copy link
Author

Sure! As I remember, when I debug, I trapped on this input:

{{ template }}

Yes, that is not valid css, but when you put styles to style tag, and in runtime put the data from file, and then lint template it can be the case :)

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