eslint-plugin-package-json 1.1.0 โ 1.3.0
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/README.md +100 -79
- package/lib/experimental/index.d.mts +34 -0
- package/lib/experimental/index.mjs +7 -0
- package/lib/experimental/plugin.d.mts +40 -0
- package/lib/experimental/plugin.mjs +32 -0
- package/lib/plugin.mjs +30 -28
- package/lib/rules/no-local-dependencies.d.mts +17 -0
- package/lib/rules/no-local-dependencies.mjs +47 -0
- package/lib/rules/valid-repository-directory.mjs +15 -11
- package/package.json +20 -10
- package/CHANGELOG.md +0 -1443
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<p align="center">
|
|
16
16
|
<!-- prettier-ignore-start -->
|
|
17
17
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
18
|
-
<a href="#contributors" target="_blank"><img alt="๐ช All Contributors:
|
|
18
|
+
<a href="#contributors" target="_blank"><img alt="๐ช All Contributors: 43" src="https://img.shields.io/badge/%F0%9F%91%AA_all_contributors-43-21bb42.svg" /></a>
|
|
19
19
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
20
20
|
<!-- prettier-ignore-end -->
|
|
21
21
|
<a href="https://codecov.io/gh/michaelfaith/eslint-plugin-package-json" target="_blank"><img alt="๐งช Coverage" src="https://img.shields.io/codecov/c/github/michaelfaith/eslint-plugin-package-json?label=%F0%9F%A7%AA%20coverage" /></a>
|
|
@@ -43,50 +43,12 @@ See [Getting Started](https://eslint-plugin-package-json.dev/getting-started) fo
|
|
|
43
43
|
| [bin-name-casing](https://eslint-plugin-package-json.dev/rules/bin-name-casing) | Enforce that names for bin properties are in kebab case. | ๐จ | | ๐ก |
|
|
44
44
|
| [exports-subpaths-style](https://eslint-plugin-package-json.dev/rules/exports-subpaths-style) | Enforce consistent format for the exports field (implicit or explicit subpaths). | ๐จ | ๐ง | |
|
|
45
45
|
| [no-empty-fields](https://eslint-plugin-package-json.dev/rules/no-empty-fields) | Reports on unnecessary empty arrays and objects. | โ
๐ฆ | | ๐ก |
|
|
46
|
+
| [no-local-dependencies](https://eslint-plugin-package-json.dev/rules/no-local-dependencies) | Requires that dependencies do not use local file paths, which will likely result in errors when installing from a registry. | | | |
|
|
46
47
|
| [no-redundant-files](https://eslint-plugin-package-json.dev/rules/no-redundant-files) | Prevents adding unnecessary / redundant files. | โ
๐ฆ | | ๐ก |
|
|
47
48
|
| [no-redundant-publishConfig](https://eslint-plugin-package-json.dev/rules/no-redundant-publishConfig) | Warns when publishConfig.access is used in unscoped packages. | โ
๐ฆ | | ๐ก |
|
|
48
49
|
| [order-properties](https://eslint-plugin-package-json.dev/rules/order-properties) | Package properties should be declared in standard order | ๐จ | ๐ง | |
|
|
49
50
|
| [repository-shorthand](https://eslint-plugin-package-json.dev/rules/repository-shorthand) | Enforce either object or shorthand declaration for repository. | โ
๐ฆ | ๐ง | |
|
|
50
51
|
| [require-attribution](https://eslint-plugin-package-json.dev/rules/require-attribution) | 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. | โ
๐ฆ | | ๐ก |
|
|
51
|
-
| [require-author](https://eslint-plugin-package-json.dev/rules/require-properties/require-author) | Requires the `author` property to be present. | | | |
|
|
52
|
-
| [require-bin](https://eslint-plugin-package-json.dev/rules/require-properties/require-bin) | Requires the `bin` property to be present. | | | |
|
|
53
|
-
| [require-browser](https://eslint-plugin-package-json.dev/rules/require-properties/require-browser) | Requires the `browser` property to be present. | | | |
|
|
54
|
-
| [require-bugs](https://eslint-plugin-package-json.dev/rules/require-properties/require-bugs) | Requires the `bugs` property to be present. | | | |
|
|
55
|
-
| [require-bundleDependencies](https://eslint-plugin-package-json.dev/rules/require-properties/require-bundleDependencies) | Requires the `bundleDependencies` property to be present. | | | |
|
|
56
|
-
| [require-config](https://eslint-plugin-package-json.dev/rules/require-properties/require-config) | Requires the `config` property to be present. | | | |
|
|
57
|
-
| [require-contributors](https://eslint-plugin-package-json.dev/rules/require-properties/require-contributors) | Requires the `contributors` property to be present. | | | |
|
|
58
|
-
| [require-cpu](https://eslint-plugin-package-json.dev/rules/require-properties/require-cpu) | Requires the `cpu` property to be present. | | | |
|
|
59
|
-
| [require-dependencies](https://eslint-plugin-package-json.dev/rules/require-properties/require-dependencies) | Requires the `dependencies` property to be present. | | | |
|
|
60
|
-
| [require-description](https://eslint-plugin-package-json.dev/rules/require-properties/require-description) | Requires the `description` property to be present. | โ
๐ฆ | | |
|
|
61
|
-
| [require-devDependencies](https://eslint-plugin-package-json.dev/rules/require-properties/require-devDependencies) | Requires the `devDependencies` property to be present. | | | |
|
|
62
|
-
| [require-devEngines](https://eslint-plugin-package-json.dev/rules/require-properties/require-devEngines) | Requires the `devEngines` property to be present. | | | |
|
|
63
|
-
| [require-directories](https://eslint-plugin-package-json.dev/rules/require-properties/require-directories) | Requires the `directories` property to be present. | | | |
|
|
64
|
-
| [require-engines](https://eslint-plugin-package-json.dev/rules/require-properties/require-engines) | Requires the `engines` property to be present. | | | |
|
|
65
|
-
| [require-exports](https://eslint-plugin-package-json.dev/rules/require-properties/require-exports) | Requires the `exports` property to be present. | โ
๐ฆ | | |
|
|
66
|
-
| [require-files](https://eslint-plugin-package-json.dev/rules/require-properties/require-files) | Requires the `files` property to be present. | โ
๐ฆ | | |
|
|
67
|
-
| [require-funding](https://eslint-plugin-package-json.dev/rules/require-properties/require-funding) | Requires the `funding` property to be present. | | | |
|
|
68
|
-
| [require-gypfile](https://eslint-plugin-package-json.dev/rules/require-properties/require-gypfile) | Requires the `gypfile` property to be present. | | | |
|
|
69
|
-
| [require-homepage](https://eslint-plugin-package-json.dev/rules/require-properties/require-homepage) | Requires the `homepage` property to be present. | | | |
|
|
70
|
-
| [require-keywords](https://eslint-plugin-package-json.dev/rules/require-properties/require-keywords) | Requires the `keywords` property to be present. | | | |
|
|
71
|
-
| [require-libc](https://eslint-plugin-package-json.dev/rules/require-properties/require-libc) | Requires the `libc` property to be present. | | | |
|
|
72
|
-
| [require-license](https://eslint-plugin-package-json.dev/rules/require-properties/require-license) | Requires the `license` property to be present. | โ
๐ฆ | | |
|
|
73
|
-
| [require-main](https://eslint-plugin-package-json.dev/rules/require-properties/require-main) | Requires the `main` property to be present. | | | |
|
|
74
|
-
| [require-man](https://eslint-plugin-package-json.dev/rules/require-properties/require-man) | Requires the `man` property to be present. | | | |
|
|
75
|
-
| [require-module](https://eslint-plugin-package-json.dev/rules/require-properties/require-module) | Requires the `module` property to be present. | | | |
|
|
76
|
-
| [require-name](https://eslint-plugin-package-json.dev/rules/require-properties/require-name) | Requires the `name` property to be present. | โ
๐ฆ | | |
|
|
77
|
-
| [require-optionalDependencies](https://eslint-plugin-package-json.dev/rules/require-properties/require-optionalDependencies) | Requires the `optionalDependencies` property to be present. | | | |
|
|
78
|
-
| [require-os](https://eslint-plugin-package-json.dev/rules/require-properties/require-os) | Requires the `os` property to be present. | | | |
|
|
79
|
-
| [require-packageManager](https://eslint-plugin-package-json.dev/rules/require-properties/require-packageManager) | Requires the `packageManager` property to be present. | | | |
|
|
80
|
-
| [require-peerDependencies](https://eslint-plugin-package-json.dev/rules/require-properties/require-peerDependencies) | Requires the `peerDependencies` property to be present. | | | |
|
|
81
|
-
| [require-peerDependenciesMeta](https://eslint-plugin-package-json.dev/rules/require-properties/require-peerDependenciesMeta) | Requires the `peerDependenciesMeta` property to be present. | | | |
|
|
82
|
-
| [require-private](https://eslint-plugin-package-json.dev/rules/require-properties/require-private) | Requires the `private` property to be present. | | ๐ง | |
|
|
83
|
-
| [require-publishConfig](https://eslint-plugin-package-json.dev/rules/require-properties/require-publishConfig) | Requires the `publishConfig` property to be present. | | | |
|
|
84
|
-
| [require-repository](https://eslint-plugin-package-json.dev/rules/require-properties/require-repository) | Requires the `repository` property to be present. | โ
๐ฆ | | |
|
|
85
|
-
| [require-scripts](https://eslint-plugin-package-json.dev/rules/require-properties/require-scripts) | Requires the `scripts` property to be present. | | | |
|
|
86
|
-
| [require-sideEffects](https://eslint-plugin-package-json.dev/rules/require-properties/require-sideEffects) | Requires the `sideEffects` property to be present. | โ
๐ฆ | | |
|
|
87
|
-
| [require-type](https://eslint-plugin-package-json.dev/rules/require-properties/require-type) | Requires the `type` property to be present. | โ
๐ฆ | ๐ง | |
|
|
88
|
-
| [require-types](https://eslint-plugin-package-json.dev/rules/require-properties/require-types) | Requires the `types` property to be present. | | | |
|
|
89
|
-
| [require-version](https://eslint-plugin-package-json.dev/rules/require-properties/require-version) | Requires the `version` property to be present. | โ
๐ฆ | | |
|
|
90
52
|
| [restrict-dependency-ranges](https://eslint-plugin-package-json.dev/rules/restrict-dependency-ranges) | Restricts the range of dependencies to allow or disallow specific types of ranges. | | | ๐ก |
|
|
91
53
|
| [restrict-private-properties](https://eslint-plugin-package-json.dev/rules/restrict-private-properties) | Disallows unnecessary properties in private packages. | | ๐ง | ๐ก |
|
|
92
54
|
| [restrict-top-level-properties](https://eslint-plugin-package-json.dev/rules/restrict-top-level-properties) | Disallows specified top-level properties in package.json. | | | ๐ก |
|
|
@@ -94,47 +56,100 @@ See [Getting Started](https://eslint-plugin-package-json.dev/getting-started) fo
|
|
|
94
56
|
| [sort-collections](https://eslint-plugin-package-json.dev/rules/sort-collections) | Selected collections must be in a consistent order (lexicographical for most; lifecycle-aware for scripts). | โ
๐ฆ | ๐ง | |
|
|
95
57
|
| [specify-peers-locally](https://eslint-plugin-package-json.dev/rules/specify-peers-locally) | Requires that all peer dependencies are also declared as dev dependencies | โ
๐ฆ | | ๐ก |
|
|
96
58
|
| [unique-dependencies](https://eslint-plugin-package-json.dev/rules/unique-dependencies) | Checks a dependency isn't specified more than once (i.e. in `dependencies` and `devDependencies`) | โ
๐ฆ | | ๐ก |
|
|
97
|
-
| [valid-author](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-author) | Enforce that the `author` property is valid. | โ
๐ฆ | | |
|
|
98
|
-
| [valid-bin](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-bin) | Enforce that the `bin` property is valid. | โ
๐ฆ | | |
|
|
99
|
-
| [valid-browser](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-browser) | Enforce that the `browser` property is valid. | โ
๐ฆ | | |
|
|
100
|
-
| [valid-bugs](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-bugs) | Enforce that the `bugs` property is valid. | โ
๐ฆ | | |
|
|
101
|
-
| [valid-bundleDependencies](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-bundleDependencies) | Enforce that the `bundleDependencies` (also `bundledDependencies`) property is valid. | โ
๐ฆ | | |
|
|
102
|
-
| [valid-config](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-config) | Enforce that the `config` property is valid. | โ
๐ฆ | | |
|
|
103
|
-
| [valid-contributors](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-contributors) | Enforce that the `contributors` property is valid. | โ
๐ฆ | | |
|
|
104
|
-
| [valid-cpu](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-cpu) | Enforce that the `cpu` property is valid. | โ
๐ฆ | | |
|
|
105
|
-
| [valid-dependencies](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-dependencies) | Enforce that the `dependencies` property is valid. | โ
๐ฆ | | |
|
|
106
|
-
| [valid-description](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-description) | Enforce that the `description` property is valid. | โ
๐ฆ | | |
|
|
107
|
-
| [valid-devDependencies](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-devDependencies) | Enforce that the `devDependencies` property is valid. | โ
๐ฆ | | |
|
|
108
|
-
| [valid-devEngines](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-devEngines) | Enforce that the `devEngines` property is valid. | โ
๐ฆ | | |
|
|
109
|
-
| [valid-directories](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-directories) | Enforce that the `directories` property is valid. | โ
๐ฆ | | |
|
|
110
|
-
| [valid-engines](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-engines) | Enforce that the `engines` property is valid. | โ
๐ฆ | | |
|
|
111
|
-
| [valid-exports](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-exports) | Enforce that the `exports` property is valid. | โ
๐ฆ | | |
|
|
112
|
-
| [valid-files](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-files) | Enforce that the `files` property is valid. | โ
๐ฆ | | |
|
|
113
|
-
| [valid-funding](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-funding) | Enforce that the `funding` property is valid. | โ
๐ฆ | | |
|
|
114
|
-
| [valid-gypfile](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-gypfile) | Enforce that the `gypfile` property is valid. | โ
๐ฆ | | |
|
|
115
|
-
| [valid-homepage](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-homepage) | Enforce that the `homepage` property is valid. | โ
๐ฆ | | |
|
|
116
|
-
| [valid-keywords](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-keywords) | Enforce that the `keywords` property is valid. | โ
๐ฆ | | |
|
|
117
|
-
| [valid-libc](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-libc) | Enforce that the `libc` property is valid. | โ
๐ฆ | | |
|
|
118
|
-
| [valid-license](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-license) | Enforce that the `license` property is valid. | โ
๐ฆ | | |
|
|
119
|
-
| [valid-main](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-main) | Enforce that the `main` property is valid. | โ
๐ฆ | | |
|
|
120
|
-
| [valid-man](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-man) | Enforce that the `man` property is valid. | โ
๐ฆ | | |
|
|
121
|
-
| [valid-module](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-module) | Enforce that the `module` property is valid. | โ
๐ฆ | | |
|
|
122
|
-
| [valid-name](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-name) | Enforce that the `name` property is valid. | โ
๐ฆ | | |
|
|
123
|
-
| [valid-optionalDependencies](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-optionalDependencies) | Enforce that the `optionalDependencies` property is valid. | โ
๐ฆ | | |
|
|
124
|
-
| [valid-os](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-os) | Enforce that the `os` property is valid. | โ
๐ฆ | | |
|
|
125
|
-
| [valid-packageManager](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-packageManager) | Enforce that the `packageManager` property is valid. | โ
๐ฆ | | |
|
|
126
|
-
| [valid-peerDependencies](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-peerDependencies) | Enforce that the `peerDependencies` property is valid. | โ
๐ฆ | | |
|
|
127
|
-
| [valid-peerDependenciesMeta](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-peerDependenciesMeta) | Enforce that the `peerDependenciesMeta` property is valid. | โ
๐ฆ | | |
|
|
128
59
|
| [valid-peerDependenciesMeta-relationship](https://eslint-plugin-package-json.dev/rules/valid-peerDependenciesMeta-relationship) | Enforces that any dependencies declared in `peerDependenciesMeta` are also defined in the package's `peerDependencies`. | โ
๐ฆ | | ๐ก |
|
|
129
|
-
| [valid-private](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-private) | Enforce that the `private` property is valid. | โ
๐ฆ | | |
|
|
130
|
-
| [valid-publishConfig](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-publishConfig) | Enforce that the `publishConfig` property is valid. | โ
๐ฆ | | |
|
|
131
|
-
| [valid-repository](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-repository) | Enforce that the `repository` property is valid. | โ
๐ฆ | | |
|
|
132
60
|
| [valid-repository-directory](https://eslint-plugin-package-json.dev/rules/valid-repository-directory) | Enforce that if repository directory is specified, it matches the path to the package.json file | โ
๐ฆ | | ๐ก |
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
61
|
+
|
|
62
|
+
### Require Properties
|
|
63
|
+
|
|
64
|
+
This group of rules allows you to require that the associated top-level property must be present in the `package.json`.
|
|
65
|
+
|
|
66
|
+
| Name | Description | ๐ผ | ๐ง | ๐ก |
|
|
67
|
+
| :--------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------- | :---- | :-- | :-- |
|
|
68
|
+
| [require-author](https://eslint-plugin-package-json.dev/rules/require-properties/require-author) | Requires the `author` property to be present. | | | |
|
|
69
|
+
| [require-bin](https://eslint-plugin-package-json.dev/rules/require-properties/require-bin) | Requires the `bin` property to be present. | | | |
|
|
70
|
+
| [require-browser](https://eslint-plugin-package-json.dev/rules/require-properties/require-browser) | Requires the `browser` property to be present. | | | |
|
|
71
|
+
| [require-bugs](https://eslint-plugin-package-json.dev/rules/require-properties/require-bugs) | Requires the `bugs` property to be present. | | | |
|
|
72
|
+
| [require-bundleDependencies](https://eslint-plugin-package-json.dev/rules/require-properties/require-bundleDependencies) | Requires the `bundleDependencies` property to be present. | | | |
|
|
73
|
+
| [require-config](https://eslint-plugin-package-json.dev/rules/require-properties/require-config) | Requires the `config` property to be present. | | | |
|
|
74
|
+
| [require-contributors](https://eslint-plugin-package-json.dev/rules/require-properties/require-contributors) | Requires the `contributors` property to be present. | | | |
|
|
75
|
+
| [require-cpu](https://eslint-plugin-package-json.dev/rules/require-properties/require-cpu) | Requires the `cpu` property to be present. | | | |
|
|
76
|
+
| [require-dependencies](https://eslint-plugin-package-json.dev/rules/require-properties/require-dependencies) | Requires the `dependencies` property to be present. | | | |
|
|
77
|
+
| [require-description](https://eslint-plugin-package-json.dev/rules/require-properties/require-description) | Requires the `description` property to be present. | โ
๐ฆ | | |
|
|
78
|
+
| [require-devDependencies](https://eslint-plugin-package-json.dev/rules/require-properties/require-devDependencies) | Requires the `devDependencies` property to be present. | | | |
|
|
79
|
+
| [require-devEngines](https://eslint-plugin-package-json.dev/rules/require-properties/require-devEngines) | Requires the `devEngines` property to be present. | | | |
|
|
80
|
+
| [require-directories](https://eslint-plugin-package-json.dev/rules/require-properties/require-directories) | Requires the `directories` property to be present. | | | |
|
|
81
|
+
| [require-engines](https://eslint-plugin-package-json.dev/rules/require-properties/require-engines) | Requires the `engines` property to be present. | | | |
|
|
82
|
+
| [require-exports](https://eslint-plugin-package-json.dev/rules/require-properties/require-exports) | Requires the `exports` property to be present. | โ
๐ฆ | | |
|
|
83
|
+
| [require-files](https://eslint-plugin-package-json.dev/rules/require-properties/require-files) | Requires the `files` property to be present. | โ
๐ฆ | | |
|
|
84
|
+
| [require-funding](https://eslint-plugin-package-json.dev/rules/require-properties/require-funding) | Requires the `funding` property to be present. | | | |
|
|
85
|
+
| [require-gypfile](https://eslint-plugin-package-json.dev/rules/require-properties/require-gypfile) | Requires the `gypfile` property to be present. | | | |
|
|
86
|
+
| [require-homepage](https://eslint-plugin-package-json.dev/rules/require-properties/require-homepage) | Requires the `homepage` property to be present. | | | |
|
|
87
|
+
| [require-keywords](https://eslint-plugin-package-json.dev/rules/require-properties/require-keywords) | Requires the `keywords` property to be present. | | | |
|
|
88
|
+
| [require-libc](https://eslint-plugin-package-json.dev/rules/require-properties/require-libc) | Requires the `libc` property to be present. | | | |
|
|
89
|
+
| [require-license](https://eslint-plugin-package-json.dev/rules/require-properties/require-license) | Requires the `license` property to be present. | โ
๐ฆ | | |
|
|
90
|
+
| [require-main](https://eslint-plugin-package-json.dev/rules/require-properties/require-main) | Requires the `main` property to be present. | | | |
|
|
91
|
+
| [require-man](https://eslint-plugin-package-json.dev/rules/require-properties/require-man) | Requires the `man` property to be present. | | | |
|
|
92
|
+
| [require-module](https://eslint-plugin-package-json.dev/rules/require-properties/require-module) | Requires the `module` property to be present. | | | |
|
|
93
|
+
| [require-name](https://eslint-plugin-package-json.dev/rules/require-properties/require-name) | Requires the `name` property to be present. | โ
๐ฆ | | |
|
|
94
|
+
| [require-optionalDependencies](https://eslint-plugin-package-json.dev/rules/require-properties/require-optionalDependencies) | Requires the `optionalDependencies` property to be present. | | | |
|
|
95
|
+
| [require-os](https://eslint-plugin-package-json.dev/rules/require-properties/require-os) | Requires the `os` property to be present. | | | |
|
|
96
|
+
| [require-packageManager](https://eslint-plugin-package-json.dev/rules/require-properties/require-packageManager) | Requires the `packageManager` property to be present. | | | |
|
|
97
|
+
| [require-peerDependencies](https://eslint-plugin-package-json.dev/rules/require-properties/require-peerDependencies) | Requires the `peerDependencies` property to be present. | | | |
|
|
98
|
+
| [require-peerDependenciesMeta](https://eslint-plugin-package-json.dev/rules/require-properties/require-peerDependenciesMeta) | Requires the `peerDependenciesMeta` property to be present. | | | |
|
|
99
|
+
| [require-private](https://eslint-plugin-package-json.dev/rules/require-properties/require-private) | Requires the `private` property to be present. | | ๐ง | |
|
|
100
|
+
| [require-publishConfig](https://eslint-plugin-package-json.dev/rules/require-properties/require-publishConfig) | Requires the `publishConfig` property to be present. | | | |
|
|
101
|
+
| [require-repository](https://eslint-plugin-package-json.dev/rules/require-properties/require-repository) | Requires the `repository` property to be present. | โ
๐ฆ | | |
|
|
102
|
+
| [require-scripts](https://eslint-plugin-package-json.dev/rules/require-properties/require-scripts) | Requires the `scripts` property to be present. | | | |
|
|
103
|
+
| [require-sideEffects](https://eslint-plugin-package-json.dev/rules/require-properties/require-sideEffects) | Requires the `sideEffects` property to be present. | โ
๐ฆ | | |
|
|
104
|
+
| [require-type](https://eslint-plugin-package-json.dev/rules/require-properties/require-type) | Requires the `type` property to be present. | โ
๐ฆ | ๐ง | |
|
|
105
|
+
| [require-types](https://eslint-plugin-package-json.dev/rules/require-properties/require-types) | Requires the `types` property to be present. | | | |
|
|
106
|
+
| [require-version](https://eslint-plugin-package-json.dev/rules/require-properties/require-version) | Requires the `version` property to be present. | โ
๐ฆ | | |
|
|
107
|
+
|
|
108
|
+
### Valid Properties
|
|
109
|
+
|
|
110
|
+
This group of rules allows you to enforce that the value of the associated top-level property is valid. All of these rules are include in the `recommended` config.
|
|
111
|
+
|
|
112
|
+
| Nameย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย | Description | ๐ผ | ๐ง | ๐ก |
|
|
113
|
+
| :--------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------ | :---- | :-- | :-- |
|
|
114
|
+
| [valid-author](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-author) | Enforce that the `author` property is valid. | โ
๐ฆ | | |
|
|
115
|
+
| [valid-bin](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-bin) | Enforce that the `bin` property is valid. | โ
๐ฆ | | |
|
|
116
|
+
| [valid-browser](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-browser) | Enforce that the `browser` property is valid. | โ
๐ฆ | | |
|
|
117
|
+
| [valid-bugs](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-bugs) | Enforce that the `bugs` property is valid. | โ
๐ฆ | | |
|
|
118
|
+
| [valid-bundleDependencies](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-bundleDependencies) | Enforce that the `bundleDependencies` (also `bundledDependencies`) property is valid. | โ
๐ฆ | | |
|
|
119
|
+
| [valid-config](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-config) | Enforce that the `config` property is valid. | โ
๐ฆ | | |
|
|
120
|
+
| [valid-contributors](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-contributors) | Enforce that the `contributors` property is valid. | โ
๐ฆ | | |
|
|
121
|
+
| [valid-cpu](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-cpu) | Enforce that the `cpu` property is valid. | โ
๐ฆ | | |
|
|
122
|
+
| [valid-dependencies](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-dependencies) | Enforce that the `dependencies` property is valid. | โ
๐ฆ | | |
|
|
123
|
+
| [valid-description](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-description) | Enforce that the `description` property is valid. | โ
๐ฆ | | |
|
|
124
|
+
| [valid-devDependencies](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-devDependencies) | Enforce that the `devDependencies` property is valid. | โ
๐ฆ | | |
|
|
125
|
+
| [valid-devEngines](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-devEngines) | Enforce that the `devEngines` property is valid. | โ
๐ฆ | | |
|
|
126
|
+
| [valid-directories](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-directories) | Enforce that the `directories` property is valid. | โ
๐ฆ | | |
|
|
127
|
+
| [valid-engines](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-engines) | Enforce that the `engines` property is valid. | โ
๐ฆ | | |
|
|
128
|
+
| [valid-exports](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-exports) | Enforce that the `exports` property is valid. | โ
๐ฆ | | |
|
|
129
|
+
| [valid-files](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-files) | Enforce that the `files` property is valid. | โ
๐ฆ | | |
|
|
130
|
+
| [valid-funding](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-funding) | Enforce that the `funding` property is valid. | โ
๐ฆ | | |
|
|
131
|
+
| [valid-gypfile](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-gypfile) | Enforce that the `gypfile` property is valid. | โ
๐ฆ | | |
|
|
132
|
+
| [valid-homepage](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-homepage) | Enforce that the `homepage` property is valid. | โ
๐ฆ | | |
|
|
133
|
+
| [valid-keywords](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-keywords) | Enforce that the `keywords` property is valid. | โ
๐ฆ | | |
|
|
134
|
+
| [valid-libc](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-libc) | Enforce that the `libc` property is valid. | โ
๐ฆ | | |
|
|
135
|
+
| [valid-license](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-license) | Enforce that the `license` property is valid. | โ
๐ฆ | | |
|
|
136
|
+
| [valid-main](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-main) | Enforce that the `main` property is valid. | โ
๐ฆ | | |
|
|
137
|
+
| [valid-man](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-man) | Enforce that the `man` property is valid. | โ
๐ฆ | | |
|
|
138
|
+
| [valid-module](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-module) | Enforce that the `module` property is valid. | โ
๐ฆ | | |
|
|
139
|
+
| [valid-name](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-name) | Enforce that the `name` property is valid. | โ
๐ฆ | | |
|
|
140
|
+
| [valid-optionalDependencies](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-optionalDependencies) | Enforce that the `optionalDependencies` property is valid. | โ
๐ฆ | | |
|
|
141
|
+
| [valid-os](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-os) | Enforce that the `os` property is valid. | โ
๐ฆ | | |
|
|
142
|
+
| [valid-packageManager](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-packageManager) | Enforce that the `packageManager` property is valid. | โ
๐ฆ | | |
|
|
143
|
+
| [valid-peerDependencies](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-peerDependencies) | Enforce that the `peerDependencies` property is valid. | โ
๐ฆ | | |
|
|
144
|
+
| [valid-peerDependenciesMeta](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-peerDependenciesMeta) | Enforce that the `peerDependenciesMeta` property is valid. | โ
๐ฆ | | |
|
|
145
|
+
| [valid-private](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-private) | Enforce that the `private` property is valid. | โ
๐ฆ | | |
|
|
146
|
+
| [valid-publishConfig](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-publishConfig) | Enforce that the `publishConfig` property is valid. | โ
๐ฆ | | |
|
|
147
|
+
| [valid-repository](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-repository) | Enforce that the `repository` property is valid. | โ
๐ฆ | | |
|
|
148
|
+
| [valid-scripts](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-scripts) | Enforce that the `scripts` property is valid. | โ
๐ฆ | | |
|
|
149
|
+
| [valid-sideEffects](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-sideEffects) | Enforce that the `sideEffects` property is valid. | โ
๐ฆ | | |
|
|
150
|
+
| [valid-type](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-type) | Enforce that the `type` property is valid. | โ
๐ฆ | | |
|
|
151
|
+
| [valid-version](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-version) | Enforce that the `version` property is valid. | โ
๐ฆ | | |
|
|
152
|
+
| [valid-workspaces](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-workspaces) | Enforce that the `workspaces` property is valid. | โ
๐ฆ | | |
|
|
138
153
|
|
|
139
154
|
<!-- end auto-generated rules list -->
|
|
140
155
|
|
|
@@ -169,6 +184,7 @@ Thanks! ๐
|
|
|
169
184
|
|
|
170
185
|
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
171
186
|
<!-- prettier-ignore-start -->
|
|
187
|
+
<!-- markdownlint-disable -->
|
|
172
188
|
<table>
|
|
173
189
|
<tbody>
|
|
174
190
|
<tr>
|
|
@@ -218,17 +234,22 @@ Thanks! ๐
|
|
|
218
234
|
</tr>
|
|
219
235
|
<tr>
|
|
220
236
|
<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>
|
|
237
|
+
<td align="center" valign="top" width="14.28%"><a href="https://www.wesleytodd.com/"><img src="https://avatars.githubusercontent.com/u/1027776?v=4?s=100" width="100px;" alt="Wes Todd"/><br /><sub><b>Wes Todd</b></sub></a><br /><a href="#ideas-wesleytodd" title="Ideas, Planning, & Feedback">๐ค</a></td>
|
|
221
238
|
<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>
|
|
222
239
|
<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>
|
|
223
240
|
<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>
|
|
224
241
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/michaelfaith"><img src="https://avatars.githubusercontent.com/u/8071845?v=4?s=100" width="100px;" alt="michael faith"/><br /><sub><b>michael faith</b></sub></a><br /><a href="#infra-michaelfaith" title="Infrastructure (Hosting, Build-Tools, etc)">๐</a> <a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=michaelfaith" title="Code">๐ป</a> <a href="#maintenance-michaelfaith" title="Maintenance">๐ง</a> <a href="#ideas-michaelfaith" title="Ideas, Planning, & Feedback">๐ค</a> <a href="https://github.com/michaelfaith/eslint-plugin-package-json/issues?q=author%3Amichaelfaith" title="Bug reports">๐</a> <a href="#tool-michaelfaith" title="Tools">๐ง</a> <a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=michaelfaith" title="Documentation">๐</a> <a href="#projectManagement-michaelfaith" title="Project Management">๐</a></td>
|
|
225
242
|
<td align="center" valign="top" width="14.28%"><a href="https://roottool.vercel.app"><img src="https://avatars.githubusercontent.com/u/11808736?v=4?s=100" width="100px;" alt="roottool"/><br /><sub><b>roottool</b></sub></a><br /><a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=roottool" title="Code">๐ป</a></td>
|
|
243
|
+
</tr>
|
|
244
|
+
<tr>
|
|
226
245
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/sunnytsang1998"><img src="https://avatars.githubusercontent.com/u/207208443?v=4?s=100" width="100px;" alt="sunnytsang1998"/><br /><sub><b>sunnytsang1998</b></sub></a><br /><a href="https://github.com/michaelfaith/eslint-plugin-package-json/issues?q=author%3Asunnytsang1998" title="Bug reports">๐</a></td>
|
|
227
246
|
</tr>
|
|
228
247
|
</tbody>
|
|
229
248
|
</table>
|
|
230
249
|
|
|
250
|
+
<!-- markdownlint-restore -->
|
|
231
251
|
<!-- prettier-ignore-end -->
|
|
252
|
+
|
|
232
253
|
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
233
254
|
|
|
234
255
|
## License
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { JSONSchema } from "../node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/definitions/jsonSchema.mjs";
|
|
2
|
+
import { PackageJsonPluginSettings, PackageJsonRuleModule } from "../createRule.mjs";
|
|
3
|
+
import { plugin } from "./plugin.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/experimental/index.d.ts
|
|
6
|
+
declare const configs: {
|
|
7
|
+
recommended: {
|
|
8
|
+
files: string[];
|
|
9
|
+
language: string;
|
|
10
|
+
name: string;
|
|
11
|
+
plugins: {
|
|
12
|
+
readonly 'package-json': import("eslint").ESLint.Plugin;
|
|
13
|
+
};
|
|
14
|
+
rules: {
|
|
15
|
+
[k: string]: "error";
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
stylistic: {
|
|
19
|
+
files: string[];
|
|
20
|
+
language: string;
|
|
21
|
+
name: string;
|
|
22
|
+
plugins: {
|
|
23
|
+
readonly 'package-json': import("eslint").ESLint.Plugin;
|
|
24
|
+
};
|
|
25
|
+
rules: {
|
|
26
|
+
[k: string]: "error";
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
declare const rules: {
|
|
31
|
+
[k: string]: PackageJsonRuleModule<unknown[], JSONSchema[]>;
|
|
32
|
+
};
|
|
33
|
+
//#endregion
|
|
34
|
+
export { type PackageJsonPluginSettings, configs, plugin as default, rules };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { JSONSchema } from "../node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/definitions/jsonSchema.mjs";
|
|
2
|
+
import { PackageJsonRuleModule } from "../createRule.mjs";
|
|
3
|
+
import { ESLint } from "eslint";
|
|
4
|
+
|
|
5
|
+
//#region src/experimental/plugin.d.ts
|
|
6
|
+
declare const plugin: {
|
|
7
|
+
configs: {
|
|
8
|
+
recommended: {
|
|
9
|
+
files: string[];
|
|
10
|
+
language: string;
|
|
11
|
+
name: string;
|
|
12
|
+
plugins: {
|
|
13
|
+
readonly 'package-json': ESLint.Plugin;
|
|
14
|
+
};
|
|
15
|
+
rules: {
|
|
16
|
+
[k: string]: "error";
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
stylistic: {
|
|
20
|
+
files: string[];
|
|
21
|
+
language: string;
|
|
22
|
+
name: string;
|
|
23
|
+
plugins: {
|
|
24
|
+
readonly 'package-json': ESLint.Plugin;
|
|
25
|
+
};
|
|
26
|
+
rules: {
|
|
27
|
+
[k: string]: "error";
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
meta: {
|
|
32
|
+
name: string;
|
|
33
|
+
version: string;
|
|
34
|
+
};
|
|
35
|
+
rules: {
|
|
36
|
+
[k: string]: PackageJsonRuleModule<unknown[], JSONSchema[]>;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
//#endregion
|
|
40
|
+
export { plugin };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { plugin as plugin$1 } from "../plugin.mjs";
|
|
2
|
+
import { toCompatRule } from "eslint-json-compat-utils";
|
|
3
|
+
//#region src/experimental/plugin.ts
|
|
4
|
+
const language = "json/json";
|
|
5
|
+
const rules = Object.fromEntries(Object.entries(plugin$1.rules).map(([name, rule]) => [name, toCompatRule(rule)]));
|
|
6
|
+
for (const rule of Object.values(rules)) rule.meta.languages ??= [language];
|
|
7
|
+
const plugin = {
|
|
8
|
+
configs: {
|
|
9
|
+
recommended: {
|
|
10
|
+
files: ["**/package.json"],
|
|
11
|
+
language,
|
|
12
|
+
name: "package-json/experimental-recommended",
|
|
13
|
+
plugins: { get "package-json"() {
|
|
14
|
+
return plugin;
|
|
15
|
+
} },
|
|
16
|
+
rules: plugin$1.configs.recommended.rules
|
|
17
|
+
},
|
|
18
|
+
stylistic: {
|
|
19
|
+
files: ["**/package.json"],
|
|
20
|
+
language,
|
|
21
|
+
name: "package-json/experimental-stylistic",
|
|
22
|
+
plugins: { get "package-json"() {
|
|
23
|
+
return plugin;
|
|
24
|
+
} },
|
|
25
|
+
rules: plugin$1.configs.stylistic.rules
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
meta: plugin$1.meta,
|
|
29
|
+
rules
|
|
30
|
+
};
|
|
31
|
+
//#endregion
|
|
32
|
+
export { plugin };
|
package/lib/plugin.mjs
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { rule } from "./rules/bin-name-casing.mjs";
|
|
2
2
|
import { rule as rule$1 } from "./rules/exports-subpaths-style.mjs";
|
|
3
3
|
import { rule as rule$2 } from "./rules/no-empty-fields.mjs";
|
|
4
|
-
import { rule as rule$3 } from "./rules/no-
|
|
5
|
-
import { rule as rule$4 } from "./rules/no-redundant-
|
|
6
|
-
import { rule as rule$5 } from "./rules/
|
|
7
|
-
import { rule as rule$6 } from "./rules/
|
|
8
|
-
import { rule as rule$7 } from "./rules/
|
|
4
|
+
import { rule as rule$3 } from "./rules/no-local-dependencies.mjs";
|
|
5
|
+
import { rule as rule$4 } from "./rules/no-redundant-files.mjs";
|
|
6
|
+
import { rule as rule$5 } from "./rules/no-redundant-publishConfig.mjs";
|
|
7
|
+
import { rule as rule$6 } from "./rules/order-properties.mjs";
|
|
8
|
+
import { rule as rule$7 } from "./rules/repository-shorthand.mjs";
|
|
9
|
+
import { rule as rule$8 } from "./rules/require-attribution.mjs";
|
|
9
10
|
import { rules as rules$1 } from "./rules/require-properties.mjs";
|
|
10
|
-
import { rule as rule$
|
|
11
|
-
import { rule as rule$
|
|
12
|
-
import { rule as rule$
|
|
13
|
-
import { rule as rule$
|
|
14
|
-
import { rule as rule$
|
|
15
|
-
import { rule as rule$
|
|
16
|
-
import { rule as rule$
|
|
17
|
-
import { rule as rule$
|
|
11
|
+
import { rule as rule$9 } from "./rules/restrict-dependency-ranges.mjs";
|
|
12
|
+
import { rule as rule$10 } from "./rules/restrict-private-properties.mjs";
|
|
13
|
+
import { rule as rule$11 } from "./rules/restrict-top-level-properties.mjs";
|
|
14
|
+
import { rule as rule$12 } from "./rules/scripts-name-casing.mjs";
|
|
15
|
+
import { rule as rule$13 } from "./rules/sort-collections.mjs";
|
|
16
|
+
import { rule as rule$14 } from "./rules/specify-peers-locally.mjs";
|
|
17
|
+
import { rule as rule$15 } from "./rules/unique-dependencies.mjs";
|
|
18
|
+
import { rule as rule$16 } from "./rules/valid-peerDependenciesMeta-relationship.mjs";
|
|
18
19
|
import { rules as rules$2 } from "./rules/valid-properties.mjs";
|
|
19
|
-
import { rule as rule$
|
|
20
|
+
import { rule as rule$17 } from "./rules/valid-repository-directory.mjs";
|
|
20
21
|
import { createRequire } from "node:module";
|
|
21
22
|
import * as parserJsonc from "jsonc-eslint-parser";
|
|
22
23
|
//#region src/plugin.ts
|
|
@@ -25,22 +26,23 @@ const rules = {
|
|
|
25
26
|
"bin-name-casing": rule,
|
|
26
27
|
"exports-subpaths-style": rule$1,
|
|
27
28
|
"no-empty-fields": rule$2,
|
|
28
|
-
"no-
|
|
29
|
-
"no-redundant-
|
|
30
|
-
"
|
|
31
|
-
"
|
|
29
|
+
"no-local-dependencies": rule$3,
|
|
30
|
+
"no-redundant-files": rule$4,
|
|
31
|
+
"no-redundant-publishConfig": rule$5,
|
|
32
|
+
"order-properties": rule$6,
|
|
33
|
+
"require-attribution": rule$8,
|
|
32
34
|
...rules$1,
|
|
33
|
-
"repository-shorthand": rule$
|
|
34
|
-
"restrict-dependency-ranges": rule$
|
|
35
|
-
"restrict-private-properties": rule$
|
|
36
|
-
"restrict-top-level-properties": rule$
|
|
37
|
-
"scripts-name-casing": rule$
|
|
38
|
-
"sort-collections": rule$
|
|
39
|
-
"specify-peers-locally": rule$
|
|
40
|
-
"unique-dependencies": rule$
|
|
35
|
+
"repository-shorthand": rule$7,
|
|
36
|
+
"restrict-dependency-ranges": rule$9,
|
|
37
|
+
"restrict-private-properties": rule$10,
|
|
38
|
+
"restrict-top-level-properties": rule$11,
|
|
39
|
+
"scripts-name-casing": rule$12,
|
|
40
|
+
"sort-collections": rule$13,
|
|
41
|
+
"specify-peers-locally": rule$14,
|
|
42
|
+
"unique-dependencies": rule$15,
|
|
41
43
|
...rules$2,
|
|
42
|
-
"valid-peerDependenciesMeta-relationship": rule$
|
|
43
|
-
"valid-repository-directory": rule$
|
|
44
|
+
"valid-peerDependenciesMeta-relationship": rule$16,
|
|
45
|
+
"valid-repository-directory": rule$17
|
|
44
46
|
};
|
|
45
47
|
const recommendedRules = { ...Object.fromEntries(Object.entries(rules).filter(([, rule]) => rule.meta.docs?.recommended).map(([name]) => ["package-json/" + name, "error"])) };
|
|
46
48
|
const recommendedPublishableRules = {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PackageJsonRuleModule } from "../createRule.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/rules/no-local-dependencies.d.ts
|
|
4
|
+
declare const rule: PackageJsonRuleModule<[({
|
|
5
|
+
ignorePrivate?: boolean | undefined;
|
|
6
|
+
} | undefined)?], [{
|
|
7
|
+
readonly additionalProperties: false;
|
|
8
|
+
readonly properties: {
|
|
9
|
+
readonly ignorePrivate: {
|
|
10
|
+
readonly description: "Determines if this rule should be enforced when the package's `private` property is `true`.";
|
|
11
|
+
readonly type: "boolean";
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
readonly type: "object";
|
|
15
|
+
}]>;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { rule };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { createRule } from "../createRule.mjs";
|
|
2
|
+
import { isJSONStringLiteral } from "../utils/predicates.mjs";
|
|
3
|
+
//#region src/rules/no-local-dependencies.ts
|
|
4
|
+
const isLocalDependency = (value) => value.startsWith("file:") || value.startsWith("link:") || value.startsWith("./") || value.startsWith("../") || value.startsWith(".\\") || value.startsWith("..\\");
|
|
5
|
+
const rule = createRule({
|
|
6
|
+
create(context) {
|
|
7
|
+
const ignorePrivate = context.options[0]?.ignorePrivate ?? true;
|
|
8
|
+
let isPrivate = false;
|
|
9
|
+
let dependencyNodes = [];
|
|
10
|
+
return {
|
|
11
|
+
"Program > JSONExpressionStatement > JSONObjectExpression > JSONProperty[key.type=JSONLiteral][value.type=JSONLiteral][key.value=private]"(node) {
|
|
12
|
+
if (node.value.value === true) isPrivate = true;
|
|
13
|
+
},
|
|
14
|
+
"Program > JSONExpressionStatement > JSONObjectExpression > JSONProperty[key.type=JSONLiteral][value.type=JSONObjectExpression][key.value=dependencies]"(node) {
|
|
15
|
+
dependencyNodes = node.value.properties;
|
|
16
|
+
},
|
|
17
|
+
"Program:exit"() {
|
|
18
|
+
if (ignorePrivate && isPrivate) return;
|
|
19
|
+
for (const dependencyPropertyNode of dependencyNodes) {
|
|
20
|
+
const dependencyValue = dependencyPropertyNode.value;
|
|
21
|
+
if (isJSONStringLiteral(dependencyValue) && isLocalDependency(dependencyValue.value)) context.report({
|
|
22
|
+
data: { name: dependencyValue.value },
|
|
23
|
+
messageId: "localDependencyFound",
|
|
24
|
+
node: dependencyValue
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
meta: {
|
|
31
|
+
defaultOptions: [{ ignorePrivate: true }],
|
|
32
|
+
docs: { description: "Requires that dependencies do not use local file paths, which will likely result in errors when installing from a registry." },
|
|
33
|
+
messages: { localDependencyFound: "Local dependency \"{{ name }}\" is not allowed." },
|
|
34
|
+
schema: [{
|
|
35
|
+
additionalProperties: false,
|
|
36
|
+
properties: { ignorePrivate: {
|
|
37
|
+
description: "Determines if this rule should be enforced when the package's `private` property is `true`.",
|
|
38
|
+
type: "boolean"
|
|
39
|
+
} },
|
|
40
|
+
type: "object"
|
|
41
|
+
}],
|
|
42
|
+
type: "problem"
|
|
43
|
+
},
|
|
44
|
+
name: "no-local-dependencies"
|
|
45
|
+
});
|
|
46
|
+
//#endregion
|
|
47
|
+
export { rule };
|