npm-package-json-lint icon indicating copy to clipboard operation
npm-package-json-lint copied to clipboard

Confusing documentation around about valid-values-license and require-license

Open spicq-rambobafet opened this issue 5 years ago • 1 comments

Hi :) Not sure if that it's a bug, but i'm pretty sure that I'm, at least, missing a point and I would need clarification about 2 rules because I find the documentation confusing:

If I declare MIT I get error: Invalid value for license. No warning. If I declare private I get error: valid-values-license - node: license - Invalid value for license. warning package.json: License should be a valid SPDX license expression.

The configuration is the one by default offered by Wordpress script.

Versions:

- node v12.16.1
- @wordpress/scripts: "^7.0.0",
- (peer) npm-package-json-lint: ">=3.6.0"

I can disable the rule, but I'd like to understand what's expected here. :) Thanks for your time, and stay safe.

Bob

spicq-rambobafet avatar Mar 19 '20 16:03 spicq-rambobafet

Hey Bob! Sorry that the docs are confusing!

  • require-license enforces that the license field is present and of the right type (i.e. String). It doesn't enforce a specific license.
  • valid-values-license checks the value set in the license field against the list of approved licenses set in the config. The WordPress team have 'valid-values-license': [ 'error', [ 'GPL-2.0-or-later' ] ], configured. You can see it here. You will need to set license to GPL-2.0-or-later for WordPress packages.

Do you have any recommendations for how to improve the docs to make it more clear?

P.S. Sorry for the delayed response. Please let me know if this helps resolve your question! 🤞

tclindner avatar Apr 12 '20 02:04 tclindner