-
-
Notifications
You must be signed in to change notification settings - Fork 930
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
Allow configOverrides to be a function #4374
Comments
Thank you for proposal. We have issue for this feature #3128 We can continue discussion there. We would be happy if you would like to contribute this functionality :) |
Sorry, I didn't read your proposal carefully enough. Having Currently, On the other side, it would be harder to write and test for user. Pure functions are more safe to use. I would make // Example of usage
{
configOverrides: function (config) {
const newConfig = {
...config,
rules: {
...config.rules,
indentation: null,
},
};
return newConfig;
}
} Actually it could be unpure function, but it should return new config. |
We need more opinions from @stylelint/contributors before proceeding to implementation. |
Is this level of configuration not already possible by calling the cli with |
There is no official API to do this, only workarounds. |
Another way of phrasing that is "We have provided low level tools to allow people to do uncommon things without creating a maintenance burden on the project." If |
@nosilleg good thinking. We might need to provide |
That gets a 👍 vote from me. |
I've create new issue to discuss new direction #4392. I'm closing this issue because it was decided not to go the route proposed initially. |
This is a feature request for the Node API.
In #4331 I described the need to filter the loaded configuration by one or more rules from the CLI to ease refactoring efforts. One way to do this is to make the
configOverrides
option more powerful by allowing it to be a function that modifies the loaded configuration. Filtering the rules would be as simple as:Since there's no CLI option for
configOverrides
, it seems like that might actually be a good way to implement a fix for #4331, right about here:It looks like the function would need to be called after the config is augmented, and any changes to the config would then need to be resolved ("extended" and "absolutized") again in the same way.
I've done some digging around in the source and I think that I could tackle this if there's any interest. Of course, if there's another way to modify the config after it's been augmented and before it's used in a rule, I would love to hear about that! 🙏
The text was updated successfully, but these errors were encountered: