JoshuaKGoldberg / package.json-validator

Tools to validate package.json files
MIT License
107 stars 26 forks source link

🐛 Bug: Support version protocols: npm:, workspace:, etc. #71

Open ericcornelissen opened 3 years ago

ericcornelissen commented 3 years ago

I use the syntax of the title so that I can have two different major version of one project as a dependency (one @1.x.x and one 2.x.x), but this validator doesn't recognize this syntax and outputs an error instead. It would be cool if this syntax was supported, but given that it is quite uncommon (to the best of my knowledge) I don't think this should be a priority.

The following package.json content can be used to reproduce this error.

{
  "name": "project",
  "version": "1.0.0",
  "private": true,
  "description": "...",
  "homepage": "https://github.com/ericcornelissen/project",
  "license": "MIT",
  "main": "lib/index.js",
  "repository": {
    "type": "git",
    "url": "https://github.com/ericcornelissen/project"
  },
  "dependencies": {
    "svgo-v1": "npm:svgo@1.3.2",
    "svgo-v2": "npm:svgo@2.0.3"
  }
}
JoshuaKGoldberg commented 5 months ago

This would be great. We have to work around it in https://github.com/JoshuaKGoldberg/eslint-plugin-package-json right now, such as in https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/258. Accepting PRs!

Related: #38, for file:.