Confusing documentation around about valid-values-license and require-license
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:
- require-license says that the correct value of
licenseisMIT. - valid-values-license says that the incorrect value of
licenseisMIT.
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
Hey Bob! Sorry that the docs are confusing!
require-licenseenforces that the license field is present and of the right type (i.e. String). It doesn't enforce a specific license.valid-values-licensechecks the value set in thelicensefield 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 toGPL-2.0-or-laterfor 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! 🤞