JoshuaKGoldberg/package-json-validator

Drop support for licenses (plural) and change support for license to be a supported string

Closed this issue · 2 comments

There are a few new license changes in newer versions of npm.

https://docs.npmjs.com/files/package.json#license
http://npm1k.org/

For valid license strings, see https://www.npmjs.com/package/spdx

My suggestion would be that missing both license and licenses should result in a warning and recommend license. But if licenses is present, it should emit a recommendation to switch to license.

Similar to #26 (comment), looks like license (singular) has since been given support, so I'm going to go ahead and close this out as resolved. From https://docs.npmjs.com/cli/v10/configuring-npm/package-json#license:

If your package is licensed under multiple common licenses, use an SPDX license expression syntax version 2.0 string, like this:

{
  "license": "(ISC OR GPL-3.0)"
}

Some old packages used license objects or a "licenses" property containing an array of license objects ... Those styles are now deprecated.

Cheers! 🧡