-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
@wordpress/npm-package-json-lint-config
package (#119)
* Add `@wordpress/npm-package-json-lint-config` package * Standardize packages `package.json` format per `@wordpress/npm-package-json-lint` * Add unused `npm-package-json-lint` rules for reference * Update `npm-package-json-lint` to `3.0.0-alpha3` * Add `valid-values-publishConfig` rule with `{"access": "public"}` option for _packages_ repo * use tabs for indentation * Update npm-package-json-lint to v3 * Update npmPackageJsonLintConfig config formatting * Use latest `3.0.1` npm-package-json-lint release and remove `.npmpackagejsonlintrc.json` * Use `lint:pkg-json` as the npmPkgJsonLint script task name * fix `pretest` test script command * Npm package.json lint config: address my own comments * Add is-plain-object as devDependency
- Loading branch information
Showing
14 changed files
with
282 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package-lock=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# `@wordpress/npm-package-json-lint-config` | ||
|
||
> WordPress [npm-package-json-lint](https://github.com/tclindner/npm-package-json-lint) shareable config | ||
## Installation | ||
|
||
Install the module | ||
|
||
```shell | ||
$ npm install @wordpress/npm-package-json-lint-config | ||
``` | ||
|
||
## Usage | ||
|
||
Add this to your `package.json` file: | ||
|
||
```json | ||
"npmPackageJsonLintConfig": { | ||
"extends": "@wordpress/npm-package-json-lint-config", | ||
}, | ||
``` | ||
|
||
Or to a `.npmpackagejsonlintrc.json` file in the root of your repo: | ||
```json | ||
{ | ||
"extends": "@wordpress/npm-package-json-lint-config", | ||
} | ||
|
||
``` | ||
|
||
To add, modify, or override any [npm-package-json-lint](https://github.com/tclindner/npm-package-json-lint/wiki) rules add this to your `package.json` file: | ||
|
||
```json | ||
"npmPackageJsonLintConfig": { | ||
"extends": "@wordpress/npm-package-json-lint-config", | ||
"rules": { | ||
"valid-values-author": [ | ||
"error", | ||
[ | ||
"WordPress" | ||
] | ||
] | ||
} | ||
}, | ||
``` | ||
|
||
Or to a `.npmpackagejsonlintrc.json` file in the root of your repo: | ||
|
||
```json | ||
{ | ||
"extends": "@wordpress/npm-package-json-lint-config", | ||
"rules": { | ||
"require-publishConfig": "error", | ||
"valid-values-author": [ | ||
"error", | ||
[ | ||
"WordPress" | ||
] | ||
] | ||
} | ||
} | ||
|
||
``` | ||
|
||
<br/><br/><p align="center"><img src="https://s.w.org/style/images/codeispoetry.png?1" alt="Code is Poetry." /></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
'use strict'; | ||
|
||
const defaultConfig = { | ||
rules: { | ||
'bin-type': 'error', | ||
'bundledDependencies-type': 'error', | ||
'config-type': 'error', | ||
'cpu-type': 'error', | ||
'dependencies-type': 'error', | ||
'description-type': 'error', | ||
'devDependencies-type': 'error', | ||
'directories-type': 'error', | ||
'engines-type': 'error', | ||
'files-type': 'error', | ||
'homepage-type': 'error', | ||
'keywords-type': 'error', | ||
'license-type': 'error', | ||
'main-type': 'error', | ||
'man-type': 'error', | ||
'name-format': 'error', | ||
'name-type': 'error', | ||
'no-restricted-dependencies': 'off', | ||
'no-restricted-devDependencies': 'off', | ||
'no-restricted-pre-release-dependencies': 'off', | ||
'no-restricted-pre-release-devDependencies': 'off', | ||
'optionalDependencies-type': 'error', | ||
'os-type': 'error', | ||
'peerDependencies-type': 'error', | ||
'prefer-absolute-version-dependencies': 'off', | ||
'prefer-absolute-version-devDependencies': 'off', | ||
'prefer-alphabetical-bundledDependencies': 'error', | ||
'prefer-alphabetical-dependencies': 'error', | ||
'prefer-alphabetical-devDependencies': 'error', | ||
'prefer-alphabetical-optionalDependencies': 'error', | ||
'prefer-alphabetical-peerDependencies': 'error', | ||
'prefer-caret-version-dependencies': 'off', | ||
'prefer-caret-version-devDependencies': 'off', | ||
'prefer-no-engineStrict': 'off', | ||
'prefer-no-version-zero-dependencies': 'off', | ||
'prefer-no-version-zero-devDependencies': 'off', | ||
'prefer-property-order': [ | ||
'error', | ||
[ | ||
'name', | ||
'version', | ||
'description', | ||
'author', | ||
'license', | ||
'keywords', | ||
'homepage', | ||
'repository', | ||
'bugs', | ||
'engines', | ||
'directories', | ||
'files', | ||
'main', | ||
'module', | ||
'bin', | ||
'dependencies', | ||
'devDependencies', | ||
'peerDependencies', | ||
'publishConfig', | ||
'scripts', | ||
], | ||
], | ||
'prefer-tilde-version-dependencies': 'off', | ||
'prefer-tilde-version-devDependencies': 'off', | ||
'preferGlobal-type': 'error', | ||
'private-type': 'error', | ||
'repository-type': 'error', | ||
'require-author': 'error', | ||
'require-bin': 'off', | ||
'require-bugs': 'error', | ||
'require-bundledDependencies': 'off', | ||
'require-config': 'off', | ||
'require-contributors': 'off', | ||
'require-cpu': 'off', | ||
'require-dependencies': 'off', | ||
'require-description': 'error', | ||
'require-devDependencies': 'off', | ||
'require-directories': 'off', | ||
'require-engines': 'off', | ||
'require-files': 'off', | ||
'require-homepage': 'error', | ||
'require-keywords': 'error', | ||
'require-license': 'error', | ||
'require-main': 'off', | ||
'require-man': 'off', | ||
'require-module': 'off', | ||
'require-name': 'error', | ||
'require-optionalDependencies': 'off', | ||
'require-os': 'off', | ||
'require-peerDependencies': 'off', | ||
'require-preferGlobal': 'off', | ||
'require-private': 'off', | ||
'require-publishConfig': 'off', | ||
'require-repository': 'error', | ||
'require-scripts': 'off', | ||
'require-version': 'error', | ||
'scripts-type': 'error', | ||
'valid-values-author': 'off', | ||
'valid-values-license': [ 'error', [ | ||
'GPL-2.0-or-later', | ||
] ], | ||
'valid-values-private': 'off', | ||
'version-format': 'error', | ||
'version-type': 'error', | ||
}, | ||
}; | ||
|
||
module.exports = defaultConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"name": "@wordpress/npm-package-json-lint-config", | ||
"version": "0.1.0", | ||
"description": "WordPress npm-package-json-lint shareable config", | ||
"author": "WordPress", | ||
"license": "GPL-2.0-or-later", | ||
"keywords": [ | ||
"wordpress", | ||
"npm-package-json-lint", | ||
"npm-package-json-lint-config" | ||
], | ||
"homepage": "https://github.com/WordPress/packages/tree/master/packages/npm-package-json-lint-config/README.md", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/WordPress/packages.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/WordPress/packages/issues" | ||
}, | ||
"main": "index.js", | ||
"devDependencies": { | ||
"is-plain-obj": "^1.1.0" | ||
}, | ||
"peerDependencies": { | ||
"npm-package-json-lint": ">= 3.0.0" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"scripts": { | ||
"test": "echo \"Error: run tests from root\" && exit 1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import isPlainObj from 'is-plain-obj'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import config from '../'; | ||
|
||
describe( 'npm-package-json-lint config tests', () => { | ||
it( 'should be an object', () => { | ||
expect( isPlainObj( config ) ).toBeTruthy(); | ||
} ); | ||
|
||
it( 'should be an object', () => { | ||
expect( isPlainObj( config.rules ) ).toBeTruthy(); | ||
} ); | ||
} ); |
Oops, something went wrong.