eslint-plugin-package-json 0.88.2 → 0.89.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/CHANGELOG.md +19 -0
- package/README.md +16 -10
- package/lib/createRule.d.mts +9 -5
- package/lib/index.d.mts +2 -2
- package/lib/node_modules/.pnpm/@types_estree@1.0.8/node_modules/@types/estree/index.d.mts +438 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/definitions/deserializationPattern.d.mts +7 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/definitions/fromSchemaOptions.d.mts +20 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/definitions/jsonSchema.d.mts +60 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/index.d.mts +11 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/parse-options.d.mts +16 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/parse-schema/allOf.d.mts +13 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/parse-schema/anyOf.d.mts +14 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/parse-schema/array.d.mts +58 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/parse-schema/const.d.mts +14 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/parse-schema/deserialize.d.mts +13 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/parse-schema/enum.d.mts +14 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/parse-schema/ifThenElse.d.mts +20 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/parse-schema/index.d.mts +34 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/parse-schema/multipleTypes.d.mts +14 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/parse-schema/not.d.mts +20 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/parse-schema/nullable.d.mts +14 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/parse-schema/object.d.mts +34 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/parse-schema/oneOf.d.mts +14 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/parse-schema/references/external.d.mts +22 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/parse-schema/references/index.d.mts +13 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/parse-schema/references/internal.d.mts +8 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/parse-schema/references/utils.d.mts +12 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/parse-schema/singleType.d.mts +24 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/parse-schema/utils.d.mts +20 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/type-utils/and.d.mts +4 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/type-utils/extends.d.mts +4 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/type-utils/get.d.mts +4 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/type-utils/join.d.mts +4 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/type-utils/not.d.mts +4 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/type-utils/pop.d.mts +4 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/type-utils/split.d.mts +7 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/type-utils/tail.d.mts +4 -0
- package/lib/node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/type-utils/writable.d.mts +4 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/any.d.mts +20 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/array.d.mts +28 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/const.d.mts +25 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/enum.d.mts +25 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/exclusion/any.d.mts +16 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/exclusion/array.d.mts +20 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/exclusion/const.d.mts +28 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/exclusion/enum.d.mts +23 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/exclusion/index.d.mts +24 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/exclusion/object.d.mts +44 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/exclusion/primitive.d.mts +16 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/exclusion/tuple.d.mts +43 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/exclusion/union.d.mts +13 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/exclusion/utils.d.mts +35 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/intersection/any.d.mts +23 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/intersection/array.d.mts +24 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/intersection/const.d.mts +34 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/intersection/enum.d.mts +26 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/intersection/index.d.mts +24 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/intersection/object.d.mts +25 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/intersection/primitive.d.mts +23 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/intersection/tuple.d.mts +26 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/intersection/union.d.mts +17 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/intersection/utils.d.mts +10 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/never.d.mts +9 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/object.d.mts +49 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/primitive.d.mts +26 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/resolve.d.mts +22 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/tuple.d.mts +36 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/type.d.mts +18 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/union.d.mts +23 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/meta-types/utils.d.mts +7 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/utils/and.d.mts +4 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/utils/extends.d.mts +7 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/utils/if.d.mts +4 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/utils/intersectUnion.d.mts +4 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/utils/isNever.d.mts +4 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/utils/merge.d.mts +6 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/utils/not.d.mts +4 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/utils/or.d.mts +4 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/utils/prettify.d.mts +6 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/utils/tail.d.mts +4 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/utils/unionLast.d.mts +6 -0
- package/lib/node_modules/.pnpm/ts-algebra@2.0.0/node_modules/ts-algebra/lib/utils/unionPop.d.mts +6 -0
- package/lib/plugin.d.mts +3 -4
- package/lib/plugin.mjs +3 -3
- package/lib/rules/no-empty-fields.mjs +2 -2
- package/lib/rules/repository-shorthand.mjs +3 -3
- package/lib/rules/require-attribution.d.mts +5 -0
- package/lib/rules/require-attribution.mjs +23 -7
- package/lib/rules/require-properties.mjs +14 -5
- package/lib/rules/restrict-private-properties.mjs +2 -2
- package/package.json +15 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.89.0](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/compare/v0.88.3...v0.89.0) (2026-02-20)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* move the `publishable` require rules to `recommended` ([#1565](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/1565))
|
|
9
|
+
|
|
10
|
+
### 🚀 Features
|
|
11
|
+
|
|
12
|
+
* add support for eslint v10 ([#1554](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/1554)) ([27ca725](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commit/27ca725ac5418f5b4076a5890876bd51e3e90d34))
|
|
13
|
+
* move the `publishable` require rules to `recommended` ([#1565](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/1565)) ([37231d3](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commit/37231d321aff449912b6013b8d6ead78caff3695))
|
|
14
|
+
|
|
15
|
+
## [0.88.3](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/compare/v0.88.2...v0.88.3) (2026-02-16)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### 🚀 Features
|
|
19
|
+
|
|
20
|
+
* **require-attribution:** add `ignorePrivate` option ([#1566](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/1566)) ([629a8ab](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commit/629a8abf2a51eb9d2dc4e6204c9159a8c8c23675))
|
|
21
|
+
|
|
3
22
|
## [0.88.2](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/compare/v0.88.1...v0.88.2) (2026-01-23)
|
|
4
23
|
|
|
5
24
|
|
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: 39" src="https://img.shields.io/badge/%F0%9F%91%AA_all_contributors-39-21bb42.svg" /></a>
|
|
12
12
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
13
13
|
<!-- prettier-ignore-end -->
|
|
14
14
|
<a href="https://github.com/JoshuaKGoldberg/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>
|
|
@@ -66,6 +66,10 @@ See [ESLint's _Configuration Files_ guide](https://eslint.org/docs/latest/use/co
|
|
|
66
66
|
|
|
67
67
|
### Recommended Config for Publishable Packages
|
|
68
68
|
|
|
69
|
+
> [!NOTE]
|
|
70
|
+
> This config was recently made redundant and is now the same as `recommended`.
|
|
71
|
+
> However, we're keeping it as its own config for now, in the event that we add new rules unique to the publishable use case.
|
|
72
|
+
|
|
69
73
|
The `recommended-publishable` configuration has everything in it from the standard `recommended` config, with some additional rules added that are geared towards packages that are intended to be published.
|
|
70
74
|
|
|
71
75
|
```ts
|
|
@@ -211,7 +215,7 @@ The default settings don't conflict, and Prettier plugins can quickly fix up ord
|
|
|
211
215
|
| [no-redundant-publishConfig](docs/rules/no-redundant-publishConfig.md) | Warns when publishConfig.access is used in unscoped packages. | ✔️ ✅ 📦 | | 💡 | |
|
|
212
216
|
| [order-properties](docs/rules/order-properties.md) | Package properties should be declared in standard order | 🎨 | 🔧 | | |
|
|
213
217
|
| [repository-shorthand](docs/rules/repository-shorthand.md) | Enforce either object or shorthand declaration for repository. | ✔️ ✅ 📦 | 🔧 | | |
|
|
214
|
-
| [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. | 📦
|
|
218
|
+
| [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. | ✔️ ✅ 📦 | | 💡 | |
|
|
215
219
|
| [require-author](docs/rules/require-author.md) | Requires the `author` property to be present. | | | | |
|
|
216
220
|
| [require-bugs](docs/rules/require-bugs.md) | Requires the `bugs` property to be present. | | | | |
|
|
217
221
|
| [require-bundleDependencies](docs/rules/require-bundleDependencies.md) | Requires the `bundleDependencies` property to be present. | | | | |
|
|
@@ -219,17 +223,17 @@ The default settings don't conflict, and Prettier plugins can quickly fix up ord
|
|
|
219
223
|
| [require-description](docs/rules/require-description.md) | Requires the `description` property to be present. | ✔️ ✅ 📦 | | | |
|
|
220
224
|
| [require-devDependencies](docs/rules/require-devDependencies.md) | Requires the `devDependencies` property to be present. | | | | |
|
|
221
225
|
| [require-engines](docs/rules/require-engines.md) | Requires the `engines` property to be present. | | | | |
|
|
222
|
-
| [require-exports](docs/rules/require-exports.md) | Requires the `exports` property to be present. | 📦
|
|
223
|
-
| [require-files](docs/rules/require-files.md) | Requires the `files` property to be present. | 📦
|
|
226
|
+
| [require-exports](docs/rules/require-exports.md) | Requires the `exports` property to be present. | ✔️ ✅ 📦 | | | |
|
|
227
|
+
| [require-files](docs/rules/require-files.md) | Requires the `files` property to be present. | ✔️ ✅ 📦 | | | |
|
|
224
228
|
| [require-homepage](docs/rules/require-homepage.md) | Requires the `homepage` property to be present. | | | | |
|
|
225
229
|
| [require-keywords](docs/rules/require-keywords.md) | Requires the `keywords` property to be present. | | | | |
|
|
226
230
|
| [require-license](docs/rules/require-license.md) | Requires the `license` property to be present. | ✔️ ✅ 📦 | | | |
|
|
227
231
|
| [require-name](docs/rules/require-name.md) | Requires the `name` property to be present. | ✔️ ✅ 📦 | | | |
|
|
228
232
|
| [require-optionalDependencies](docs/rules/require-optionalDependencies.md) | Requires the `optionalDependencies` property to be present. | | | | |
|
|
229
233
|
| [require-peerDependencies](docs/rules/require-peerDependencies.md) | Requires the `peerDependencies` property to be present. | | | | |
|
|
230
|
-
| [require-repository](docs/rules/require-repository.md) | Requires the `repository` property to be present. | 📦
|
|
234
|
+
| [require-repository](docs/rules/require-repository.md) | Requires the `repository` property to be present. | ✔️ ✅ 📦 | | | |
|
|
231
235
|
| [require-scripts](docs/rules/require-scripts.md) | Requires the `scripts` property to be present. | | | | |
|
|
232
|
-
| [require-sideEffects](docs/rules/require-sideEffects.md) | Requires the `sideEffects` property to be present. | 📦
|
|
236
|
+
| [require-sideEffects](docs/rules/require-sideEffects.md) | Requires the `sideEffects` property to be present. | ✔️ ✅ 📦 | | | |
|
|
233
237
|
| [require-type](docs/rules/require-type.md) | Requires the `type` property to be present. | ✔️ ✅ 📦 | 🔧 | | |
|
|
234
238
|
| [require-types](docs/rules/require-types.md) | Requires the `types` property to be present. | | | | |
|
|
235
239
|
| [require-version](docs/rules/require-version.md) | Requires the `version` property to be present. | ✔️ ✅ 📦 | | | |
|
|
@@ -330,33 +334,35 @@ Thanks! 🗂
|
|
|
330
334
|
<td align="center" valign="top" width="14.28%"><a href="https://hirok.io"><img src="https://avatars.githubusercontent.com/u/1075694?v=4?s=100" width="100px;" alt="Hiroki Osame"/><br /><sub><b>Hiroki Osame</b></sub></a><br /><a href="#ideas-privatenumber" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=privatenumber" title="Code">💻</a></td>
|
|
331
335
|
</tr>
|
|
332
336
|
<tr>
|
|
337
|
+
<td align="center" valign="top" width="14.28%"><a href="https://vanyauhalin.me/"><img src="https://avatars.githubusercontent.com/u/56481109?v=4?s=100" width="100px;" alt="Ivan Uhalin"/><br /><sub><b>Ivan Uhalin</b></sub></a><br /><a href="#ideas-vanyauhalin" title="Ideas, Planning, & Feedback">🤔</a></td>
|
|
333
338
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Zamiell"><img src="https://avatars.githubusercontent.com/u/5511220?v=4?s=100" width="100px;" alt="James"/><br /><sub><b>James</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=Zamiell" title="Code">💻</a> <a href="#ideas-Zamiell" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3AZamiell" title="Bug reports">🐛</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=Zamiell" title="Documentation">📖</a></td>
|
|
334
339
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/zetlen"><img src="https://avatars.githubusercontent.com/u/1643758?v=4?s=100" width="100px;" alt="James Zetlen"/><br /><sub><b>James Zetlen</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=zetlen" title="Code">💻</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3Azetlen" title="Bug reports">🐛</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=zetlen" title="Documentation">📖</a> <a href="#infra-zetlen" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#maintenance-zetlen" title="Maintenance">🚧</a> <a href="#tool-zetlen" title="Tools">🔧</a></td>
|
|
335
340
|
<td align="center" valign="top" width="14.28%"><a href="https://piranna.github.io/"><img src="https://avatars.githubusercontent.com/u/532414?v=4?s=100" width="100px;" alt="Jesús Leganés-Combarro"/><br /><sub><b>Jesús Leganés-Combarro</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=piranna" title="Code">💻</a></td>
|
|
336
341
|
<td align="center" valign="top" width="14.28%"><a href="http://www.joshuakgoldberg.com/"><img src="https://avatars.githubusercontent.com/u/3335181?v=4?s=100" width="100px;" alt="Josh Goldberg ✨"/><br /><sub><b>Josh Goldberg ✨</b></sub></a><br /><a href="#tool-JoshuaKGoldberg" title="Tools">🔧</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3AJoshuaKGoldberg" title="Bug reports">🐛</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=JoshuaKGoldberg" title="Code">💻</a> <a href="#infra-JoshuaKGoldberg" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=JoshuaKGoldberg" title="Documentation">📖</a> <a href="#maintenance-JoshuaKGoldberg" title="Maintenance">🚧</a> <a href="#ideas-JoshuaKGoldberg" title="Ideas, Planning, & Feedback">🤔</a> <a href="#content-JoshuaKGoldberg" title="Content">🖋</a> <a href="#projectManagement-JoshuaKGoldberg" title="Project Management">📆</a></td>
|
|
337
342
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/kendallgassner"><img src="https://avatars.githubusercontent.com/u/15275462?v=4?s=100" width="100px;" alt="Kendall Gassner"/><br /><sub><b>Kendall Gassner</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=kendallgassner" title="Code">💻</a> <a href="#maintenance-kendallgassner" title="Maintenance">🚧</a></td>
|
|
338
343
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/KristjanESPERANTO"><img src="https://avatars.githubusercontent.com/u/35647502?v=4?s=100" width="100px;" alt="Kristjan ESPERANTO"/><br /><sub><b>Kristjan ESPERANTO</b></sub></a><br /><a href="#ideas-kristjanesperanto" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3Akristjanesperanto" title="Bug reports">🐛</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=kristjanesperanto" title="Code">💻</a></td>
|
|
339
|
-
<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/JoshuaKGoldberg/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>
|
|
340
344
|
</tr>
|
|
341
345
|
<tr>
|
|
346
|
+
<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/JoshuaKGoldberg/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>
|
|
342
347
|
<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>
|
|
343
348
|
<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/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=cellule" title="Code">💻</a></td>
|
|
344
349
|
<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/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3AMorrisonCole" title="Bug reports">🐛</a></td>
|
|
345
350
|
<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/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=nschonni" title="Code">💻</a></td>
|
|
346
351
|
<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/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=olivierzal" title="Documentation">📖</a></td>
|
|
347
352
|
<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/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3Apatrik-csak" title="Bug reports">🐛</a></td>
|
|
348
|
-
<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/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=rakleed" title="Documentation">📖</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=rakleed" title="Code">💻</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3Arakleed" title="Bug reports">🐛</a></td>
|
|
349
353
|
</tr>
|
|
350
354
|
<tr>
|
|
355
|
+
<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/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=rakleed" title="Documentation">📖</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=rakleed" title="Code">💻</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3Arakleed" title="Bug reports">🐛</a></td>
|
|
351
356
|
<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/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=sasial-dev" title="Code">💻</a></td>
|
|
357
|
+
<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/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=ShayanTheNerd" title="Documentation">📖</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=ShayanTheNerd" title="Code">💻</a></td>
|
|
352
358
|
<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/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=sirugh" title="Code">💻</a></td>
|
|
353
359
|
<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/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3Ahyoban" title="Bug reports">🐛</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=hyoban" title="Code">💻</a> <a href="#ideas-hyoban" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=hyoban" title="Documentation">📖</a></td>
|
|
354
360
|
<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/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3Aota-meshi" title="Bug reports">🐛</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=ota-meshi" title="Code">💻</a></td>
|
|
355
361
|
<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/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3Ab3rnhard" title="Bug reports">🐛</a></td>
|
|
356
|
-
<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/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=chouchouji" title="Code">💻</a></td>
|
|
357
|
-
<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/JoshuaKGoldberg/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/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3Amichaelfaith" title="Bug reports">🐛</a> <a href="#tool-michaelfaith" title="Tools">🔧</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=michaelfaith" title="Documentation">📖</a></td>
|
|
358
362
|
</tr>
|
|
359
363
|
<tr>
|
|
364
|
+
<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/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=chouchouji" title="Code">💻</a></td>
|
|
365
|
+
<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/JoshuaKGoldberg/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/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3Amichaelfaith" title="Bug reports">🐛</a> <a href="#tool-michaelfaith" title="Tools">🔧</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=michaelfaith" title="Documentation">📖</a></td>
|
|
360
366
|
<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/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=roottool" title="Code">💻</a></td>
|
|
361
367
|
<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/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3Asunnytsang1998" title="Bug reports">🐛</a></td>
|
|
362
368
|
</tr>
|
package/lib/createRule.d.mts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
+
import { Expression, ExpressionStatement } from "./node_modules/.pnpm/@types_estree@1.0.8/node_modules/@types/estree/index.mjs";
|
|
2
|
+
import { JSONSchema } from "./node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/definitions/jsonSchema.mjs";
|
|
3
|
+
import { FromSchema } from "./node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/index.mjs";
|
|
1
4
|
import { AST, RuleListener } from "jsonc-eslint-parser";
|
|
2
|
-
import * as ESTree from "estree";
|
|
3
|
-
import { FromSchema, JSONSchema } from "json-schema-to-ts";
|
|
4
5
|
import { AST as AST$1, Rule, SourceCode } from "eslint";
|
|
5
6
|
|
|
6
7
|
//#region src/createRule.d.ts
|
|
7
|
-
type JsonAstBodyExpression =
|
|
8
|
+
type JsonAstBodyExpression = Expression & {
|
|
8
9
|
properties: JsonAstBodyProperty[];
|
|
9
10
|
};
|
|
10
11
|
type JsonAstBodyProperty = AST.JSONProperty & {
|
|
11
12
|
value: string;
|
|
12
13
|
};
|
|
13
|
-
interface JsonAstBodyStatement extends
|
|
14
|
+
interface JsonAstBodyStatement extends ExpressionStatement {
|
|
14
15
|
expression: JsonAstBodyExpression;
|
|
15
16
|
}
|
|
16
17
|
interface PackageJsonAst extends AST$1.Program {
|
|
@@ -34,8 +35,11 @@ interface PackageJsonRuleContext<Options extends unknown[] = unknown[]> extends
|
|
|
34
35
|
}
|
|
35
36
|
interface PackageJsonRuleModule<Options extends unknown[] = unknown[], Schema extends JSONSchema[] = JSONSchema[]> {
|
|
36
37
|
create(context: PackageJsonRuleContext<Options>): RuleListener;
|
|
37
|
-
meta: Omit<Rule.RuleMetaData, "defaultOptions" | "schema"> & {
|
|
38
|
+
meta: Omit<Rule.RuleMetaData, "defaultOptions" | "docs" | "schema"> & {
|
|
38
39
|
defaultOptions?: NoInfer<Options>;
|
|
40
|
+
docs?: Rule.RuleMetaData["docs"] & {
|
|
41
|
+
category?: string;
|
|
42
|
+
};
|
|
39
43
|
schema?: Schema;
|
|
40
44
|
};
|
|
41
45
|
}
|
package/lib/index.d.mts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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";
|
|
1
2
|
import { PackageJsonPluginSettings, PackageJsonRuleModule } from "./createRule.mjs";
|
|
2
3
|
import { plugin } from "./plugin.mjs";
|
|
3
4
|
import * as jsonc_eslint_parser0 from "jsonc-eslint-parser";
|
|
4
|
-
import * as json_schema_to_ts0 from "json-schema-to-ts";
|
|
5
5
|
import * as eslint0 from "eslint";
|
|
6
6
|
|
|
7
7
|
//#region src/index.d.ts
|
|
8
|
-
declare const rules: Record<string, PackageJsonRuleModule<unknown[],
|
|
8
|
+
declare const rules: Record<string, PackageJsonRuleModule<unknown[], JSONSchema[]>>;
|
|
9
9
|
declare const configs: {
|
|
10
10
|
"legacy-recommended": {
|
|
11
11
|
plugins: string[];
|
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
//#region node_modules/.pnpm/@types+estree@1.0.8/node_modules/@types/estree/index.d.ts
|
|
2
|
+
// This definition file follows a somewhat unusual format. ESTree allows
|
|
3
|
+
// runtime type checks based on the `type` parameter. In order to explain this
|
|
4
|
+
// to typescript we want to use discriminated union types:
|
|
5
|
+
// https://github.com/Microsoft/TypeScript/pull/9163
|
|
6
|
+
//
|
|
7
|
+
// For ESTree this is a bit tricky because the high level interfaces like
|
|
8
|
+
// Node or Function are pulling double duty. We want to pass common fields down
|
|
9
|
+
// to the interfaces that extend them (like Identifier or
|
|
10
|
+
// ArrowFunctionExpression), but you can't extend a type union or enforce
|
|
11
|
+
// common fields on them. So we've split the high level interfaces into two
|
|
12
|
+
// types, a base type which passes down inherited fields, and a type union of
|
|
13
|
+
// all types which extend the base type. Only the type union is exported, and
|
|
14
|
+
// the union is how other types refer to the collection of inheriting types.
|
|
15
|
+
//
|
|
16
|
+
// This makes the definitions file here somewhat more difficult to maintain,
|
|
17
|
+
// but it has the notable advantage of making ESTree much easier to use as
|
|
18
|
+
// an end user.
|
|
19
|
+
interface BaseNodeWithoutComments {
|
|
20
|
+
// Every leaf interface that extends BaseNode must specify a type property.
|
|
21
|
+
// The type property should be a string literal. For example, Identifier
|
|
22
|
+
// has: `type: "Identifier"`
|
|
23
|
+
type: string;
|
|
24
|
+
loc?: SourceLocation | null | undefined;
|
|
25
|
+
range?: [number, number] | undefined;
|
|
26
|
+
}
|
|
27
|
+
interface BaseNode extends BaseNodeWithoutComments {
|
|
28
|
+
leadingComments?: Comment[] | undefined;
|
|
29
|
+
trailingComments?: Comment[] | undefined;
|
|
30
|
+
}
|
|
31
|
+
interface Comment extends BaseNodeWithoutComments {
|
|
32
|
+
type: "Line" | "Block";
|
|
33
|
+
value: string;
|
|
34
|
+
}
|
|
35
|
+
interface SourceLocation {
|
|
36
|
+
source?: string | null | undefined;
|
|
37
|
+
start: Position;
|
|
38
|
+
end: Position;
|
|
39
|
+
}
|
|
40
|
+
interface Position {
|
|
41
|
+
/** >= 1 */
|
|
42
|
+
line: number;
|
|
43
|
+
/** >= 0 */
|
|
44
|
+
column: number;
|
|
45
|
+
}
|
|
46
|
+
interface BaseFunction extends BaseNode {
|
|
47
|
+
params: Pattern[];
|
|
48
|
+
generator?: boolean | undefined;
|
|
49
|
+
async?: boolean | undefined; // The body is either BlockStatement or Expression because arrow functions
|
|
50
|
+
// can have a body that's either. FunctionDeclarations and
|
|
51
|
+
// FunctionExpressions have only BlockStatement bodies.
|
|
52
|
+
body: BlockStatement | Expression;
|
|
53
|
+
}
|
|
54
|
+
type Statement = ExpressionStatement | BlockStatement | StaticBlock | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | Declaration;
|
|
55
|
+
interface BaseStatement extends BaseNode {}
|
|
56
|
+
interface EmptyStatement extends BaseStatement {
|
|
57
|
+
type: "EmptyStatement";
|
|
58
|
+
}
|
|
59
|
+
interface BlockStatement extends BaseStatement {
|
|
60
|
+
type: "BlockStatement";
|
|
61
|
+
body: Statement[];
|
|
62
|
+
innerComments?: Comment[] | undefined;
|
|
63
|
+
}
|
|
64
|
+
interface StaticBlock extends Omit<BlockStatement, "type"> {
|
|
65
|
+
type: "StaticBlock";
|
|
66
|
+
}
|
|
67
|
+
interface ExpressionStatement extends BaseStatement {
|
|
68
|
+
type: "ExpressionStatement";
|
|
69
|
+
expression: Expression;
|
|
70
|
+
}
|
|
71
|
+
interface IfStatement extends BaseStatement {
|
|
72
|
+
type: "IfStatement";
|
|
73
|
+
test: Expression;
|
|
74
|
+
consequent: Statement;
|
|
75
|
+
alternate?: Statement | null | undefined;
|
|
76
|
+
}
|
|
77
|
+
interface LabeledStatement extends BaseStatement {
|
|
78
|
+
type: "LabeledStatement";
|
|
79
|
+
label: Identifier;
|
|
80
|
+
body: Statement;
|
|
81
|
+
}
|
|
82
|
+
interface BreakStatement extends BaseStatement {
|
|
83
|
+
type: "BreakStatement";
|
|
84
|
+
label?: Identifier | null | undefined;
|
|
85
|
+
}
|
|
86
|
+
interface ContinueStatement extends BaseStatement {
|
|
87
|
+
type: "ContinueStatement";
|
|
88
|
+
label?: Identifier | null | undefined;
|
|
89
|
+
}
|
|
90
|
+
interface WithStatement extends BaseStatement {
|
|
91
|
+
type: "WithStatement";
|
|
92
|
+
object: Expression;
|
|
93
|
+
body: Statement;
|
|
94
|
+
}
|
|
95
|
+
interface SwitchStatement extends BaseStatement {
|
|
96
|
+
type: "SwitchStatement";
|
|
97
|
+
discriminant: Expression;
|
|
98
|
+
cases: SwitchCase[];
|
|
99
|
+
}
|
|
100
|
+
interface ReturnStatement extends BaseStatement {
|
|
101
|
+
type: "ReturnStatement";
|
|
102
|
+
argument?: Expression | null | undefined;
|
|
103
|
+
}
|
|
104
|
+
interface ThrowStatement extends BaseStatement {
|
|
105
|
+
type: "ThrowStatement";
|
|
106
|
+
argument: Expression;
|
|
107
|
+
}
|
|
108
|
+
interface TryStatement extends BaseStatement {
|
|
109
|
+
type: "TryStatement";
|
|
110
|
+
block: BlockStatement;
|
|
111
|
+
handler?: CatchClause | null | undefined;
|
|
112
|
+
finalizer?: BlockStatement | null | undefined;
|
|
113
|
+
}
|
|
114
|
+
interface WhileStatement extends BaseStatement {
|
|
115
|
+
type: "WhileStatement";
|
|
116
|
+
test: Expression;
|
|
117
|
+
body: Statement;
|
|
118
|
+
}
|
|
119
|
+
interface DoWhileStatement extends BaseStatement {
|
|
120
|
+
type: "DoWhileStatement";
|
|
121
|
+
body: Statement;
|
|
122
|
+
test: Expression;
|
|
123
|
+
}
|
|
124
|
+
interface ForStatement extends BaseStatement {
|
|
125
|
+
type: "ForStatement";
|
|
126
|
+
init?: VariableDeclaration | Expression | null | undefined;
|
|
127
|
+
test?: Expression | null | undefined;
|
|
128
|
+
update?: Expression | null | undefined;
|
|
129
|
+
body: Statement;
|
|
130
|
+
}
|
|
131
|
+
interface BaseForXStatement extends BaseStatement {
|
|
132
|
+
left: VariableDeclaration | Pattern;
|
|
133
|
+
right: Expression;
|
|
134
|
+
body: Statement;
|
|
135
|
+
}
|
|
136
|
+
interface ForInStatement extends BaseForXStatement {
|
|
137
|
+
type: "ForInStatement";
|
|
138
|
+
}
|
|
139
|
+
interface DebuggerStatement extends BaseStatement {
|
|
140
|
+
type: "DebuggerStatement";
|
|
141
|
+
}
|
|
142
|
+
type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration;
|
|
143
|
+
interface BaseDeclaration extends BaseStatement {}
|
|
144
|
+
interface MaybeNamedFunctionDeclaration extends BaseFunction, BaseDeclaration {
|
|
145
|
+
type: "FunctionDeclaration";
|
|
146
|
+
/** It is null when a function declaration is a part of the `export default function` statement */
|
|
147
|
+
id: Identifier | null;
|
|
148
|
+
body: BlockStatement;
|
|
149
|
+
}
|
|
150
|
+
interface FunctionDeclaration extends MaybeNamedFunctionDeclaration {
|
|
151
|
+
id: Identifier;
|
|
152
|
+
}
|
|
153
|
+
interface VariableDeclaration extends BaseDeclaration {
|
|
154
|
+
type: "VariableDeclaration";
|
|
155
|
+
declarations: VariableDeclarator[];
|
|
156
|
+
kind: "var" | "let" | "const" | "using" | "await using";
|
|
157
|
+
}
|
|
158
|
+
interface VariableDeclarator extends BaseNode {
|
|
159
|
+
type: "VariableDeclarator";
|
|
160
|
+
id: Pattern;
|
|
161
|
+
init?: Expression | null | undefined;
|
|
162
|
+
}
|
|
163
|
+
interface ExpressionMap {
|
|
164
|
+
ArrayExpression: ArrayExpression;
|
|
165
|
+
ArrowFunctionExpression: ArrowFunctionExpression;
|
|
166
|
+
AssignmentExpression: AssignmentExpression;
|
|
167
|
+
AwaitExpression: AwaitExpression;
|
|
168
|
+
BinaryExpression: BinaryExpression;
|
|
169
|
+
CallExpression: CallExpression;
|
|
170
|
+
ChainExpression: ChainExpression;
|
|
171
|
+
ClassExpression: ClassExpression;
|
|
172
|
+
ConditionalExpression: ConditionalExpression;
|
|
173
|
+
FunctionExpression: FunctionExpression;
|
|
174
|
+
Identifier: Identifier;
|
|
175
|
+
ImportExpression: ImportExpression;
|
|
176
|
+
Literal: Literal;
|
|
177
|
+
LogicalExpression: LogicalExpression;
|
|
178
|
+
MemberExpression: MemberExpression;
|
|
179
|
+
MetaProperty: MetaProperty;
|
|
180
|
+
NewExpression: NewExpression;
|
|
181
|
+
ObjectExpression: ObjectExpression;
|
|
182
|
+
SequenceExpression: SequenceExpression;
|
|
183
|
+
TaggedTemplateExpression: TaggedTemplateExpression;
|
|
184
|
+
TemplateLiteral: TemplateLiteral;
|
|
185
|
+
ThisExpression: ThisExpression;
|
|
186
|
+
UnaryExpression: UnaryExpression;
|
|
187
|
+
UpdateExpression: UpdateExpression;
|
|
188
|
+
YieldExpression: YieldExpression;
|
|
189
|
+
}
|
|
190
|
+
type Expression = ExpressionMap[keyof ExpressionMap];
|
|
191
|
+
interface BaseExpression extends BaseNode {}
|
|
192
|
+
type ChainElement = SimpleCallExpression | MemberExpression;
|
|
193
|
+
interface ChainExpression extends BaseExpression {
|
|
194
|
+
type: "ChainExpression";
|
|
195
|
+
expression: ChainElement;
|
|
196
|
+
}
|
|
197
|
+
interface ThisExpression extends BaseExpression {
|
|
198
|
+
type: "ThisExpression";
|
|
199
|
+
}
|
|
200
|
+
interface ArrayExpression extends BaseExpression {
|
|
201
|
+
type: "ArrayExpression";
|
|
202
|
+
elements: Array<Expression | SpreadElement | null>;
|
|
203
|
+
}
|
|
204
|
+
interface ObjectExpression extends BaseExpression {
|
|
205
|
+
type: "ObjectExpression";
|
|
206
|
+
properties: Array<Property | SpreadElement>;
|
|
207
|
+
}
|
|
208
|
+
interface PrivateIdentifier extends BaseNode {
|
|
209
|
+
type: "PrivateIdentifier";
|
|
210
|
+
name: string;
|
|
211
|
+
}
|
|
212
|
+
interface Property extends BaseNode {
|
|
213
|
+
type: "Property";
|
|
214
|
+
key: Expression | PrivateIdentifier;
|
|
215
|
+
value: Expression | Pattern; // Could be an AssignmentProperty
|
|
216
|
+
kind: "init" | "get" | "set";
|
|
217
|
+
method: boolean;
|
|
218
|
+
shorthand: boolean;
|
|
219
|
+
computed: boolean;
|
|
220
|
+
}
|
|
221
|
+
interface PropertyDefinition extends BaseNode {
|
|
222
|
+
type: "PropertyDefinition";
|
|
223
|
+
key: Expression | PrivateIdentifier;
|
|
224
|
+
value?: Expression | null | undefined;
|
|
225
|
+
computed: boolean;
|
|
226
|
+
static: boolean;
|
|
227
|
+
}
|
|
228
|
+
interface FunctionExpression extends BaseFunction, BaseExpression {
|
|
229
|
+
id?: Identifier | null | undefined;
|
|
230
|
+
type: "FunctionExpression";
|
|
231
|
+
body: BlockStatement;
|
|
232
|
+
}
|
|
233
|
+
interface SequenceExpression extends BaseExpression {
|
|
234
|
+
type: "SequenceExpression";
|
|
235
|
+
expressions: Expression[];
|
|
236
|
+
}
|
|
237
|
+
interface UnaryExpression extends BaseExpression {
|
|
238
|
+
type: "UnaryExpression";
|
|
239
|
+
operator: UnaryOperator;
|
|
240
|
+
prefix: true;
|
|
241
|
+
argument: Expression;
|
|
242
|
+
}
|
|
243
|
+
interface BinaryExpression extends BaseExpression {
|
|
244
|
+
type: "BinaryExpression";
|
|
245
|
+
operator: BinaryOperator;
|
|
246
|
+
left: Expression | PrivateIdentifier;
|
|
247
|
+
right: Expression;
|
|
248
|
+
}
|
|
249
|
+
interface AssignmentExpression extends BaseExpression {
|
|
250
|
+
type: "AssignmentExpression";
|
|
251
|
+
operator: AssignmentOperator;
|
|
252
|
+
left: Pattern | MemberExpression;
|
|
253
|
+
right: Expression;
|
|
254
|
+
}
|
|
255
|
+
interface UpdateExpression extends BaseExpression {
|
|
256
|
+
type: "UpdateExpression";
|
|
257
|
+
operator: UpdateOperator;
|
|
258
|
+
argument: Expression;
|
|
259
|
+
prefix: boolean;
|
|
260
|
+
}
|
|
261
|
+
interface LogicalExpression extends BaseExpression {
|
|
262
|
+
type: "LogicalExpression";
|
|
263
|
+
operator: LogicalOperator;
|
|
264
|
+
left: Expression;
|
|
265
|
+
right: Expression;
|
|
266
|
+
}
|
|
267
|
+
interface ConditionalExpression extends BaseExpression {
|
|
268
|
+
type: "ConditionalExpression";
|
|
269
|
+
test: Expression;
|
|
270
|
+
alternate: Expression;
|
|
271
|
+
consequent: Expression;
|
|
272
|
+
}
|
|
273
|
+
interface BaseCallExpression extends BaseExpression {
|
|
274
|
+
callee: Expression | Super;
|
|
275
|
+
arguments: Array<Expression | SpreadElement>;
|
|
276
|
+
}
|
|
277
|
+
type CallExpression = SimpleCallExpression | NewExpression;
|
|
278
|
+
interface SimpleCallExpression extends BaseCallExpression {
|
|
279
|
+
type: "CallExpression";
|
|
280
|
+
optional: boolean;
|
|
281
|
+
}
|
|
282
|
+
interface NewExpression extends BaseCallExpression {
|
|
283
|
+
type: "NewExpression";
|
|
284
|
+
}
|
|
285
|
+
interface MemberExpression extends BaseExpression, BasePattern {
|
|
286
|
+
type: "MemberExpression";
|
|
287
|
+
object: Expression | Super;
|
|
288
|
+
property: Expression | PrivateIdentifier;
|
|
289
|
+
computed: boolean;
|
|
290
|
+
optional: boolean;
|
|
291
|
+
}
|
|
292
|
+
type Pattern = Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression;
|
|
293
|
+
interface BasePattern extends BaseNode {}
|
|
294
|
+
interface SwitchCase extends BaseNode {
|
|
295
|
+
type: "SwitchCase";
|
|
296
|
+
test?: Expression | null | undefined;
|
|
297
|
+
consequent: Statement[];
|
|
298
|
+
}
|
|
299
|
+
interface CatchClause extends BaseNode {
|
|
300
|
+
type: "CatchClause";
|
|
301
|
+
param: Pattern | null;
|
|
302
|
+
body: BlockStatement;
|
|
303
|
+
}
|
|
304
|
+
interface Identifier extends BaseNode, BaseExpression, BasePattern {
|
|
305
|
+
type: "Identifier";
|
|
306
|
+
name: string;
|
|
307
|
+
}
|
|
308
|
+
type Literal = SimpleLiteral | RegExpLiteral | BigIntLiteral;
|
|
309
|
+
interface SimpleLiteral extends BaseNode, BaseExpression {
|
|
310
|
+
type: "Literal";
|
|
311
|
+
value: string | boolean | number | null;
|
|
312
|
+
raw?: string | undefined;
|
|
313
|
+
}
|
|
314
|
+
interface RegExpLiteral extends BaseNode, BaseExpression {
|
|
315
|
+
type: "Literal";
|
|
316
|
+
value?: RegExp | null | undefined;
|
|
317
|
+
regex: {
|
|
318
|
+
pattern: string;
|
|
319
|
+
flags: string;
|
|
320
|
+
};
|
|
321
|
+
raw?: string | undefined;
|
|
322
|
+
}
|
|
323
|
+
interface BigIntLiteral extends BaseNode, BaseExpression {
|
|
324
|
+
type: "Literal";
|
|
325
|
+
value?: bigint | null | undefined;
|
|
326
|
+
bigint: string;
|
|
327
|
+
raw?: string | undefined;
|
|
328
|
+
}
|
|
329
|
+
type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete";
|
|
330
|
+
type BinaryOperator = "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "**" | "|" | "^" | "&" | "in" | "instanceof";
|
|
331
|
+
type LogicalOperator = "||" | "&&" | "??";
|
|
332
|
+
type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "**=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" | "||=" | "&&=" | "??=";
|
|
333
|
+
type UpdateOperator = "++" | "--";
|
|
334
|
+
interface ForOfStatement extends BaseForXStatement {
|
|
335
|
+
type: "ForOfStatement";
|
|
336
|
+
await: boolean;
|
|
337
|
+
}
|
|
338
|
+
interface Super extends BaseNode {
|
|
339
|
+
type: "Super";
|
|
340
|
+
}
|
|
341
|
+
interface SpreadElement extends BaseNode {
|
|
342
|
+
type: "SpreadElement";
|
|
343
|
+
argument: Expression;
|
|
344
|
+
}
|
|
345
|
+
interface ArrowFunctionExpression extends BaseExpression, BaseFunction {
|
|
346
|
+
type: "ArrowFunctionExpression";
|
|
347
|
+
expression: boolean;
|
|
348
|
+
body: BlockStatement | Expression;
|
|
349
|
+
}
|
|
350
|
+
interface YieldExpression extends BaseExpression {
|
|
351
|
+
type: "YieldExpression";
|
|
352
|
+
argument?: Expression | null | undefined;
|
|
353
|
+
delegate: boolean;
|
|
354
|
+
}
|
|
355
|
+
interface TemplateLiteral extends BaseExpression {
|
|
356
|
+
type: "TemplateLiteral";
|
|
357
|
+
quasis: TemplateElement[];
|
|
358
|
+
expressions: Expression[];
|
|
359
|
+
}
|
|
360
|
+
interface TaggedTemplateExpression extends BaseExpression {
|
|
361
|
+
type: "TaggedTemplateExpression";
|
|
362
|
+
tag: Expression;
|
|
363
|
+
quasi: TemplateLiteral;
|
|
364
|
+
}
|
|
365
|
+
interface TemplateElement extends BaseNode {
|
|
366
|
+
type: "TemplateElement";
|
|
367
|
+
tail: boolean;
|
|
368
|
+
value: {
|
|
369
|
+
/** It is null when the template literal is tagged and the text has an invalid escape (e.g. - tag`\unicode and \u{55}`) */cooked?: string | null | undefined;
|
|
370
|
+
raw: string;
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
interface AssignmentProperty extends Property {
|
|
374
|
+
value: Pattern;
|
|
375
|
+
kind: "init";
|
|
376
|
+
method: boolean; // false
|
|
377
|
+
}
|
|
378
|
+
interface ObjectPattern extends BasePattern {
|
|
379
|
+
type: "ObjectPattern";
|
|
380
|
+
properties: Array<AssignmentProperty | RestElement>;
|
|
381
|
+
}
|
|
382
|
+
interface ArrayPattern extends BasePattern {
|
|
383
|
+
type: "ArrayPattern";
|
|
384
|
+
elements: Array<Pattern | null>;
|
|
385
|
+
}
|
|
386
|
+
interface RestElement extends BasePattern {
|
|
387
|
+
type: "RestElement";
|
|
388
|
+
argument: Pattern;
|
|
389
|
+
}
|
|
390
|
+
interface AssignmentPattern extends BasePattern {
|
|
391
|
+
type: "AssignmentPattern";
|
|
392
|
+
left: Pattern;
|
|
393
|
+
right: Expression;
|
|
394
|
+
}
|
|
395
|
+
interface BaseClass extends BaseNode {
|
|
396
|
+
superClass?: Expression | null | undefined;
|
|
397
|
+
body: ClassBody;
|
|
398
|
+
}
|
|
399
|
+
interface ClassBody extends BaseNode {
|
|
400
|
+
type: "ClassBody";
|
|
401
|
+
body: Array<MethodDefinition | PropertyDefinition | StaticBlock>;
|
|
402
|
+
}
|
|
403
|
+
interface MethodDefinition extends BaseNode {
|
|
404
|
+
type: "MethodDefinition";
|
|
405
|
+
key: Expression | PrivateIdentifier;
|
|
406
|
+
value: FunctionExpression;
|
|
407
|
+
kind: "constructor" | "method" | "get" | "set";
|
|
408
|
+
computed: boolean;
|
|
409
|
+
static: boolean;
|
|
410
|
+
}
|
|
411
|
+
interface MaybeNamedClassDeclaration extends BaseClass, BaseDeclaration {
|
|
412
|
+
type: "ClassDeclaration";
|
|
413
|
+
/** It is null when a class declaration is a part of the `export default class` statement */
|
|
414
|
+
id: Identifier | null;
|
|
415
|
+
}
|
|
416
|
+
interface ClassDeclaration extends MaybeNamedClassDeclaration {
|
|
417
|
+
id: Identifier;
|
|
418
|
+
}
|
|
419
|
+
interface ClassExpression extends BaseClass, BaseExpression {
|
|
420
|
+
type: "ClassExpression";
|
|
421
|
+
id?: Identifier | null | undefined;
|
|
422
|
+
}
|
|
423
|
+
interface MetaProperty extends BaseExpression {
|
|
424
|
+
type: "MetaProperty";
|
|
425
|
+
meta: Identifier;
|
|
426
|
+
property: Identifier;
|
|
427
|
+
}
|
|
428
|
+
interface ImportExpression extends BaseExpression {
|
|
429
|
+
type: "ImportExpression";
|
|
430
|
+
source: Expression;
|
|
431
|
+
options?: Expression | null | undefined;
|
|
432
|
+
}
|
|
433
|
+
interface AwaitExpression extends BaseExpression {
|
|
434
|
+
type: "AwaitExpression";
|
|
435
|
+
argument: Expression;
|
|
436
|
+
}
|
|
437
|
+
//#endregion
|
|
438
|
+
export { Expression, ExpressionStatement };
|