JoshuaKGoldberg/package-json-validator

support for license (singular)

Closed this issue · 2 comments

Steps to reproduce:

  1. On http://package-json-validator.com/ enter the URL: https://github.com/isaacs/node-tap

Actual results:

{
  "valid": false,
  "errors": [
    "Type for field license, was expected to be string, not object",
    "Type for field repository, was expected to be object, not string"
  ],
  "warnings": [
    "Missing recommended field: bugs"
  ],
  "recommendations": [
    "Missing optional field: homepage"
  ]
}

Expected results:

We should support the singular version of license. I figure @isaacs knows a thing or two about package.json and license is valid. I found https://www.npmjs.org/doc/files/package.json.html#license but it only mentions the shorthand version of the license as a strong, not as an object. And makes no mention of licenses[] plural.

Not sure about the repository error. I cant find a definitive answer on https://www.npmjs.org/doc/files/package.json.html#repository as that only lists the object form and not the string form (and doesn't mention the shorthand for github of :user/:repo at all).

I'm not sure how accurate the npm docs are, honestly. I don't know if there is a more definitive place to get answers on what is and isn't allowed and what are the latest formats.

Looks like license (singular) has since been given support, so I'm going to go ahead and close this out as resolved. Cheers! 🧡

As for repository, the shorthand string is now deprecated in favor of the full object: npm/cli#7299 (comment)