Skip to content

Commit 592b0c8

Browse files
feat: onboard eslint-plugin-package-json (#1269)
## PR Checklist - [x] Addresses an existing open issue: fixes #839 - [x] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/create-typescript-app/blob/main/.github/CONTRIBUTING.md) were taken ## Overview Directly swaps from the standalone `npm-package-json-lint` linter to using `eslint-plugin-package-json` in the existing ESLint config. Fewer tools, yay!
1 parent 25fb5e5 commit 592b0c8

27 files changed

+131
-363
lines changed

.eslintrc.cjs

+6
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ module.exports = {
107107
"jsonc/no-comments": "off",
108108
},
109109
},
110+
{
111+
extends: ["plugin:package-json/recommended"],
112+
files: ["package.json"],
113+
parser: "jsonc-eslint-parser",
114+
plugins: ["package-json"],
115+
},
110116
{
111117
files: "**/*.test.ts",
112118
rules: {

.github/DEVELOPMENT.md

-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ Each should be shown in VS Code, and can be run manually on the command-line:
4747
- `pnpm lint` ([ESLint](https://eslint.org) with [typescript-eslint](https://typescript-eslint.io)): Lints JavaScript and TypeScript source files
4848
- `pnpm lint:knip` ([knip](https://github.com/webpro/knip)): Detects unused files, dependencies, and code exports
4949
- `pnpm lint:md` ([Markdownlint](https://github.com/DavidAnson/markdownlint)): Checks Markdown source files
50-
- `pnpm lint:package-json` ([npm-package-json-lint](https://npmpackagejsonlint.org/)): Lints the `package.json` file
5150
- `pnpm lint:packages` ([pnpm dedupe --check](https://pnpm.io/cli/dedupe)): Checks for unnecessarily duplicated packages in the `pnpm-lock.yml` file
5251
- `pnpm lint:spelling` ([cspell](https://cspell.org)): Spell checks across all source files
5352

.github/workflows/lint-package-json.yml

-15
This file was deleted.

.npmpackagejsonlintrc.json

-4
This file was deleted.

docs/Options.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Alternately, you can bypass that prompt by providing any number of the following
8888
- `--exclude-lint-json`: Don't apply linting and sorting to `*.json` and `*.jsonc` files.
8989
- `--exclude-lint-knip`: Don't add Knip to detect unused files, dependencies, and code exports.
9090
- `--exclude-lint-md`: Don't apply linting to `*.md` files.
91-
- `--exclude-lint-package-json`: Don't add npm-package-json-lint to lint for package.json correctness.
91+
- `--exclude-lint-package-json`: Don't add eslint-plugin-package-json to lint for package.json correctness.
9292
- `--exclude-lint-deprecation`: Don't use eslint-plugin-deprecation to report on usage of code marked as `@deprecated`.
9393
- `--exclude-lint-eslint`: Don't use eslint-plugin-eslint-comment to enforce good practices around ESLint comment directives.
9494
- `--exclude-lint-jsdoc`: Don't use eslint-plugin-jsdoc to enforce good practices around JSDoc comments.

docs/Tooling.md

+1-7
Original file line numberDiff line numberDiff line change
@@ -267,13 +267,7 @@ pnpm lint:md
267267
268268
### Lint Package JSON
269269

270-
[`npm-package-json-lint`](https://github.com/tclindner/npm-package-json-lint): Linting for `package.json` files.
271-
272-
```shell
273-
pnpm lint:package-json
274-
```
275-
276-
> This is a separate linter from ESLint, but will likely eventually be switched to an ESLint plugin ([#839](https://github.com/JoshuaKGoldberg/create-typescript-app/issues/839)).
270+
[`eslint-plugin-package-json`](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json): Linting for `package.json` files.
277271

278272
### Lint Packages
279273

package.json

+2-7
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
"name": "create-typescript-app",
33
"version": "1.55.0",
44
"description": "Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. 💝",
5-
"repository": {
6-
"type": "git",
7-
"url": "https://github.com/JoshuaKGoldberg/create-typescript-app"
8-
},
5+
"repository": "JoshuaKGoldberg/create-typescript-app",
96
"license": "MIT",
107
"author": {
118
"name": "Josh Goldberg",
@@ -28,7 +25,6 @@
2825
"lint": "eslint . .*js --max-warnings 0",
2926
"lint:knip": "knip",
3027
"lint:md": "markdownlint \"**/*.md\" \".github/**/*.md\" --rules sentences-per-line",
31-
"lint:package-json": "npmPkgJsonLint .",
3228
"lint:packages": "pnpm dedupe --check",
3329
"lint:spelling": "cspell \"**\" \".github/**/*\"",
3430
"prepare": "husky install",
@@ -84,6 +80,7 @@
8480
"eslint-plugin-markdown": "^3.0.1",
8581
"eslint-plugin-n": "^16.3.1",
8682
"eslint-plugin-no-only-tests": "^3.1.0",
83+
"eslint-plugin-package-json": "^0.10.0",
8784
"eslint-plugin-perfectionist": "^2.5.0",
8885
"eslint-plugin-regexp": "^2.1.2",
8986
"eslint-plugin-vitest": "^0.3.10",
@@ -95,8 +92,6 @@
9592
"lint-staged": "^15.2.0",
9693
"markdownlint": "^0.33.0",
9794
"markdownlint-cli": "^0.38.0",
98-
"npm-package-json-lint": "^7.1.0",
99-
"npm-package-json-lint-config-default": "^6.0.0",
10095
"prettier-plugin-curly": "^0.1.3",
10196
"prettier-plugin-packagejson": "^2.4.7",
10297
"release-it": "^17.0.0",

0 commit comments

Comments
 (0)