Skip to content

Commit

Permalink
feat(npm-package-json-lint-config): npm-package-json-lint config
Browse files Browse the repository at this point in the history
  • Loading branch information
dangreen committed Feb 4, 2022
1 parent e676426 commit 14956cb
Show file tree
Hide file tree
Showing 12 changed files with 327 additions and 51 deletions.
6 changes: 6 additions & 0 deletions .npmpackagejsonlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": [
"@trigen/npm-package-json-lint-config",
"@trigen/npm-package-json-lint-config/monorepo"
]
}
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Scripts and configs for TrigenSoftware's projects.
| [`@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] |
| [`@trigen/browserslist-config`](packages/browserslist-config#readme) | [![NPM version][browserslist-config-npm]][browserslist-config-npm-url] | |
| [`@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] |
| [`@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] |

<!-- babel-preset -->

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

[eslint-config-deps]: https://img.shields.io/librariesio/release/npm/@trigen/eslint-config
[eslint-config-deps-url]: https://libraries.io/npm/@trigen%2Feslint-config/tree

<!-- npm-package-json-lint-config -->

[npm-package-json-lint-config-npm]: https://img.shields.io/npm/v/%40trigen/npm-package-json-lint-config.svg
[npm-package-json-lint-config-npm-url]: https://www.npmjs.com/package/@trigen/npm-package-json-lint-config

[npm-package-json-lint-config-deps]: https://img.shields.io/librariesio/release/npm/@trigen/npm-package-json-lint-config
[npm-package-json-lint-config-deps-url]: https://libraries.io/npm/@trigen%2Fnpm-package-json-lint-config/tree
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"node": ">=14"
},
"scripts": {
"lint:package-json": "npmPkgJsonLint .",
"lint": "eslint 'packages/**/*.{js,jsx,ts,tsx}'",
"jest": "NODE_OPTIONS=--experimental-vm-modules jest -c jest.config.json",
"test": "run -p lint jest",
Expand All @@ -36,6 +37,7 @@
"@swc/jest": "^0.2.14",
"@trigen/browserslist-config": "workspace:*",
"@trigen/eslint-config": "workspace:*",
"@trigen/npm-package-json-lint-config": "workspace:*",
"@trigen/scripts": "workspace:*",
"@types/node": "^17.0.8",
"clean-publish": "^4.0.0",
Expand All @@ -46,6 +48,7 @@
"jest": "^27.4.5",
"lerna": "^4.0.0",
"nano-staged": "^0.5.0",
"npm-package-json-lint": "^5.4.2",
"simple-git-hooks": "^2.7.0",
"simple-github-release": "^1.0.0",
"typescript": "^4.4.3"
Expand Down
20 changes: 10 additions & 10 deletions packages/babel-preset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,22 @@
"bugs": {
"url": "https://github.com/TrigenSoftware/scripts/issues"
},
"keywords": [
"babel",
"babel-preset"
],
"engines": {
"node": ">=10"
},
"main": "./src/index.js",
"exports": {
".": "./src/index.js",
"./*": "./src/*.js"
},
"engines": {
"node": ">=10"
"publishConfig": {
"access": "public",
"directory": "package"
},
"keywords": [
"babel",
"babel-preset"
],
"scripts": {
"prepublishOnly": "del ./package && clean-publish",
"postpublish": "del ./package"
Expand Down Expand Up @@ -55,9 +59,5 @@
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"babel-plugin-transform-remove-imports": "^1.5.2"
},
"publishConfig": {
"access": "public",
"directory": "package"
},
"readme": ""
}
22 changes: 11 additions & 11 deletions packages/browserslist-config/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@trigen/browserslist-config",
"version": "8.0.0-alpha.2",
"description": "Trigen's Browserslist config",
"description": "Trigen's Browserslist config.",
"author": "dangreen",
"license": "MIT",
"repository": {
Expand All @@ -12,25 +12,25 @@
"bugs": {
"url": "https://github.com/TrigenSoftware/scripts/issues"
},
"keywords": [
"browserslist",
"browserslist-config"
],
"engines": {
"node": ">=10"
},
"main": "./src/index.js",
"exports": {
".": "./src/index.js",
"./*": "./src/*.js"
},
"engines": {
"node": ">=10"
"publishConfig": {
"access": "public",
"directory": "package"
},
"keywords": [
"browserslist",
"browserslist-config"
],
"scripts": {
"prepublishOnly": "del ./package && clean-publish",
"postpublish": "del ./package"
},
"publishConfig": {
"access": "public",
"directory": "package"
},
"readme": ""
}
5 changes: 5 additions & 0 deletions packages/npm-package-json-lint-config/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": [
"@trigen/eslint-config/commonjs"
]
}
51 changes: 51 additions & 0 deletions packages/npm-package-json-lint-config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# @trigen/npm-package-json-lint-config

[![NPM version][npm]][npm-url]
[![Node version][node]][node-url]
[![Dependencies status][deps]][deps-url]
[![Build status][build]][build-url]

[npm]: https://img.shields.io/npm/v/%40trigen/npm-package-json-lint-config.svg
[npm-url]: https://npmjs.com/package/@trigen/npm-package-json-lint-config

[node]: https://img.shields.io/node/v/%40trigen/npm-package-json-lint-config.svg
[node-url]: https://nodejs.org

[deps]: https://img.shields.io/librariesio/release/npm/@trigen/npm-package-json-lint-config
[deps-url]: https://libraries.io/npm/@trigen%2Feslint-config/tree

[build]: https://img.shields.io/github/workflow/status/TrigenSoftware/scripts/CI.svg
[build-url]: https://github.com/TrigenSoftware/scripts/actions

Trigen's npm-package-json-lint config.

## Install

```bash
pnpm add -D @trigen/npm-package-json-lint-config
# or
yarn add -D @trigen/npm-package-json-lint-config
# or
npm i -D @trigen/npm-package-json-lint-config
```

## Configure

Create `.npmpackagejsonlintrc.json` with next content:

```json
{
"extends": "@trigen/npm-package-json-lint-config"
}
```

for monorepos:

```json
{
"extends": [
"@trigen/npm-package-json-lint-config",
"@trigen/npm-package-json-lint-config/monorepo"
]
}
```
42 changes: 42 additions & 0 deletions packages/npm-package-json-lint-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "@trigen/npm-package-json-lint-config",
"version": "8.0.0-alpha.3",
"description": "Trigen's npm-package-json-lint config.",
"author": "dangreen",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/TrigenSoftware/scripts.git",
"directory": "packages/npm-package-json-lint-config"
},
"bugs": {
"url": "https://github.com/TrigenSoftware/scripts/issues"
},
"keywords": [
"npm-package-json-lint",
"npm-package-json-lint-config"
],
"engines": {
"node": ">=10"
},
"main": "./src/index.js",
"exports": {
".": "./src/index.js",
"./*": "./src/*.js"
},
"publishConfig": {
"access": "public",
"directory": "package"
},
"scripts": {
"prepublishOnly": "del ./package && clean-publish",
"postpublish": "del ./package"
},
"peerDependencies": {
"npm-package-json-lint": ">= 2"
},
"dependencies": {
"npm-package-json-lint-config-default": "^3.0.0"
},
"readme": ""
}
57 changes: 57 additions & 0 deletions packages/npm-package-json-lint-config/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
module.exports = {
extends: 'npm-package-json-lint-config-default',
rules: {
'require-author': 'error',
'require-bugs': 'error',
'require-description': 'error',
'require-keywords': 'error',
'require-license': 'error',
'require-repository': 'error',
'no-repeated-dependencies': 'error',
'description-format': [
'error',
{
requireCapitalFirstLetter: true,
requireEndingPeriod: true
}
],
'name-format': 'error',
'version-format': 'error',
'no-duplicate-properties': 'error',
'prefer-no-engineStrict': 'error',
'prefer-property-order': [
'error',
[
'name',
'type',
'private',
'version',
'description',
'author',
'authors',
'license',
'homepage',
'repository',
'bugs',
'keywords',
'engines',
'bin',
'sideEffects',
'types',
'main',
'module',
'umd',
'exports',
'publishConfig',
'files',
'scripts',
'peerDependencies',
'dependencies',
'devDependencies',
'workspaces',
'tsd',
'readme'
]
]
}
}
20 changes: 20 additions & 0 deletions packages/npm-package-json-lint-config/src/monorepo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const base = require('.')

module.exports = {
rules: {
'require-keywords': 'off',
'require-private': 'error',
'valid-values-private': ['error', [true]]
},
overrides: [
{
patterns: ['packages/*/package.json'],
rules: {
'require-private': 'off',
'valid-values-private': 'off',
'require-repository-directory': 'error',
...base.rules
}
}
]
}
22 changes: 11 additions & 11 deletions packages/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,22 @@
"bugs": {
"url": "https://github.com/TrigenSoftware/scripts/issues"
},
"bin": {
"run": "./src/run.js"
},
"exports": "./src/index.js",
"engines": {
"node": ">=14"
},
"keywords": [
"scripts",
"tasks",
"runner"
],
"engines": {
"node": ">=14"
},
"bin": {
"run": "./src/run.js"
},
"exports": "./src/index.js",
"publishConfig": {
"access": "public",
"directory": "package"
},
"scripts": {
"prepublishOnly": "del ./package && clean-publish",
"postpublish": "del ./package"
Expand All @@ -34,9 +38,5 @@
"dotenv": "^14.0.0",
"p-limit": "^4.0.0"
},
"publishConfig": {
"access": "public",
"directory": "package"
},
"readme": ""
}

0 comments on commit 14956cb

Please sign in to comment.