Skip to content

Commit 14956cb

Browse files
committed
feat(npm-package-json-lint-config): npm-package-json-lint config
1 parent e676426 commit 14956cb

12 files changed

Lines changed: 327 additions & 51 deletions

File tree

.npmpackagejsonlintrc.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": [
3+
"@trigen/npm-package-json-lint-config",
4+
"@trigen/npm-package-json-lint-config/monorepo"
5+
]
6+
}

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Scripts and configs for TrigenSoftware's projects.
2727
| [`@trigen/babel-preset`](packages/babel-preset#readme) | [![NPM version][babel-preset-npm]][babel-preset-npm-url] | [![Dependencies status][babel-preset-deps]][babel-preset-deps-url] |
2828
| [`@trigen/browserslist-config`](packages/browserslist-config#readme) | [![NPM version][browserslist-config-npm]][browserslist-config-npm-url] | |
2929
| [`@trigen/eslint-config`](packages/eslint-config#readme) | [![NPM version][eslint-config-npm]][eslint-config-npm-url] | [![Dependencies status][eslint-config-deps]][eslint-config-deps-url] |
30+
| [`@trigen/npm-package-json-lint-config`](packages/npm-package-json-lint-config#readme) | [![NPM version][npm-package-json-lint-config-npm]][npm-package-json-lint-config-npm-url] | [![Dependencies status][npm-package-json-lint-config-deps]][npm-package-json-lint-config-deps-url] |
3031

3132
<!-- babel-preset -->
3233

@@ -48,3 +49,11 @@ Scripts and configs for TrigenSoftware's projects.
4849

4950
[eslint-config-deps]: https://img.shields.io/librariesio/release/npm/@trigen/eslint-config
5051
[eslint-config-deps-url]: https://libraries.io/npm/@trigen%2Feslint-config/tree
52+
53+
<!-- npm-package-json-lint-config -->
54+
55+
[npm-package-json-lint-config-npm]: https://img.shields.io/npm/v/%40trigen/npm-package-json-lint-config.svg
56+
[npm-package-json-lint-config-npm-url]: https://www.npmjs.com/package/@trigen/npm-package-json-lint-config
57+
58+
[npm-package-json-lint-config-deps]: https://img.shields.io/librariesio/release/npm/@trigen/npm-package-json-lint-config
59+
[npm-package-json-lint-config-deps-url]: https://libraries.io/npm/@trigen%2Fnpm-package-json-lint-config/tree

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"node": ">=14"
1818
},
1919
"scripts": {
20+
"lint:package-json": "npmPkgJsonLint .",
2021
"lint": "eslint 'packages/**/*.{js,jsx,ts,tsx}'",
2122
"jest": "NODE_OPTIONS=--experimental-vm-modules jest -c jest.config.json",
2223
"test": "run -p lint jest",
@@ -36,6 +37,7 @@
3637
"@swc/jest": "^0.2.14",
3738
"@trigen/browserslist-config": "workspace:*",
3839
"@trigen/eslint-config": "workspace:*",
40+
"@trigen/npm-package-json-lint-config": "workspace:*",
3941
"@trigen/scripts": "workspace:*",
4042
"@types/node": "^17.0.8",
4143
"clean-publish": "^4.0.0",
@@ -46,6 +48,7 @@
4648
"jest": "^27.4.5",
4749
"lerna": "^4.0.0",
4850
"nano-staged": "^0.5.0",
51+
"npm-package-json-lint": "^5.4.2",
4952
"simple-git-hooks": "^2.7.0",
5053
"simple-github-release": "^1.0.0",
5154
"typescript": "^4.4.3"

packages/babel-preset/package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,22 @@
1212
"bugs": {
1313
"url": "https://github.com/TrigenSoftware/scripts/issues"
1414
},
15+
"keywords": [
16+
"babel",
17+
"babel-preset"
18+
],
19+
"engines": {
20+
"node": ">=10"
21+
},
1522
"main": "./src/index.js",
1623
"exports": {
1724
".": "./src/index.js",
1825
"./*": "./src/*.js"
1926
},
20-
"engines": {
21-
"node": ">=10"
27+
"publishConfig": {
28+
"access": "public",
29+
"directory": "package"
2230
},
23-
"keywords": [
24-
"babel",
25-
"babel-preset"
26-
],
2731
"scripts": {
2832
"prepublishOnly": "del ./package && clean-publish",
2933
"postpublish": "del ./package"
@@ -55,9 +59,5 @@
5559
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
5660
"babel-plugin-transform-remove-imports": "^1.5.2"
5761
},
58-
"publishConfig": {
59-
"access": "public",
60-
"directory": "package"
61-
},
6262
"readme": ""
6363
}
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@trigen/browserslist-config",
33
"version": "8.0.0-alpha.2",
4-
"description": "Trigen's Browserslist config",
4+
"description": "Trigen's Browserslist config.",
55
"author": "dangreen",
66
"license": "MIT",
77
"repository": {
@@ -12,25 +12,25 @@
1212
"bugs": {
1313
"url": "https://github.com/TrigenSoftware/scripts/issues"
1414
},
15+
"keywords": [
16+
"browserslist",
17+
"browserslist-config"
18+
],
19+
"engines": {
20+
"node": ">=10"
21+
},
1522
"main": "./src/index.js",
1623
"exports": {
1724
".": "./src/index.js",
1825
"./*": "./src/*.js"
1926
},
20-
"engines": {
21-
"node": ">=10"
27+
"publishConfig": {
28+
"access": "public",
29+
"directory": "package"
2230
},
23-
"keywords": [
24-
"browserslist",
25-
"browserslist-config"
26-
],
2731
"scripts": {
2832
"prepublishOnly": "del ./package && clean-publish",
2933
"postpublish": "del ./package"
3034
},
31-
"publishConfig": {
32-
"access": "public",
33-
"directory": "package"
34-
},
3535
"readme": ""
3636
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"extends": [
3+
"@trigen/eslint-config/commonjs"
4+
]
5+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# @trigen/npm-package-json-lint-config
2+
3+
[![NPM version][npm]][npm-url]
4+
[![Node version][node]][node-url]
5+
[![Dependencies status][deps]][deps-url]
6+
[![Build status][build]][build-url]
7+
8+
[npm]: https://img.shields.io/npm/v/%40trigen/npm-package-json-lint-config.svg
9+
[npm-url]: https://npmjs.com/package/@trigen/npm-package-json-lint-config
10+
11+
[node]: https://img.shields.io/node/v/%40trigen/npm-package-json-lint-config.svg
12+
[node-url]: https://nodejs.org
13+
14+
[deps]: https://img.shields.io/librariesio/release/npm/@trigen/npm-package-json-lint-config
15+
[deps-url]: https://libraries.io/npm/@trigen%2Feslint-config/tree
16+
17+
[build]: https://img.shields.io/github/workflow/status/TrigenSoftware/scripts/CI.svg
18+
[build-url]: https://github.com/TrigenSoftware/scripts/actions
19+
20+
Trigen's npm-package-json-lint config.
21+
22+
## Install
23+
24+
```bash
25+
pnpm add -D @trigen/npm-package-json-lint-config
26+
# or
27+
yarn add -D @trigen/npm-package-json-lint-config
28+
# or
29+
npm i -D @trigen/npm-package-json-lint-config
30+
```
31+
32+
## Configure
33+
34+
Create `.npmpackagejsonlintrc.json` with next content:
35+
36+
```json
37+
{
38+
"extends": "@trigen/npm-package-json-lint-config"
39+
}
40+
```
41+
42+
for monorepos:
43+
44+
```json
45+
{
46+
"extends": [
47+
"@trigen/npm-package-json-lint-config",
48+
"@trigen/npm-package-json-lint-config/monorepo"
49+
]
50+
}
51+
```
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"name": "@trigen/npm-package-json-lint-config",
3+
"version": "8.0.0-alpha.3",
4+
"description": "Trigen's npm-package-json-lint config.",
5+
"author": "dangreen",
6+
"license": "MIT",
7+
"repository": {
8+
"type": "git",
9+
"url": "https://github.com/TrigenSoftware/scripts.git",
10+
"directory": "packages/npm-package-json-lint-config"
11+
},
12+
"bugs": {
13+
"url": "https://github.com/TrigenSoftware/scripts/issues"
14+
},
15+
"keywords": [
16+
"npm-package-json-lint",
17+
"npm-package-json-lint-config"
18+
],
19+
"engines": {
20+
"node": ">=10"
21+
},
22+
"main": "./src/index.js",
23+
"exports": {
24+
".": "./src/index.js",
25+
"./*": "./src/*.js"
26+
},
27+
"publishConfig": {
28+
"access": "public",
29+
"directory": "package"
30+
},
31+
"scripts": {
32+
"prepublishOnly": "del ./package && clean-publish",
33+
"postpublish": "del ./package"
34+
},
35+
"peerDependencies": {
36+
"npm-package-json-lint": ">= 2"
37+
},
38+
"dependencies": {
39+
"npm-package-json-lint-config-default": "^3.0.0"
40+
},
41+
"readme": ""
42+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
module.exports = {
2+
extends: 'npm-package-json-lint-config-default',
3+
rules: {
4+
'require-author': 'error',
5+
'require-bugs': 'error',
6+
'require-description': 'error',
7+
'require-keywords': 'error',
8+
'require-license': 'error',
9+
'require-repository': 'error',
10+
'no-repeated-dependencies': 'error',
11+
'description-format': [
12+
'error',
13+
{
14+
requireCapitalFirstLetter: true,
15+
requireEndingPeriod: true
16+
}
17+
],
18+
'name-format': 'error',
19+
'version-format': 'error',
20+
'no-duplicate-properties': 'error',
21+
'prefer-no-engineStrict': 'error',
22+
'prefer-property-order': [
23+
'error',
24+
[
25+
'name',
26+
'type',
27+
'private',
28+
'version',
29+
'description',
30+
'author',
31+
'authors',
32+
'license',
33+
'homepage',
34+
'repository',
35+
'bugs',
36+
'keywords',
37+
'engines',
38+
'bin',
39+
'sideEffects',
40+
'types',
41+
'main',
42+
'module',
43+
'umd',
44+
'exports',
45+
'publishConfig',
46+
'files',
47+
'scripts',
48+
'peerDependencies',
49+
'dependencies',
50+
'devDependencies',
51+
'workspaces',
52+
'tsd',
53+
'readme'
54+
]
55+
]
56+
}
57+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const base = require('.')
2+
3+
module.exports = {
4+
rules: {
5+
'require-keywords': 'off',
6+
'require-private': 'error',
7+
'valid-values-private': ['error', [true]]
8+
},
9+
overrides: [
10+
{
11+
patterns: ['packages/*/package.json'],
12+
rules: {
13+
'require-private': 'off',
14+
'valid-values-private': 'off',
15+
'require-repository-directory': 'error',
16+
...base.rules
17+
}
18+
}
19+
]
20+
}

0 commit comments

Comments
 (0)