eslint-plugin-package-json 1.0.0-beta.3 β 1.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -0
- package/README.md +93 -93
- package/lib/plugin.mjs +12 -12
- package/lib/rules/order-properties.d.mts +2 -2
- package/lib/rules/order-properties.mjs +3 -35
- package/lib/rules/restrict-top-level-properties.d.mts +39 -0
- package/lib/rules/restrict-top-level-properties.mjs +73 -0
- package/package.json +16 -8
- package/lib/rules/valid-package-definition.d.mts +0 -20
- package/lib/rules/valid-package-definition.mjs +0 -44
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.0.0-beta.5](https://github.com/michaelfaith/eslint-plugin-package-json/compare/v1.0.0-beta.4...v1.0.0-beta.5) (2026-04-28)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### π Features
|
|
7
|
+
|
|
8
|
+
* add `restrict-top-level-properties` rule ([#1736](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1736)) ([8b29974](https://github.com/michaelfaith/eslint-plugin-package-json/commit/8b29974311212d87c47a0efe4176a9f9506aaf00))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### π©Ή Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **valid-dependencies:** dependencies should be able to use disttags ([#1749](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1749)) ([316b253](https://github.com/michaelfaith/eslint-plugin-package-json/commit/316b253a978beee05d4055ed73d614546d33f5cd))
|
|
14
|
+
|
|
15
|
+
## [0.91.2](https://github.com/michaelfaith/eslint-plugin-package-json/compare/v0.91.1...v0.91.2) (2026-04-28)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### π Features
|
|
19
|
+
|
|
20
|
+
* add `restrict-top-level-properties` rule ([#1736](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1736)) ([8b29974](https://github.com/michaelfaith/eslint-plugin-package-json/commit/8b29974311212d87c47a0efe4176a9f9506aaf00))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### π©Ή Bug Fixes
|
|
24
|
+
|
|
25
|
+
* **valid-dependencies:** dependencies should be able to use disttags ([#1749](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1749)) ([316b253](https://github.com/michaelfaith/eslint-plugin-package-json/commit/316b253a978beee05d4055ed73d614546d33f5cd))
|
|
26
|
+
|
|
27
|
+
## [1.0.0-beta.4](https://github.com/michaelfaith/eslint-plugin-package-json/compare/v1.0.0-beta.3...v1.0.0-beta.4) (2026-04-06)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### β BREAKING CHANGES
|
|
31
|
+
|
|
32
|
+
* **order-properties:** remove legacy order option
|
|
33
|
+
* remove `valid-package-definition` rule ([#1707](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1707))
|
|
34
|
+
|
|
35
|
+
### π Features
|
|
36
|
+
|
|
37
|
+
* **order-properties:** remove legacy order option ([935f6dc](https://github.com/michaelfaith/eslint-plugin-package-json/commit/935f6dccccdfe7d61deb43e083647a0a1dc8e953))
|
|
38
|
+
* remove `valid-package-definition` rule ([#1707](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1707)) ([a4a5b86](https://github.com/michaelfaith/eslint-plugin-package-json/commit/a4a5b86e94b1fd41da8b113f49c96a8149e30fa6))
|
|
39
|
+
|
|
3
40
|
## [1.0.0-beta.3](https://github.com/michaelfaith/eslint-plugin-package-json/compare/v1.0.0-beta.2...v1.0.0-beta.3) (2026-04-05)
|
|
4
41
|
|
|
5
42
|
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<p align="center">
|
|
9
9
|
<!-- prettier-ignore-start -->
|
|
10
10
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
11
|
-
<a href="#contributors" target="_blank"><img alt="πͺ All Contributors:
|
|
11
|
+
<a href="#contributors" target="_blank"><img alt="πͺ All Contributors: 42" src="https://img.shields.io/badge/%F0%9F%91%AA_all_contributors-42-21bb42.svg" /></a>
|
|
12
12
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
13
13
|
<!-- prettier-ignore-end -->
|
|
14
14
|
<a href="https://github.com/michaelfaith/eslint-plugin-package-json/blob/main/.github/CODE_OF_CONDUCT.md" target="_blank"><img alt="π€ Code of Conduct: Kept" src="https://img.shields.io/badge/%F0%9F%A4%9D_code_of_conduct-kept-21bb42" /></a>
|
|
@@ -32,96 +32,95 @@ See [Getting Started](https://github.com/michaelfaith/eslint-plugin-package-json
|
|
|
32
32
|
π¦ Set in the `recommended-publishable` configuration.\
|
|
33
33
|
π¨ Set in the `stylistic` configuration.\
|
|
34
34
|
π§ Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).\
|
|
35
|
-
π‘ Manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
|
39
|
-
|
|
|
40
|
-
| [
|
|
41
|
-
| [
|
|
42
|
-
| [no-
|
|
43
|
-
| [no-redundant-
|
|
44
|
-
| [
|
|
45
|
-
| [
|
|
46
|
-
| [
|
|
47
|
-
| [require-
|
|
48
|
-
| [require-
|
|
49
|
-
| [require-
|
|
50
|
-
| [require-
|
|
51
|
-
| [require-
|
|
52
|
-
| [require-
|
|
53
|
-
| [require-
|
|
54
|
-
| [require-
|
|
55
|
-
| [require-
|
|
56
|
-
| [require-
|
|
57
|
-
| [require-
|
|
58
|
-
| [require-
|
|
59
|
-
| [require-
|
|
60
|
-
| [require-
|
|
61
|
-
| [require-
|
|
62
|
-
| [require-
|
|
63
|
-
| [require-
|
|
64
|
-
| [require-
|
|
65
|
-
| [require-
|
|
66
|
-
| [require-
|
|
67
|
-
| [require-
|
|
68
|
-
| [require-
|
|
69
|
-
| [require-
|
|
70
|
-
| [require-
|
|
71
|
-
| [require-
|
|
72
|
-
| [require-
|
|
73
|
-
| [require-
|
|
74
|
-
| [require-
|
|
75
|
-
| [require-
|
|
76
|
-
| [require-
|
|
77
|
-
| [require-
|
|
78
|
-
| [require-
|
|
79
|
-
| [require-
|
|
80
|
-
| [require-
|
|
81
|
-
| [
|
|
82
|
-
| [restrict-
|
|
83
|
-
| [restrict-
|
|
84
|
-
| [scripts-name-casing](docs/rules/scripts-name-casing.md)
|
|
85
|
-
| [sort-collections](docs/rules/sort-collections.md)
|
|
86
|
-
| [specify-peers-locally](docs/rules/specify-peers-locally.md)
|
|
87
|
-
| [unique-dependencies](docs/rules/unique-dependencies.md)
|
|
88
|
-
| [valid-author](docs/rules/valid-author.md)
|
|
89
|
-
| [valid-bin](docs/rules/valid-bin.md)
|
|
90
|
-
| [valid-bugs](docs/rules/valid-bugs.md)
|
|
91
|
-
| [valid-bundleDependencies](docs/rules/valid-bundleDependencies.md)
|
|
92
|
-
| [valid-config](docs/rules/valid-config.md)
|
|
93
|
-
| [valid-contributors](docs/rules/valid-contributors.md)
|
|
94
|
-
| [valid-cpu](docs/rules/valid-cpu.md)
|
|
95
|
-
| [valid-dependencies](docs/rules/valid-dependencies.md)
|
|
96
|
-
| [valid-description](docs/rules/valid-description.md)
|
|
97
|
-
| [valid-devDependencies](docs/rules/valid-devDependencies.md)
|
|
98
|
-
| [valid-devEngines](docs/rules/valid-devEngines.md)
|
|
99
|
-
| [valid-directories](docs/rules/valid-directories.md)
|
|
100
|
-
| [valid-engines](docs/rules/valid-engines.md)
|
|
101
|
-
| [valid-exports](docs/rules/valid-exports.md)
|
|
102
|
-
| [valid-files](docs/rules/valid-files.md)
|
|
103
|
-
| [valid-funding](docs/rules/valid-funding.md)
|
|
104
|
-
| [valid-homepage](docs/rules/valid-homepage.md)
|
|
105
|
-
| [valid-keywords](docs/rules/valid-keywords.md)
|
|
106
|
-
| [valid-license](docs/rules/valid-license.md)
|
|
107
|
-
| [valid-main](docs/rules/valid-main.md)
|
|
108
|
-
| [valid-man](docs/rules/valid-man.md)
|
|
109
|
-
| [valid-module](docs/rules/valid-module.md)
|
|
110
|
-
| [valid-name](docs/rules/valid-name.md)
|
|
111
|
-
| [valid-optionalDependencies](docs/rules/valid-optionalDependencies.md)
|
|
112
|
-
| [valid-os](docs/rules/valid-os.md)
|
|
113
|
-
| [valid-
|
|
114
|
-
| [valid-
|
|
115
|
-
| [valid-
|
|
116
|
-
| [valid-
|
|
117
|
-
| [valid-
|
|
118
|
-
| [valid-repository](docs/rules/valid-repository.md)
|
|
119
|
-
| [valid-
|
|
120
|
-
| [valid-
|
|
121
|
-
| [valid-
|
|
122
|
-
| [valid-
|
|
123
|
-
| [valid-
|
|
124
|
-
| [valid-workspaces](docs/rules/valid-workspaces.md) | Enforce that the `workspaces` property is valid. | β
π¦ | | | |
|
|
35
|
+
π‘ Manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).
|
|
36
|
+
|
|
37
|
+
| NameΒ Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β | Description | πΌ | π§ | π‘ |
|
|
38
|
+
| :--------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--- | :- | :- |
|
|
39
|
+
| [bin-name-casing](docs/rules/bin-name-casing.md) | Enforce that names for bin properties are in kebab case. | π¨ | | π‘ |
|
|
40
|
+
| [exports-subpaths-style](docs/rules/exports-subpaths-style.md) | Enforce consistent format for the exports field (implicit or explicit subpaths). | π¨ | π§ | |
|
|
41
|
+
| [no-empty-fields](docs/rules/no-empty-fields.md) | Reports on unnecessary empty arrays and objects. | β
π¦ | | π‘ |
|
|
42
|
+
| [no-redundant-files](docs/rules/no-redundant-files.md) | Prevents adding unnecessary / redundant files. | β
π¦ | | π‘ |
|
|
43
|
+
| [no-redundant-publishConfig](docs/rules/no-redundant-publishConfig.md) | Warns when publishConfig.access is used in unscoped packages. | β
π¦ | | π‘ |
|
|
44
|
+
| [order-properties](docs/rules/order-properties.md) | Package properties should be declared in standard order | π¨ | π§ | |
|
|
45
|
+
| [repository-shorthand](docs/rules/repository-shorthand.md) | Enforce either object or shorthand declaration for repository. | β
π¦ | π§ | |
|
|
46
|
+
| [require-attribution](docs/rules/require-attribution.md) | Ensures that proper attribution is included, requiring that either `author` or `contributors` is defined, and that if `contributors` is present, it should include at least one contributor. | β
π¦ | | π‘ |
|
|
47
|
+
| [require-author](docs/rules/require-author.md) | Requires the `author` property to be present. | | | |
|
|
48
|
+
| [require-bin](docs/rules/require-bin.md) | Requires the `bin` property to be present. | | | |
|
|
49
|
+
| [require-bugs](docs/rules/require-bugs.md) | Requires the `bugs` property to be present. | | | |
|
|
50
|
+
| [require-bundleDependencies](docs/rules/require-bundleDependencies.md) | Requires the `bundleDependencies` property to be present. | | | |
|
|
51
|
+
| [require-contributors](docs/rules/require-contributors.md) | Requires the `contributors` property to be present. | | | |
|
|
52
|
+
| [require-cpu](docs/rules/require-cpu.md) | Requires the `cpu` property to be present. | | | |
|
|
53
|
+
| [require-dependencies](docs/rules/require-dependencies.md) | Requires the `dependencies` property to be present. | | | |
|
|
54
|
+
| [require-description](docs/rules/require-description.md) | Requires the `description` property to be present. | β
π¦ | | |
|
|
55
|
+
| [require-devDependencies](docs/rules/require-devDependencies.md) | Requires the `devDependencies` property to be present. | | | |
|
|
56
|
+
| [require-devEngines](docs/rules/require-devEngines.md) | Requires the `devEngines` property to be present. | | | |
|
|
57
|
+
| [require-directories](docs/rules/require-directories.md) | Requires the `directories` property to be present. | | | |
|
|
58
|
+
| [require-engines](docs/rules/require-engines.md) | Requires the `engines` property to be present. | | | |
|
|
59
|
+
| [require-exports](docs/rules/require-exports.md) | Requires the `exports` property to be present. | β
π¦ | | |
|
|
60
|
+
| [require-files](docs/rules/require-files.md) | Requires the `files` property to be present. | β
π¦ | | |
|
|
61
|
+
| [require-funding](docs/rules/require-funding.md) | Requires the `funding` property to be present. | | | |
|
|
62
|
+
| [require-homepage](docs/rules/require-homepage.md) | Requires the `homepage` property to be present. | | | |
|
|
63
|
+
| [require-keywords](docs/rules/require-keywords.md) | Requires the `keywords` property to be present. | | | |
|
|
64
|
+
| [require-license](docs/rules/require-license.md) | Requires the `license` property to be present. | β
π¦ | | |
|
|
65
|
+
| [require-main](docs/rules/require-main.md) | Requires the `main` property to be present. | | | |
|
|
66
|
+
| [require-man](docs/rules/require-man.md) | Requires the `man` property to be present. | | | |
|
|
67
|
+
| [require-module](docs/rules/require-module.md) | Requires the `module` property to be present. | | | |
|
|
68
|
+
| [require-name](docs/rules/require-name.md) | Requires the `name` property to be present. | β
π¦ | | |
|
|
69
|
+
| [require-optionalDependencies](docs/rules/require-optionalDependencies.md) | Requires the `optionalDependencies` property to be present. | | | |
|
|
70
|
+
| [require-os](docs/rules/require-os.md) | Requires the `os` property to be present. | | | |
|
|
71
|
+
| [require-packageManager](docs/rules/require-packageManager.md) | Requires the `packageManager` property to be present. | | | |
|
|
72
|
+
| [require-peerDependencies](docs/rules/require-peerDependencies.md) | Requires the `peerDependencies` property to be present. | | | |
|
|
73
|
+
| [require-private](docs/rules/require-private.md) | Requires the `private` property to be present. | | π§ | |
|
|
74
|
+
| [require-publishConfig](docs/rules/require-publishConfig.md) | Requires the `publishConfig` property to be present. | | | |
|
|
75
|
+
| [require-repository](docs/rules/require-repository.md) | Requires the `repository` property to be present. | β
π¦ | | |
|
|
76
|
+
| [require-scripts](docs/rules/require-scripts.md) | Requires the `scripts` property to be present. | | | |
|
|
77
|
+
| [require-sideEffects](docs/rules/require-sideEffects.md) | Requires the `sideEffects` property to be present. | β
π¦ | | |
|
|
78
|
+
| [require-type](docs/rules/require-type.md) | Requires the `type` property to be present. | β
π¦ | π§ | |
|
|
79
|
+
| [require-types](docs/rules/require-types.md) | Requires the `types` property to be present. | | | |
|
|
80
|
+
| [require-version](docs/rules/require-version.md) | Requires the `version` property to be present. | β
π¦ | | |
|
|
81
|
+
| [restrict-dependency-ranges](docs/rules/restrict-dependency-ranges.md) | Restricts the range of dependencies to allow or disallow specific types of ranges. | | | π‘ |
|
|
82
|
+
| [restrict-private-properties](docs/rules/restrict-private-properties.md) | Disallows unnecessary properties in private packages. | | π§ | π‘ |
|
|
83
|
+
| [restrict-top-level-properties](docs/rules/restrict-top-level-properties.md) | Disallows specified top-level properties in package.json. | | | π‘ |
|
|
84
|
+
| [scripts-name-casing](docs/rules/scripts-name-casing.md) | Enforce that names for `scripts` are in kebab case (optionally separated by colons). | π¨ | | π‘ |
|
|
85
|
+
| [sort-collections](docs/rules/sort-collections.md) | Selected collections must be in a consistent order (lexicographical for most; lifecycle-aware for scripts). | β
π¦ | π§ | |
|
|
86
|
+
| [specify-peers-locally](docs/rules/specify-peers-locally.md) | Requires that all peer dependencies are also declared as dev dependencies | β
π¦ | | π‘ |
|
|
87
|
+
| [unique-dependencies](docs/rules/unique-dependencies.md) | Checks a dependency isn't specified more than once (i.e. in `dependencies` and `devDependencies`) | β
π¦ | | π‘ |
|
|
88
|
+
| [valid-author](docs/rules/valid-author.md) | Enforce that the `author` property is valid. | β
π¦ | | |
|
|
89
|
+
| [valid-bin](docs/rules/valid-bin.md) | Enforce that the `bin` property is valid. | β
π¦ | | |
|
|
90
|
+
| [valid-bugs](docs/rules/valid-bugs.md) | Enforce that the `bugs` property is valid. | β
π¦ | | |
|
|
91
|
+
| [valid-bundleDependencies](docs/rules/valid-bundleDependencies.md) | Enforce that the `bundleDependencies` (also: `bundledDependencies`) property is valid. | β
π¦ | | |
|
|
92
|
+
| [valid-config](docs/rules/valid-config.md) | Enforce that the `config` property is valid. | β
π¦ | | |
|
|
93
|
+
| [valid-contributors](docs/rules/valid-contributors.md) | Enforce that the `contributors` property is valid. | β
π¦ | | |
|
|
94
|
+
| [valid-cpu](docs/rules/valid-cpu.md) | Enforce that the `cpu` property is valid. | β
π¦ | | |
|
|
95
|
+
| [valid-dependencies](docs/rules/valid-dependencies.md) | Enforce that the `dependencies` property is valid. | β
π¦ | | |
|
|
96
|
+
| [valid-description](docs/rules/valid-description.md) | Enforce that the `description` property is valid. | β
π¦ | | |
|
|
97
|
+
| [valid-devDependencies](docs/rules/valid-devDependencies.md) | Enforce that the `devDependencies` property is valid. | β
π¦ | | |
|
|
98
|
+
| [valid-devEngines](docs/rules/valid-devEngines.md) | Enforce that the `devEngines` property is valid. | β
π¦ | | |
|
|
99
|
+
| [valid-directories](docs/rules/valid-directories.md) | Enforce that the `directories` property is valid. | β
π¦ | | |
|
|
100
|
+
| [valid-engines](docs/rules/valid-engines.md) | Enforce that the `engines` property is valid. | β
π¦ | | |
|
|
101
|
+
| [valid-exports](docs/rules/valid-exports.md) | Enforce that the `exports` property is valid. | β
π¦ | | |
|
|
102
|
+
| [valid-files](docs/rules/valid-files.md) | Enforce that the `files` property is valid. | β
π¦ | | |
|
|
103
|
+
| [valid-funding](docs/rules/valid-funding.md) | Enforce that the `funding` property is valid. | β
π¦ | | |
|
|
104
|
+
| [valid-homepage](docs/rules/valid-homepage.md) | Enforce that the `homepage` property is valid. | β
π¦ | | |
|
|
105
|
+
| [valid-keywords](docs/rules/valid-keywords.md) | Enforce that the `keywords` property is valid. | β
π¦ | | |
|
|
106
|
+
| [valid-license](docs/rules/valid-license.md) | Enforce that the `license` property is valid. | β
π¦ | | |
|
|
107
|
+
| [valid-main](docs/rules/valid-main.md) | Enforce that the `main` property is valid. | β
π¦ | | |
|
|
108
|
+
| [valid-man](docs/rules/valid-man.md) | Enforce that the `man` property is valid. | β
π¦ | | |
|
|
109
|
+
| [valid-module](docs/rules/valid-module.md) | Enforce that the `module` property is valid. | β
π¦ | | |
|
|
110
|
+
| [valid-name](docs/rules/valid-name.md) | Enforce that package names are valid npm package names | β
π¦ | | |
|
|
111
|
+
| [valid-optionalDependencies](docs/rules/valid-optionalDependencies.md) | Enforce that the `optionalDependencies` property is valid. | β
π¦ | | |
|
|
112
|
+
| [valid-os](docs/rules/valid-os.md) | Enforce that the `os` property is valid. | β
π¦ | | |
|
|
113
|
+
| [valid-packageManager](docs/rules/valid-packageManager.md) | Enforce that the `packageManager` property is valid. | β
π¦ | | |
|
|
114
|
+
| [valid-peerDependencies](docs/rules/valid-peerDependencies.md) | Enforce that the `peerDependencies` property is valid. | β
π¦ | | |
|
|
115
|
+
| [valid-private](docs/rules/valid-private.md) | Enforce that the `private` property is valid. | β
π¦ | | |
|
|
116
|
+
| [valid-publishConfig](docs/rules/valid-publishConfig.md) | Enforce that the `publishConfig` property is valid. | β
π¦ | | |
|
|
117
|
+
| [valid-repository](docs/rules/valid-repository.md) | Enforce that the `repository` property is valid. | β
π¦ | | |
|
|
118
|
+
| [valid-repository-directory](docs/rules/valid-repository-directory.md) | Enforce that if repository directory is specified, it matches the path to the package.json file | β
π¦ | | π‘ |
|
|
119
|
+
| [valid-scripts](docs/rules/valid-scripts.md) | Enforce that the `scripts` property is valid. | β
π¦ | | |
|
|
120
|
+
| [valid-sideEffects](docs/rules/valid-sideEffects.md) | Enforce that the `sideEffects` property is valid. | β
π¦ | | |
|
|
121
|
+
| [valid-type](docs/rules/valid-type.md) | Enforce that the `type` property is valid. | β
π¦ | | |
|
|
122
|
+
| [valid-version](docs/rules/valid-version.md) | Enforce that package versions are valid semver specifiers | β
π¦ | | |
|
|
123
|
+
| [valid-workspaces](docs/rules/valid-workspaces.md) | Enforce that the `workspaces` property is valid. | β
π¦ | | |
|
|
125
124
|
|
|
126
125
|
<!-- end auto-generated rules list -->
|
|
127
126
|
<!-- prettier-ignore-end -->
|
|
@@ -193,7 +192,7 @@ Thanks! π
|
|
|
193
192
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/marcalexiei"><img src="https://avatars.githubusercontent.com/u/24919330?v=4?s=100" width="100px;" alt="Marco Pasqualetti"/><br /><sub><b>Marco Pasqualetti</b></sub></a><br /><a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=marcalexiei" title="Code">π»</a> <a href="#tool-marcalexiei" title="Tools">π§</a> <a href="#maintenance-marcalexiei" title="Maintenance">π§</a></td>
|
|
194
193
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/lo1tuma"><img src="https://avatars.githubusercontent.com/u/169170?v=4?s=100" width="100px;" alt="Mathias Schreck"/><br /><sub><b>Mathias Schreck</b></sub></a><br /><a href="#ideas-lo1tuma" title="Ideas, Planning, & Feedback">π€</a></td>
|
|
195
194
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Cellule"><img src="https://avatars.githubusercontent.com/u/4157103?v=4?s=100" width="100px;" alt="Michael "Mike" Ferris"/><br /><sub><b>Michael "Mike" Ferris</b></sub></a><br /><a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=cellule" title="Code">π»</a></td>
|
|
196
|
-
<td align="center" valign="top" width="14.28%"><a href="https://morrisoncole.co.uk"><img src="https://avatars.githubusercontent.com/u/963368?v=4?s=100" width="100px;" alt="Morrison Cole"/><br /><sub><b>Morrison Cole</b></sub></a><br /><a href="https://github.com/michaelfaith/eslint-plugin-package-json/issues?q=author%3AMorrisonCole" title="Bug reports">π</a></td>
|
|
195
|
+
<td align="center" valign="top" width="14.28%"><a href="https://morrisoncole.co.uk"><img src="https://avatars.githubusercontent.com/u/963368?v=4?s=100" width="100px;" alt="Morrison Cole"/><br /><sub><b>Morrison Cole</b></sub></a><br /><a href="https://github.com/michaelfaith/eslint-plugin-package-json/issues?q=author%3AMorrisonCole" title="Bug reports">π</a> <a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=MorrisonCole" title="Documentation">π</a></td>
|
|
197
196
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/nschonni"><img src="https://avatars.githubusercontent.com/u/1297909?v=4?s=100" width="100px;" alt="Nick Schonning"/><br /><sub><b>Nick Schonning</b></sub></a><br /><a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=nschonni" title="Code">π»</a></td>
|
|
198
197
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/OlivierZal"><img src="https://avatars.githubusercontent.com/u/88216225?v=4?s=100" width="100px;" alt="Olivier Zalmanski"/><br /><sub><b>Olivier Zalmanski</b></sub></a><br /><a href="#maintenance-olivierzal" title="Maintenance">π§</a> <a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=olivierzal" title="Documentation">π</a></td>
|
|
199
198
|
</tr>
|
|
@@ -201,12 +200,13 @@ Thanks! π
|
|
|
201
200
|
<td align="center" valign="top" width="14.28%"><a href="http://patrikcsak.com"><img src="https://avatars.githubusercontent.com/u/4766244?v=4?s=100" width="100px;" alt="Patrik Csak"/><br /><sub><b>Patrik Csak</b></sub></a><br /><a href="https://github.com/michaelfaith/eslint-plugin-package-json/issues?q=author%3Apatrik-csak" title="Bug reports">π</a></td>
|
|
202
201
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/rakleed"><img src="https://avatars.githubusercontent.com/u/19418601?v=4?s=100" width="100px;" alt="Pavel"/><br /><sub><b>Pavel</b></sub></a><br /><a href="#ideas-rakleed" title="Ideas, Planning, & Feedback">π€</a> <a href="#tool-rakleed" title="Tools">π§</a> <a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=rakleed" title="Documentation">π</a> <a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=rakleed" title="Code">π»</a> <a href="https://github.com/michaelfaith/eslint-plugin-package-json/issues?q=author%3Arakleed" title="Bug reports">π</a></td>
|
|
203
202
|
<td align="center" valign="top" width="14.28%"><a href="https://sasial.dev"><img src="https://avatars.githubusercontent.com/u/44125644?v=4?s=100" width="100px;" alt="Sasial"/><br /><sub><b>Sasial</b></sub></a><br /><a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=sasial-dev" title="Code">π»</a></td>
|
|
203
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/belozer"><img src="https://avatars.githubusercontent.com/u/1655916?v=4?s=100" width="100px;" alt="Sergey Belozyorcev"/><br /><sub><b>Sergey Belozyorcev</b></sub></a><br /><a href="#ideas-belozer" title="Ideas, Planning, & Feedback">π€</a></td>
|
|
204
204
|
<td align="center" valign="top" width="14.28%"><a href="https://shayan-zamani.me"><img src="https://avatars.githubusercontent.com/u/81762186?v=4?s=100" width="100px;" alt="Shayan Zamani"/><br /><sub><b>Shayan Zamani</b></sub></a><br /><a href="#ideas-ShayanTheNerd" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=ShayanTheNerd" title="Documentation">π</a> <a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=ShayanTheNerd" title="Code">π»</a></td>
|
|
205
205
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Sigmabrogz"><img src="https://avatars.githubusercontent.com/u/122412346?v=4?s=100" width="100px;" alt="Sigmabro"/><br /><sub><b>Sigmabro</b></sub></a><br /><a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=Sigmabrogz" title="Code">π»</a></td>
|
|
206
206
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/sirugh"><img src="https://avatars.githubusercontent.com/u/1278869?v=4?s=100" width="100px;" alt="Stephen"/><br /><sub><b>Stephen</b></sub></a><br /><a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=sirugh" title="Code">π»</a></td>
|
|
207
|
-
<td align="center" valign="top" width="14.28%"><a href="https://hyoban.cc"><img src="https://avatars.githubusercontent.com/u/38493346?v=4?s=100" width="100px;" alt="Stephen Zhou"/><br /><sub><b>Stephen Zhou</b></sub></a><br /><a href="https://github.com/michaelfaith/eslint-plugin-package-json/issues?q=author%3Ahyoban" title="Bug reports">π</a> <a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=hyoban" title="Code">π»</a> <a href="#ideas-hyoban" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=hyoban" title="Documentation">π</a></td>
|
|
208
207
|
</tr>
|
|
209
208
|
<tr>
|
|
209
|
+
<td align="center" valign="top" width="14.28%"><a href="https://hyoban.cc"><img src="https://avatars.githubusercontent.com/u/38493346?v=4?s=100" width="100px;" alt="Stephen Zhou"/><br /><sub><b>Stephen Zhou</b></sub></a><br /><a href="https://github.com/michaelfaith/eslint-plugin-package-json/issues?q=author%3Ahyoban" title="Bug reports">π</a> <a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=hyoban" title="Code">π»</a> <a href="#ideas-hyoban" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=hyoban" title="Documentation">π</a></td>
|
|
210
210
|
<td align="center" valign="top" width="14.28%"><a href="https://ota-meshi.github.io/"><img src="https://avatars.githubusercontent.com/u/16508807?v=4?s=100" width="100px;" alt="Yosuke Ota"/><br /><sub><b>Yosuke Ota</b></sub></a><br /><a href="https://github.com/michaelfaith/eslint-plugin-package-json/issues?q=author%3Aota-meshi" title="Bug reports">π</a> <a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=ota-meshi" title="Code">π»</a></td>
|
|
211
211
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/b3rnhard"><img src="https://avatars.githubusercontent.com/u/10774404?v=4?s=100" width="100px;" alt="b3rnhard"/><br /><sub><b>b3rnhard</b></sub></a><br /><a href="https://github.com/michaelfaith/eslint-plugin-package-json/issues?q=author%3Ab3rnhard" title="Bug reports">π</a></td>
|
|
212
212
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/chouchouji"><img src="https://avatars.githubusercontent.com/u/70570907?v=4?s=100" width="100px;" alt="chouchouji"/><br /><sub><b>chouchouji</b></sub></a><br /><a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=chouchouji" title="Code">π»</a></td>
|
package/lib/plugin.mjs
CHANGED
|
@@ -9,12 +9,12 @@ import { rule as rule$7 } from "./rules/require-attribution.mjs";
|
|
|
9
9
|
import { rules as rules$1 } from "./rules/require-properties.mjs";
|
|
10
10
|
import { rule as rule$8 } from "./rules/restrict-dependency-ranges.mjs";
|
|
11
11
|
import { rule as rule$9 } from "./rules/restrict-private-properties.mjs";
|
|
12
|
-
import { rule as rule$10 } from "./rules/
|
|
13
|
-
import { rule as rule$11 } from "./rules/
|
|
14
|
-
import { rule as rule$12 } from "./rules/
|
|
15
|
-
import { rule as rule$13 } from "./rules/
|
|
16
|
-
import { rule as rule$14 } from "./rules/
|
|
17
|
-
import { rule as rule$15 } from "./rules/valid-
|
|
12
|
+
import { rule as rule$10 } from "./rules/restrict-top-level-properties.mjs";
|
|
13
|
+
import { rule as rule$11 } from "./rules/scripts-name-casing.mjs";
|
|
14
|
+
import { rule as rule$12 } from "./rules/sort-collections.mjs";
|
|
15
|
+
import { rule as rule$13 } from "./rules/specify-peers-locally.mjs";
|
|
16
|
+
import { rule as rule$14 } from "./rules/unique-dependencies.mjs";
|
|
17
|
+
import { rule as rule$15 } from "./rules/valid-name.mjs";
|
|
18
18
|
import { rules as rules$2 } from "./rules/valid-properties.mjs";
|
|
19
19
|
import { rule as rule$16 } from "./rules/valid-repository-directory.mjs";
|
|
20
20
|
import { rule as rule$17 } from "./rules/valid-version.mjs";
|
|
@@ -34,13 +34,13 @@ const rules = {
|
|
|
34
34
|
"repository-shorthand": rule$6,
|
|
35
35
|
"restrict-dependency-ranges": rule$8,
|
|
36
36
|
"restrict-private-properties": rule$9,
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
37
|
+
"restrict-top-level-properties": rule$10,
|
|
38
|
+
"scripts-name-casing": rule$11,
|
|
39
|
+
"sort-collections": rule$12,
|
|
40
|
+
"specify-peers-locally": rule$13,
|
|
41
|
+
"unique-dependencies": rule$14,
|
|
41
42
|
...rules$2,
|
|
42
|
-
"valid-name": rule$
|
|
43
|
-
"valid-package-definition": rule$15,
|
|
43
|
+
"valid-name": rule$15,
|
|
44
44
|
"valid-repository-directory": rule$16,
|
|
45
45
|
"valid-version": rule$17
|
|
46
46
|
};
|
|
@@ -2,13 +2,13 @@ import { PackageJsonRuleModule } from "../createRule.mjs";
|
|
|
2
2
|
|
|
3
3
|
//#region src/rules/order-properties.d.ts
|
|
4
4
|
declare const rule: PackageJsonRuleModule<[({
|
|
5
|
-
order?: "sort-package-json" |
|
|
5
|
+
order?: "sort-package-json" | string[] | undefined;
|
|
6
6
|
} | undefined)?], [{
|
|
7
7
|
readonly additionalProperties: false;
|
|
8
8
|
readonly properties: {
|
|
9
9
|
readonly order: {
|
|
10
10
|
readonly anyOf: readonly [{
|
|
11
|
-
readonly enum: readonly ["
|
|
11
|
+
readonly enum: readonly ["sort-package-json"];
|
|
12
12
|
readonly type: readonly ["string"];
|
|
13
13
|
}, {
|
|
14
14
|
readonly items: {
|
|
@@ -4,44 +4,12 @@ import { detectNewlineGraceful } from "detect-newline";
|
|
|
4
4
|
import sortObjectKeys from "sort-object-keys";
|
|
5
5
|
import { sortOrder } from "sort-package-json";
|
|
6
6
|
//#region src/rules/order-properties.ts
|
|
7
|
-
const standardOrderLegacy = [
|
|
8
|
-
"name",
|
|
9
|
-
"version",
|
|
10
|
-
"private",
|
|
11
|
-
"publishConfig",
|
|
12
|
-
"description",
|
|
13
|
-
"main",
|
|
14
|
-
"exports",
|
|
15
|
-
"browser",
|
|
16
|
-
"files",
|
|
17
|
-
"bin",
|
|
18
|
-
"directories",
|
|
19
|
-
"man",
|
|
20
|
-
"scripts",
|
|
21
|
-
"repository",
|
|
22
|
-
"keywords",
|
|
23
|
-
"author",
|
|
24
|
-
"license",
|
|
25
|
-
"bugs",
|
|
26
|
-
"homepage",
|
|
27
|
-
"config",
|
|
28
|
-
"dependencies",
|
|
29
|
-
"devDependencies",
|
|
30
|
-
"peerDependencies",
|
|
31
|
-
"optionalDependencies",
|
|
32
|
-
"bundledDependencies",
|
|
33
|
-
"engines",
|
|
34
|
-
"os",
|
|
35
|
-
"cpu"
|
|
36
|
-
];
|
|
37
7
|
const rule = createRule({
|
|
38
8
|
create(context) {
|
|
39
9
|
return { "Program:exit"() {
|
|
40
10
|
const { ast, text } = context.sourceCode;
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
const { order } = options;
|
|
44
|
-
const requiredOrder = order === "legacy" ? standardOrderLegacy : order === "sort-package-json" ? sortOrder : order;
|
|
11
|
+
const { order = "sort-package-json" } = context.options[0] ?? {};
|
|
12
|
+
const requiredOrder = order === "sort-package-json" ? sortOrder : order;
|
|
45
13
|
const json = JSON.parse(text);
|
|
46
14
|
const orderedNonStandardKeys = Object.keys(json).filter((key) => !requiredOrder.includes(key)).sort();
|
|
47
15
|
const orderedSource = sortObjectKeys(json, [...requiredOrder, ...orderedNonStandardKeys]);
|
|
@@ -78,7 +46,7 @@ const rule = createRule({
|
|
|
78
46
|
additionalProperties: false,
|
|
79
47
|
properties: { order: {
|
|
80
48
|
anyOf: [{
|
|
81
|
-
enum: ["
|
|
49
|
+
enum: ["sort-package-json"],
|
|
82
50
|
type: ["string"]
|
|
83
51
|
}, {
|
|
84
52
|
items: { type: ["string"] },
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { PackageJsonRuleModule } from "../createRule.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/rules/restrict-top-level-properties.d.ts
|
|
4
|
+
declare const rule: PackageJsonRuleModule<[({
|
|
5
|
+
ban?: (string | {
|
|
6
|
+
message?: string | undefined;
|
|
7
|
+
property: string;
|
|
8
|
+
})[] | undefined;
|
|
9
|
+
} | undefined)?], [{
|
|
10
|
+
readonly additionalProperties: false;
|
|
11
|
+
readonly properties: {
|
|
12
|
+
readonly ban: {
|
|
13
|
+
readonly description: "List of top-level properties to ban. Each entry can be a property name string or an object with a property name and an optional custom message.";
|
|
14
|
+
readonly items: {
|
|
15
|
+
readonly oneOf: readonly [{
|
|
16
|
+
readonly type: "string";
|
|
17
|
+
}, {
|
|
18
|
+
readonly additionalProperties: false;
|
|
19
|
+
readonly properties: {
|
|
20
|
+
readonly message: {
|
|
21
|
+
readonly description: "Custom message to append to the error report.";
|
|
22
|
+
readonly type: "string";
|
|
23
|
+
};
|
|
24
|
+
readonly property: {
|
|
25
|
+
readonly description: "The top-level property name to ban.";
|
|
26
|
+
readonly type: "string";
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
readonly required: readonly ["property"];
|
|
30
|
+
readonly type: "object";
|
|
31
|
+
}];
|
|
32
|
+
};
|
|
33
|
+
readonly type: "array";
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
readonly type: "object";
|
|
37
|
+
}]>;
|
|
38
|
+
//#endregion
|
|
39
|
+
export { rule };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { createRule } from "../createRule.mjs";
|
|
2
|
+
import { isJSONStringLiteral } from "../utils/predicates.mjs";
|
|
3
|
+
import { fixRemoveObjectProperty } from "eslint-fix-utils";
|
|
4
|
+
//#region src/rules/restrict-top-level-properties.ts
|
|
5
|
+
const rule = createRule({
|
|
6
|
+
create(context) {
|
|
7
|
+
const banList = Object.fromEntries(
|
|
8
|
+
/* v8 ignore next - not possible to cover due to presence of `defaultOptions` */
|
|
9
|
+
(context.options[0]?.ban ?? []).map((entry) => typeof entry === "string" ? [entry, ""] : [entry.property, entry.message ?? ""])
|
|
10
|
+
);
|
|
11
|
+
return { "Program > JSONExpressionStatement > JSONObjectExpression"(node) {
|
|
12
|
+
for (const property of node.properties) {
|
|
13
|
+
if (!isJSONStringLiteral(property.key)) continue;
|
|
14
|
+
const propertyName = property.key.value;
|
|
15
|
+
if (Object.hasOwn(banList, propertyName)) {
|
|
16
|
+
const customMessage = banList[propertyName];
|
|
17
|
+
context.report({
|
|
18
|
+
data: {
|
|
19
|
+
customMessage: customMessage ? `: ${customMessage}` : "",
|
|
20
|
+
property: propertyName
|
|
21
|
+
},
|
|
22
|
+
messageId: "bannedProperty",
|
|
23
|
+
node: property.key,
|
|
24
|
+
suggest: [{
|
|
25
|
+
fix: fixRemoveObjectProperty(context, property),
|
|
26
|
+
messageId: "removePropertySuggestion"
|
|
27
|
+
}]
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
} };
|
|
32
|
+
},
|
|
33
|
+
meta: {
|
|
34
|
+
defaultOptions: [{ ban: [] }],
|
|
35
|
+
docs: {
|
|
36
|
+
category: "Best Practices",
|
|
37
|
+
description: "Disallows specified top-level properties in package.json.",
|
|
38
|
+
recommended: false
|
|
39
|
+
},
|
|
40
|
+
hasSuggestions: true,
|
|
41
|
+
messages: {
|
|
42
|
+
bannedProperty: "The `{{ property }}` property is not allowed{{ customMessage }}",
|
|
43
|
+
removePropertySuggestion: "Remove the property."
|
|
44
|
+
},
|
|
45
|
+
schema: [{
|
|
46
|
+
additionalProperties: false,
|
|
47
|
+
properties: { ban: {
|
|
48
|
+
description: "List of top-level properties to ban. Each entry can be a property name string or an object with a property name and an optional custom message.",
|
|
49
|
+
items: { oneOf: [{ type: "string" }, {
|
|
50
|
+
additionalProperties: false,
|
|
51
|
+
properties: {
|
|
52
|
+
message: {
|
|
53
|
+
description: "Custom message to append to the error report.",
|
|
54
|
+
type: "string"
|
|
55
|
+
},
|
|
56
|
+
property: {
|
|
57
|
+
description: "The top-level property name to ban.",
|
|
58
|
+
type: "string"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
required: ["property"],
|
|
62
|
+
type: "object"
|
|
63
|
+
}] },
|
|
64
|
+
type: "array"
|
|
65
|
+
} },
|
|
66
|
+
type: "object"
|
|
67
|
+
}],
|
|
68
|
+
type: "suggestion"
|
|
69
|
+
},
|
|
70
|
+
name: "restrict-top-level-properties"
|
|
71
|
+
});
|
|
72
|
+
//#endregion
|
|
73
|
+
export { rule };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-package-json",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.5",
|
|
4
4
|
"description": "Rules for consistent, readable, and valid package.json files. ποΈ",
|
|
5
5
|
"homepage": "https://github.com/michaelfaith/eslint-plugin-package-json#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -50,13 +50,15 @@
|
|
|
50
50
|
"detect-newline": "^4.0.1",
|
|
51
51
|
"eslint-fix-utils": "~0.4.1",
|
|
52
52
|
"jsonc-eslint-parser": "^3.1.0",
|
|
53
|
-
"package-json-validator": "^1.
|
|
53
|
+
"package-json-validator": "^1.4.1",
|
|
54
54
|
"semver": "^7.7.3",
|
|
55
55
|
"sort-object-keys": "^2.0.0",
|
|
56
56
|
"sort-package-json": "^3.4.0",
|
|
57
57
|
"validate-npm-package-name": "^7.0.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
+
"@astrojs/starlight": "0.38.3",
|
|
61
|
+
"@catppuccin/starlight": "2.0.1",
|
|
60
62
|
"@eslint-community/eslint-plugin-eslint-comments": "4.7.0",
|
|
61
63
|
"@eslint/js": "10.0.1",
|
|
62
64
|
"@eslint/markdown": "8.0.1",
|
|
@@ -66,31 +68,33 @@
|
|
|
66
68
|
"@types/validate-npm-package-name": "4.0.2",
|
|
67
69
|
"@vitest/coverage-v8": "4.1.0",
|
|
68
70
|
"@vitest/eslint-plugin": "1.6.1",
|
|
71
|
+
"astro": "6.1.8",
|
|
69
72
|
"console-fail-test": "0.6.0",
|
|
70
|
-
"eslint": "10.
|
|
73
|
+
"eslint": "10.2.0",
|
|
71
74
|
"eslint-doc-generator": "3.3.1",
|
|
72
75
|
"eslint-plugin-eslint-plugin": "7.3.1",
|
|
73
76
|
"eslint-plugin-jsdoc": "62.9.0",
|
|
74
77
|
"eslint-plugin-jsonc": "3.1.0",
|
|
75
78
|
"eslint-plugin-n": "17.24.0",
|
|
76
79
|
"eslint-plugin-node-dependencies": "2.2.0",
|
|
77
|
-
"eslint-plugin-perfectionist": "5.
|
|
80
|
+
"eslint-plugin-perfectionist": "5.9.0",
|
|
78
81
|
"eslint-plugin-regexp": "3.1.0",
|
|
79
82
|
"eslint-plugin-unicorn": "64.0.0",
|
|
80
83
|
"eslint-plugin-yml": "3.3.0",
|
|
81
84
|
"husky": "9.1.7",
|
|
82
85
|
"jiti": "2.6.1",
|
|
83
86
|
"json-schema-to-ts": "3.1.1",
|
|
84
|
-
"knip": "6.
|
|
87
|
+
"knip": "6.6.0",
|
|
85
88
|
"lint-staged": "16.4.0",
|
|
86
89
|
"prettier": "3.8.0",
|
|
87
90
|
"prettier-plugin-curly": "0.4.0",
|
|
88
91
|
"prettier-plugin-packagejson": "3.0.0",
|
|
89
92
|
"prettier-plugin-sentences-per-line": "0.2.3",
|
|
90
93
|
"prettier-plugin-sh": "0.18.0",
|
|
94
|
+
"sharp": "0.34.5",
|
|
91
95
|
"tsdown": "0.21.0",
|
|
92
96
|
"typescript": "6.0.2",
|
|
93
|
-
"typescript-eslint": "8.
|
|
97
|
+
"typescript-eslint": "8.59.0",
|
|
94
98
|
"vitest": "4.1.0"
|
|
95
99
|
},
|
|
96
100
|
"peerDependencies": {
|
|
@@ -101,11 +105,15 @@
|
|
|
101
105
|
},
|
|
102
106
|
"scripts": {
|
|
103
107
|
"build": "tsdown",
|
|
104
|
-
"
|
|
108
|
+
"docs:generate": "pnpm build --no-dts && eslint-doc-generator",
|
|
105
109
|
"format": "prettier .",
|
|
106
110
|
"lint": "eslint . --max-warnings 0",
|
|
107
|
-
"lint:docs": "eslint-doc-generator --check",
|
|
108
111
|
"lint:knip": "knip",
|
|
112
|
+
"site:build": "astro build",
|
|
113
|
+
"site:dev": "astro dev",
|
|
114
|
+
"site:preview": "astro preview",
|
|
115
|
+
"site:sync": "astro sync",
|
|
116
|
+
"site:typecheck": "pnpm site:sync && tsc --project site/tsconfig.json",
|
|
109
117
|
"test": "vitest",
|
|
110
118
|
"typecheck": "tsc"
|
|
111
119
|
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { PackageJsonRuleModule } from "../createRule.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/rules/valid-package-definition.d.ts
|
|
4
|
-
declare const rule: PackageJsonRuleModule<[({
|
|
5
|
-
ignoreProperties?: string[] | undefined;
|
|
6
|
-
} | undefined)?], [{
|
|
7
|
-
readonly additionalProperties: false;
|
|
8
|
-
readonly properties: {
|
|
9
|
-
readonly ignoreProperties: {
|
|
10
|
-
readonly description: "Array of top-level package properties to ignore.";
|
|
11
|
-
readonly items: {
|
|
12
|
-
readonly type: "string";
|
|
13
|
-
};
|
|
14
|
-
readonly type: "array";
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
readonly type: "object";
|
|
18
|
-
}]>;
|
|
19
|
-
//#endregion
|
|
20
|
-
export { rule };
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { createRule } from "../createRule.mjs";
|
|
2
|
-
import { validate } from "package-json-validator";
|
|
3
|
-
//#region src/rules/valid-package-definition.ts
|
|
4
|
-
const ignoredErrors = [
|
|
5
|
-
/^Url not valid/i,
|
|
6
|
-
/^Invalid version range for .+?: file:/i,
|
|
7
|
-
/^author field should have name/i
|
|
8
|
-
];
|
|
9
|
-
const isUsableError = (errorText) => ignoredErrors.every((pattern) => !pattern.test(errorText));
|
|
10
|
-
const rule = createRule({
|
|
11
|
-
create(context) {
|
|
12
|
-
const ignoreProperties = context.options[0]?.ignoreProperties ?? [];
|
|
13
|
-
return { "Program:exit"() {
|
|
14
|
-
const usableErrors = validate(context.sourceCode.text).errors?.filter((error) => {
|
|
15
|
-
return isUsableError(error.message) && !ignoreProperties.includes(error.field);
|
|
16
|
-
}) ?? [];
|
|
17
|
-
for (const error of usableErrors) if (error.message) context.report({
|
|
18
|
-
message: error.message,
|
|
19
|
-
node: context.sourceCode.ast
|
|
20
|
-
});
|
|
21
|
-
} };
|
|
22
|
-
},
|
|
23
|
-
meta: {
|
|
24
|
-
defaultOptions: [{ ignoreProperties: [] }],
|
|
25
|
-
deprecated: true,
|
|
26
|
-
docs: {
|
|
27
|
-
category: "Best Practices",
|
|
28
|
-
description: "Enforce that package.json has all properties required by the npm spec"
|
|
29
|
-
},
|
|
30
|
-
schema: [{
|
|
31
|
-
additionalProperties: false,
|
|
32
|
-
properties: { ignoreProperties: {
|
|
33
|
-
description: "Array of top-level package properties to ignore.",
|
|
34
|
-
items: { type: "string" },
|
|
35
|
-
type: "array"
|
|
36
|
-
} },
|
|
37
|
-
type: "object"
|
|
38
|
-
}],
|
|
39
|
-
type: "problem"
|
|
40
|
-
},
|
|
41
|
-
name: "valid-package-definition"
|
|
42
|
-
});
|
|
43
|
-
//#endregion
|
|
44
|
-
export { rule };
|