Skip to content

Commit

Permalink
Monorepo: add package.json linter (#36534)
Browse files Browse the repository at this point in the history
* Monorepo: add package.json linter

* Monorepo: doc update

* add npm-package-json-lint@4.0.1

* Alphabetize dependencies

* Add quotes to globs

* Remove duplicates already in config we extend

* Update package.json

Co-authored-by: Jon Surrell <jon.surrell@automattic.com>
  • Loading branch information
2 people authored and blowery committed Nov 6, 2019
1 parent d1f5337 commit fa3d9e9
Show file tree
Hide file tree
Showing 28 changed files with 369 additions and 23 deletions.
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.",
"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.

0 comments on commit fa3d9e9

Please sign in to comment.