Skip to content
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

Monorepo: add package.json linter #36534

Merged
merged 12 commits into from Nov 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions apps/README.md
Expand Up @@ -17,3 +17,8 @@ You must manually build apps by running:
```bash
npx lerna run build --scope="@automattic/app-name"
```

## Validating package.json
Running `npm run lint:package-json` will lint all `package.json`'s under `./apps/**` based on [`npmpackagejsonlint.config.js`](../npmpackagejsonlint.config.js).

If you need exceptions to linting rules, add them to overrides section in the config file.
2 changes: 1 addition & 1 deletion apps/full-site-editing/package.json
Expand Up @@ -9,7 +9,7 @@
"directory": "apps/full-site-editing"
},
"private": true,
"author": "Automattic, Inc.",
"author": "Automattic Inc.",
"license": "GPL-2.0-or-later",
"bugs": {
"url": "https://github.com/Automattic/wp-calypso/issues"
Expand Down
2 changes: 1 addition & 1 deletion apps/notifications/package.json
Expand Up @@ -10,7 +10,7 @@
"directory": "apps/notifications"
},
"private": true,
"author": "Automattic, Inc.",
"author": "Automattic Inc.",
"license": "GPL-2.0-or-later",
"bugs": {
"url": "https://github.com/Automattic/wp-calypso/issues"
Expand Down
2 changes: 1 addition & 1 deletion apps/o2-blocks/package.json
Expand Up @@ -10,7 +10,7 @@
"directory": "packages/o2-blocks"
},
"private": true,
"author": "Automattic, Inc.",
"author": "Automattic Inc.",
"license": "GPL-2.0-or-later",
"bugs": {
"url": "https://github.com/Automattic/wp-calypso/issues"
Expand Down
2 changes: 1 addition & 1 deletion apps/wpcom-block-editor/package.json
Expand Up @@ -9,7 +9,7 @@
"directory": "apps/wpcom-block-editor"
},
"private": true,
"author": "Automattic, Inc.",
"author": "Automattic Inc.",
"license": "GPL-2.0-or-later",
"bugs": {
"url": "https://github.com/Automattic/wp-calypso/issues"
Expand Down
4 changes: 3 additions & 1 deletion docs/monorepo.md
Expand Up @@ -51,7 +51,7 @@ The only exception are `devDependencies` which _must be declared in the wp-calyp
"module": "dist/esm/index.js",
"sideEffects": false,
"keywords": [ "wordpress" ],
"author": "Your Name <you@example.com> (https://yoursite.wordpress.com/)",
"author": "Automattic Inc.",
Copy link
Member Author

@simison simison Oct 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is better so as not to promote too tight "code ownership". Thoughts?

I can ping individuals who's names I've switched to the company name in this PR once it's in a mergeable state.

There is separate "contributors" array if folks really would like to have their names here. https://docs.npmjs.com/files/package.json#people-fields-author-contributors

I also tried to see if using org handle @automattic as an author gives any extra features in npm CLI or http://npmjs.org/ but it doesn't seem to.

"contributors": [],
"homepage": "https://github.com/Automattic/wp-calypso",
"license": "GPL-2.0-or-later",
Expand All @@ -77,6 +77,8 @@ The only exception are `devDependencies` which _must be declared in the wp-calyp

If your package requires compilation, the `package.json` `prepare` script should compile the package. If it contains ES6+ code that needs to be transpiled, use `transpile` (from `@automattic/calypso-build`) which will automatically compile code in `src/` to `dist/cjs` (CommonJS) and `dist/esm` (ECMAScript Modules) by running `babel` over any source files it finds.

Running `npm run lint:package-json` will lint all `package.json`'s under `./packages|apps/**` based on [`npmpackagejsonlint.config.js`](../npmpackagejsonlint.config.js).

## Running Tests

To run all of the package tests:
Expand Down
275 changes: 275 additions & 0 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.