Code Monkey home page Code Monkey logo

Comments (16)

woble avatar woble commented on June 1, 2024 2

https://github.com/stylelint/stylelint/blob/master/docs/developer-guide/plugins.md#peer-dependencies

from gulp-stylelint.

thomas-darling avatar thomas-darling commented on June 1, 2024 1

Well, then gulp-eslint is doing it wrong too :-)

This is exactly what peer-dependencies are for, and it works perfectly for e.g. gulp-tslint, which also has a massive number of users. I really don't see what the problem is - having it as a peer dependency allows us to update stylelint independent of gulp-stylelint, and if an incompatible version is installed, we get a warning. Perfect.

For reference:

https://nodejs.org/en/blog/npm/peer-dependencies

http://stackoverflow.com/questions/26737819/why-use-peer-dependencies-in-npm-for-plugins/34645112#34645112

Also note:

As of [email protected], the npm update will only inspect top-level packages. Prior versions of npm would also recursively inspect all dependencies. To get the old behavior, use npm --depth Infinity update, but be warned that simultaneous asynchronous update of all packages, including npm itself and packages that npm depends on, often causes problems up to and including the uninstallation of npm itself.
https://docs.npmjs.com/cli/update

from gulp-stylelint.

olegskl avatar olegskl commented on June 1, 2024

I'm not really in favor of peer dependencies. Sure they are useful to some people, but they create a whole lot of trouble for the majority of users.

from gulp-stylelint.

chrishoage avatar chrishoage commented on June 1, 2024

Yes sorry I didn't mean to suggest to use peer dependencies, what I am suggesting is to attempt to resolve the stylelint package from the projects node_modules before loading gulp-stylelints own stylelint dependency. That way if a project wanted to manage the stylelint version they could do so.

I was thinking something similar to how eslint_d handles it: https://github.com/mantoni/eslint_d.js/blob/master/lib/linter.js

from gulp-stylelint.

woble avatar woble commented on June 1, 2024

@olegskl
How do you suggest going about updating stylelint without reinstalling gulp-stylelint every time stylelint releases a minor version?

from gulp-stylelint.

olegskl avatar olegskl commented on June 1, 2024

@woble You don't need to reinstall gulp-stylelint every time stylelint releases a minor version.

from gulp-stylelint.

olegskl avatar olegskl commented on June 1, 2024

@chrishoage Sorry for late response. I just... really, really don't want to add complexity to the library that uses the latest versions of its dependencies. People will install an unsupported version of stylelint and start asking questions "why isn't gulp-stylelint working?".

If you want to use a certain version of stylelint, you can:

  1. Use it directly in gulp without gulp-stylelint (you will lose some nice functionality though).
  2. Install a previous version of gulp-stylelint (I recall that 1.1.0 and 2.0.2 did work well with previous versions of stylelint).
  3. Fork?

Or maybe you can persuade the guys working on "some other tools" you mentioned, to actually support the latest version of stylelint.

from gulp-stylelint.

woble avatar woble commented on June 1, 2024

@olegskl
Unless I am doing something wrong or I am not aware of something, npm up does not update gulp-stylelint (because still v3.0.0) with the latest version of stylelint. Doing npm up stylelint is not desired as it could install unsupported version of stylelint and break gulp-stylelint, you say that yourself.

We don't use stylelint for anything else other than gulp-stylelint, but as new versions of stylelint roll in, updating has to be forced through npm up stylelint on each dev machine. Having it as peer dependency will eliminate that problem and a simple npm up will update all packages as needed.

gulp-tslint uses tslint as peer dependency and it works just fine as they keep track of supported tslint versions.

from gulp-stylelint.

olegskl avatar olegskl commented on June 1, 2024

@woble I don't understand the issue.

Suppose you have gulp-stylelint v3.0.0 and stylelint v7.0.0. If stylelint releases a new minor version (for example, v7.0.1 or v7.1.0 or v7.6.8) and you do an npm update, then what happens is that a new version of stylelint will be installed, but gulp-stylelint will stay at v3.0.0 because it's supposed to work with all minor releases of stylelint up to v7.9999.9999999-whatever.

If, however, stylelint goes to v8.x.x (a major release), then I will need to update gulp-stylelint to v.4.0.0 and when you do npm update both stylelint and gulp-stylelint will be reinstalled.

from gulp-stylelint.

woble avatar woble commented on June 1, 2024

npm update only updates packages listed in package.json, not dependencies of those packages, thus stylelint will only update if gulp-stylelint updates.

from gulp-stylelint.

olegskl avatar olegskl commented on June 1, 2024

Okay, I was ill-informed. I could automatically release a new version of gulp-stylelint when its dependencies change. What do you think?

from gulp-stylelint.

jeddy3 avatar jeddy3 commented on June 1, 2024

Wouldn't npm update --depth 1 work? Or does that have the same issue as?:

Doing npm up stylelint is not desired as it could install unsupported version of stylelint and break gulp-stylelint, you say that yourself.

from gulp-stylelint.

olegskl avatar olegskl commented on June 1, 2024

@jeddy3 Do you think that requiring stylelint as a peer dependency is better than the current approach?

from gulp-stylelint.

jeddy3 avatar jeddy3 commented on June 1, 2024

I dunno I'm afraid. I'm not very familiar with authoring gulp plugins. It looks like gulp-eslint (well used with 400k monthly downloads) uses the same approach you're currently using i.e. has eslint as a caret dependency. There appears to be a discussion for it here: adametry/gulp-eslint#68.

from gulp-stylelint.

olegskl avatar olegskl commented on June 1, 2024

Commit a26f7be will require stylelint as a peer dependency. Will be released in 6.0.0.

from gulp-stylelint.

olegskl avatar olegskl commented on June 1, 2024

Done in 36c16ee and published in 6.0.0.

from gulp-stylelint.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.