Closed ybiquitous closed 7 years ago
Use stylelint-order@0.6.0
. It's updated for stylelint@8.0.0
.
@hudochenkov
Thanks a lot for your rapid response.
Like stylelint-config-standard, I think that all stylelint plugins and configs should have as peerDependencies
not as dependencies
.
If stylelint will be updated to 9.0.0
in future, then unexpectedly two different versions of stylelint will be installed. (like when it updated to 8.0.0
recently)
{
"peerDependencies": {
"stylelint": "^8.0.0"
}
}
What do you think about this?
@ybiquitous stylelint plugins are coupled tighter to stylelint itself then config. For example, to update from v7 to v8 there were more changes than just updating package.json. So it's not safe to list stylelint as a peer dependency for stylelint plugins.
@hudochenkov
I can understand your thoughts, but the peerDependencies
method can ensure safety.
For example, stylelint-scss plugin uses peerDependencies
.
{
"peerDependencies": {
"stylelint": "^8.0.0"
}
}
To list as peerDependencies
makes it possible that plugin's user will specify any version of stylelint.
Additionally when plugin's user will install a different version from version of peerDependencies
, npm will output warning.
$ npm install
npm WARN stylelint-order@0.6.0 requires a peer of stylelint@^8.0.0 but none was installed.
Quoted from the npm official documentation:
In some cases, you want to express the compatibility of your package with a host tool or library, while not necessarily doing a require of this host. This is usually referred to as a plugin. Notably, your module may be exposing a specific interface, expected and specified by the host documentation.
ESLint also adopts this peerDependencies
method.
(see http://eslint.org/docs/developer-guide/working-with-plugins#peer-dependency)
Sounds like we should document this in the stylelint docs https://github.com/stylelint/stylelint
@ybiquitous Can you create a stylelint issue for this also please?
@ntwb I created stylelint/stylelint#2812. Please check it! 😄
@ybiquitous Just released 0.7.0
with stylelint
in peerDependencies
. Sorry I didn't listen to you earlier.
@hudochenkov Thanks a lot! 😄 👏
If
package.json
is below,then two different versions of
stylelint
are installed.