Skip to content

feat: onboard eslint-plugin-package-json #1269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -107,6 +107,12 @@ module.exports = {
"jsonc/no-comments": "off",
},
},
{
extends: ["plugin:package-json/recommended"],
files: ["package.json"],
parser: "jsonc-eslint-parser",
plugins: ["package-json"],
},
{
files: "**/*.test.ts",
rules: {
1 change: 0 additions & 1 deletion .github/DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -47,7 +47,6 @@ Each should be shown in VS Code, and can be run manually on the command-line:
- `pnpm lint` ([ESLint](https://eslint.org) with [typescript-eslint](https://typescript-eslint.io)): Lints JavaScript and TypeScript source files
- `pnpm lint:knip` ([knip](https://github.com/webpro/knip)): Detects unused files, dependencies, and code exports
- `pnpm lint:md` ([Markdownlint](https://github.com/DavidAnson/markdownlint)): Checks Markdown source files
- `pnpm lint:package-json` ([npm-package-json-lint](https://npmpackagejsonlint.org/)): Lints the `package.json` file
- `pnpm lint:packages` ([pnpm dedupe --check](https://pnpm.io/cli/dedupe)): Checks for unnecessarily duplicated packages in the `pnpm-lock.yml` file
- `pnpm lint:spelling` ([cspell](https://cspell.org)): Spell checks across all source files

15 changes: 0 additions & 15 deletions .github/workflows/lint-package-json.yml

This file was deleted.

4 changes: 0 additions & 4 deletions .npmpackagejsonlintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion docs/Options.md
Original file line number Diff line number Diff line change
@@ -88,7 +88,7 @@ Alternately, you can bypass that prompt by providing any number of the following
- `--exclude-lint-json`: Don't apply linting and sorting to `*.json` and `*.jsonc` files.
- `--exclude-lint-knip`: Don't add Knip to detect unused files, dependencies, and code exports.
- `--exclude-lint-md`: Don't apply linting to `*.md` files.
- `--exclude-lint-package-json`: Don't add npm-package-json-lint to lint for package.json correctness.
- `--exclude-lint-package-json`: Don't add eslint-plugin-package-json to lint for package.json correctness.
- `--exclude-lint-deprecation`: Don't use eslint-plugin-deprecation to report on usage of code marked as `@deprecated`.
- `--exclude-lint-eslint`: Don't use eslint-plugin-eslint-comment to enforce good practices around ESLint comment directives.
- `--exclude-lint-jsdoc`: Don't use eslint-plugin-jsdoc to enforce good practices around JSDoc comments.
8 changes: 1 addition & 7 deletions docs/Tooling.md
Original file line number Diff line number Diff line change
@@ -267,13 +267,7 @@ pnpm lint:md

### Lint Package JSON

[`npm-package-json-lint`](https://github.com/tclindner/npm-package-json-lint): Linting for `package.json` files.

```shell
pnpm lint:package-json
```

> 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)).
[`eslint-plugin-package-json`](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json): Linting for `package.json` files.

### Lint Packages

9 changes: 2 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -2,10 +2,7 @@
"name": "create-typescript-app",
"version": "1.55.0",
"description": "Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. 💝",
"repository": {
"type": "git",
"url": "https://github.com/JoshuaKGoldberg/create-typescript-app"
},
"repository": "JoshuaKGoldberg/create-typescript-app",
"license": "MIT",
"author": {
"name": "Josh Goldberg",
@@ -28,7 +25,6 @@
"lint": "eslint . .*js --max-warnings 0",
"lint:knip": "knip",
"lint:md": "markdownlint \"**/*.md\" \".github/**/*.md\" --rules sentences-per-line",
"lint:package-json": "npmPkgJsonLint .",
"lint:packages": "pnpm dedupe --check",
"lint:spelling": "cspell \"**\" \".github/**/*\"",
"prepare": "husky install",
@@ -84,6 +80,7 @@
"eslint-plugin-markdown": "^3.0.1",
"eslint-plugin-n": "^16.3.1",
"eslint-plugin-no-only-tests": "^3.1.0",
"eslint-plugin-package-json": "^0.10.0",
"eslint-plugin-perfectionist": "^2.5.0",
"eslint-plugin-regexp": "^2.1.2",
"eslint-plugin-vitest": "^0.3.10",
@@ -95,8 +92,6 @@
"lint-staged": "^15.2.0",
"markdownlint": "^0.33.0",
"markdownlint-cli": "^0.38.0",
"npm-package-json-lint": "^7.1.0",
"npm-package-json-lint-config-default": "^6.0.0",
"prettier-plugin-curly": "^0.1.3",
"prettier-plugin-packagejson": "^2.4.7",
"release-it": "^17.0.0",
Loading