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
Add support for plugin objects as config values #6481
Conversation
🦋 Changeset detectedLatest commit: 7615c75 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Need some help fixing the typing errors. The changes are logically correct, but I am not able to understand how to fix the typing errors. 🤦🏽 |
The changes should also work with
Not sure which pattern is preferred here. I feel the latter would provide more flexibility , but would be a breaking change, and we will have to keep the API backwards compatible, just in case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@phoenisx Thanks for creating the pull request. I've left a suggestion comment to fix the type error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition, could you add test cases about the new feature to lib/__tests__/plugins.test.js
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding test cases! Just in case, could you add more expectations, as I suggested?
60d5954
to
0bff714
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, LGTM 👍🏼
Shall I merge this, if this Looks good to everyone here? |
@phoenisx I noticed it might be necessary to update the doc for stylelint/docs/user-guide/configure.md Line 224 in f226f54
Could you please update it? |
0bff714
to
e4298bb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@phoenisx Thanks for the pull request. Almost looks ready to me. I've requested one change to the docs.
docs/user-guide/configure.md
Outdated
- stylelint plugin object of format | ||
|
||
```js | ||
{ | ||
ruleName: "plugin-name", | ||
rule: function plugin(opts) { /* Plugin Code */ } | ||
} | ||
``` | ||
|
||
> Read more about writing [Stylint Plugins here](../developer-guide/plugins.md). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's revert this change and then change the preceding paragraph so we don't mix terms like locators and functions:
"To use one, add a "plugins"
array to your config, containing either plugin functions or "locaters" identifying the plugins you want to use. As with extends
, above, a "locater" can be either a:"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I’ll fix this once I am back home 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks.
I made the doc change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. LGTM 👍🏼
Oops, a changelog entry is needed. |
Changelog added via 40a3c1a |
@phoenisx Thanks for the contribution! |
Thanks to you all for making the change, while I was away 🙇🏽 |
Closes #6452
Allow users to pass Plugin functions, as well as string names for plugin config.