-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Build tooling: Add linting for package.json files #7001
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Removed the milestone as we don't really care when this lands. (Looks like there's some failing tests) |
package.json
Outdated
| "valid-values-author": [ | ||
| "error", | ||
| [ | ||
| "WordPress" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Out of curiosity, why did we decide upon "WordPress" as author when wordpress-develop/package.json specifies it as "The WordPress Contributors".
https://github.com/WordPress/wordpress-develop/blob/ecb3302/package.json#L13
(cc @ntwb)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure there was ever a discussion, let's change it to The WordPress Contributors
Also ref: Copyright 2011-2018 by the contributors via license.txt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated 👍
package.json
Outdated
| "fixtures:server-registered": "docker-compose run -w /var/www/html/wp-content/plugins/gutenberg --rm wordpress ./bin/get-server-blocks.php > core-blocks/test/server-registered.json", | ||
| "fixtures:generate": "npm run fixtures:server-registered && cross-env GENERATE_MISSING_FIXTURES=y npm run test-unit", | ||
| "fixtures:regenerate": "npm run fixtures:clean && npm run fixtures:generate", | ||
| "fixtures:regenerate": "npm-run-all fixtures:clean fixtures:generate", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is npm-run-all default to parallel or sequential execution? Sequential is pretty important for this task to ensure that clean occurs before (and does not overlap with) newly generated files.
See also run-s: https://www.npmjs.com/package/npm-run-all#-usage
| "lint-php": "docker-compose run --rm composer run-script lint", | ||
| "predev": "check-node-version --package", | ||
| "check-engines": "check-node-version --package", | ||
| "ci": "concurrently \"npm run lint && npm run build\" \"npm run test-unit:coverage-ci\"", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: npm-run-all could be used here now in place of npm run lint && npm run build. I think they could occur in parallel as well? Edit: Though, the fact we're using concurrently separate here makes me think we needed them to occur in sequence. Sounds familiar, hmm..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I spend some time trying to rewrite it with npm-run-all but failed, so I removed this dependency at all in favor of concurrently :)
Description
This PR updates
@wordpress/scriptsto the next minor version which exposedlint-pkg-jsoncommand. It exposed the same checks forpackage.jsonfiles for all packages maintained by Lerna. This brings the setup of Gutenberg and packages closer to each other before they get merged together in the near future.I also reordered
scriptssection to make everything sorted by script name. I also pulled innpm-run-allpackage to make it easier to run groups of scripts.How has this been tested?
npm run lint-pkg-jsonnpm run lintTo make sure that this new linter works you can update any
package.jsonfile inside packages folder and change the order of properties or updateauthorfield, or removepublishConfigfield.Types of changes
Checklist: