0

I'm working on abstracting my linting configs into shareable ones. The repo can be found here. The Gitlab CI takes care of publishing packages to the npm just fine but when I try to install the configs in another project the peerDependencies are not being installed.

For example, here's the packages/stylelint-config/package.json:

{
  "name": "@scheisse/stylelint-config",
  "version": "1.2.0",
  "description": "Personal Stylelint configuration.",
  "keywords": [
    "stylelint`",
    "css",
    "config"
  ],
  "homepage": "https://gitlab.com/b00jum/linting-setup/-/blob/master/packages/prettier-config#readme",
  "bugs": {
    "url": "https://gitlab.com/b00jum/linting-setup/issues"
  },
  "repository": {
    "type": "git",
    "url": "https://gitlab.com/b00jum/linting-setup.git",
    "directory": "packages/stylelint-config"
  },
  "license": "MIT",
  "author": "Tomasz Moskal <boojum@stercus-accidit.com> (https://stercus-accidit.com/)",
  "main": "index.js",
  "devDependencies": {
    "stylelint": "13.13.x",
    "stylelint-a11y": "1.2.x",
    "stylelint-color-format": "1.1.x",
    "stylelint-config-prettier": "8.0.x",
    "stylelint-config-standard": "22.0.x",
    "stylelint-order": "4.1.x",
    "stylelint-semantic-groups": "1.1.x",
    "stylelint-use-logical-spec": "3.2.x"
  },
  "peerDependencies": {
    "stylelint": "13.13.x",
    "stylelint-a11y": "1.2.x",
    "stylelint-color-format": "1.1.x",
    "stylelint-config-prettier": "8.0.x",
    "stylelint-config-standard": "22.0.x",
    "stylelint-order": "4.1.x",
    "stylelint-semantic-groups": "1.1.x",
    "stylelint-use-logical-spec": "3.2.x"
  },
  "publishConfig": {
    "access": "public"
  }
}

The stylelint and it's plugins are listed as both peer-, and dev- dependencies. Yet npm fails to install them and only @scheisse/stylelint-config is installed.

I'm using npm v7 (7.20.3 to be precise), and I was under the impression that it does install peerDependencies automatically?

EDIT: I was using two different - and possibly incompatible - ways to define a version range, for example: "^stylelint-use-logical-spec": "3.2.x". I changed it to x.x.x range definition across the repo but peerDependencies are still not being installed.

boojum
  • 574
  • 6
  • 19
  • Possibly related: https://stackoverflow.com/questions/67946764/why-does-npm-7-17-not-install-my-peer-dependencies – Joe Aug 31 '21 at 11:50
  • @Joe: yeah, I saw it and tried `--legacy-peer-deps` without success. – boojum Aug 31 '21 at 12:02

0 Answers0