-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(valid-package-definition): rename rule from valid-package-def (#711
) <!-- π Hi, thanks for sending a PR to eslint-plugin-package-json! π. Please fill out all fields below and make sure each item is true and [x] checked. Otherwise we may not be able to review your PR. --> ## PR Checklist - [x] Addresses an existing open issue: fixes #132 - [x] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/blob/main/.github/CONTRIBUTING.md) were taken ## Overview This change deprecates the `valid-package-def` rule in favor of a new `valid-package-definition` rule, providing the same behavior. The deprecated version of the rule will be removed in the next major release. I assumed you wanted to roll this change out in a non-breaking way initially? If that's not the case and you want to major, I can remove the deprecated rule. If you do prefer this approach, then it may be worth documenting the follow-up so that when it's time to major, the deprecated rule is dropped? Closes #132
- Loading branch information
1 parent
cd165ae
commit 4f3907b
Showing
6 changed files
with
92 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# valid-package-definition | ||
|
||
πΌ This rule is enabled in the β `recommended` config. | ||
|
||
<!-- end auto-generated rule header --> | ||
|
||
npm issues warnings after install if the `package.json` has a missing or invalid required property. | ||
This rule uses [`package-json-validator`][pjv] to validate all `package.json` files against the [npm specification][npm-spec], and add any violations to lint warnings. | ||
|
||
## Rule Details | ||
|
||
This rule aims to ensure that `package.json` complies with specifications. | ||
|
||
Examples of **incorrect** code for this rule: | ||
|
||
```json | ||
{ | ||
"author": "", | ||
"description": "", | ||
"keywords": [], | ||
"license": "ISC", | ||
"main": "index.js", | ||
"name": "noncompliant-version", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"version": "1.X.0" | ||
} | ||
``` | ||
|
||
Examples of **correct** code for this rule: | ||
|
||
```json | ||
{ | ||
"author": "", | ||
"description": "", | ||
"keywords": [], | ||
"license": "ISC", | ||
"main": "index.js", | ||
"name": "compliant-version", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"version": "1.0.0" | ||
} | ||
``` | ||
|
||
## When Not To Use It | ||
|
||
npm may complain, but it works perfectly with many package files that do not violate spec. | ||
If you don't mind those complaints then you can disable this rule. | ||
|
||
[pjv]: https://github.com/gorillamania/package.json-validator | ||
[npm-spec]: https://docs.npmjs.com/files/package.json |
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
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
src/tests/rules/valid-package-def.test.ts β ...ts/rules/valid-package-definition.test.ts
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