stylelint icon indicating copy to clipboard operation
stylelint copied to clipboard

Add `getConfigForFile` to public API

Open BioPhoton opened this issue 11 months ago • 1 comments

What is the problem you're trying to solve?

Front off thanks for the amazing work you did on stylelint!

I am working on some custom tooling and have the following case:

As a developer I want to be able to write programmatic tools to help me track the code quality of my style. Several parts are already exposed under the public API, but not the logic needed to parse a config file and understand which rules are enabled before execution the linter.

What solution would you like to see?

Exposing the getConfigForFile API as public would enable third party integrators to reuse the complex logic of config file parsing.

BioPhoton avatar Jan 09 '25 21:01 BioPhoton

@BioPhoton Unfortunately, the current interface of getConfigForFile() is inappropriate for the public API because it is implemented only for the internal use.

https://github.com/stylelint/stylelint/blob/81baea5b9d7d8df1df2f0f706ba9438bf9ea82ff/lib/getConfigForFile.mjs#L14-L20

Instead, can the --print-config flag or something else satisfy your needs?

ybiquitous avatar Jan 13 '25 08:01 ybiquitous