eslint-plugin-package-json 0.4.0 → 0.6.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 CHANGED
@@ -6,19 +6,13 @@
6
6
  <a href="#contributors" target="_blank">
7
7
  <!-- prettier-ignore-start -->
8
8
  <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
9
- <img alt="All Contributors: 8 👪" src="https://img.shields.io/badge/all_contributors-8_👪-21bb42.svg" />
9
+ <img alt="All Contributors: 13 👪" src="https://img.shields.io/badge/all_contributors-13_👪-21bb42.svg" />
10
10
  <!-- ALL-CONTRIBUTORS-BADGE:END -->
11
11
  <!-- prettier-ignore-end -->
12
12
  </a>
13
- <a href="https://codecov.io/gh/JoshuaKGoldberg/eslint-plugin-package-json" target="_blank">
14
- <img alt="Codecov Test Coverage" src="https://codecov.io/gh/JoshuaKGoldberg/eslint-plugin-package-json/branch/main/graph/badge.svg"/>
15
- </a>
16
- <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/blob/main/.github/CODE_OF_CONDUCT.md" target="_blank">
17
- <img alt="Contributor Covenant" src="https://img.shields.io/badge/code_of_conduct-enforced-21bb42" />
18
- </a>
19
- <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/blob/main/LICENSE.md" target="_blank">
20
- <img alt="License: MIT" src="https://img.shields.io/github/license/JoshuaKGoldberg/eslint-plugin-package-json?color=21bb42">
21
- </a>
13
+ <a href="https://codecov.io/gh/JoshuaKGoldberg/eslint-plugin-package-json" target="_blank"><img alt="Codecov Test Coverage" src="https://codecov.io/gh/JoshuaKGoldberg/eslint-plugin-package-json/branch/main/graph/badge.svg"/></a>
14
+ <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/blob/main/.github/CODE_OF_CONDUCT.md" target="_blank"><img alt="Contributor Covenant" src="https://img.shields.io/badge/code_of_conduct-enforced-21bb42" /></a>
15
+ <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/blob/main/LICENSE.md" target="_blank"><img alt="License: MIT" src="https://img.shields.io/github/license/JoshuaKGoldberg/eslint-plugin-package-json?color=21bb42"></a>
22
16
  <img alt="Style: Prettier" src="https://img.shields.io/badge/style-prettier-21bb42.svg" />
23
17
  <img alt="TypeScript: Strict" src="https://img.shields.io/badge/typescript-strict-21bb42.svg" />
24
18
  <img alt="npm package version" src="https://img.shields.io/npm/v/eslint-plugin-package-json?color=21bb42" />
@@ -26,17 +20,15 @@
26
20
 
27
21
  ## Installation
28
22
 
29
- You'll first need to install [ESLint](http://eslint.org) >=8 and `eslint-plugin-package-json`:
23
+ This package requires [ESLint](http://eslint.org) 8 and [`jsonc-eslint-parser`](https://github.com/ota-meshi/jsonc-eslint-parser):
30
24
 
31
25
  ```shell
32
26
  npm install eslint eslint-plugin-package-json jsonc-eslint-parser --save-dev
33
27
  ```
34
28
 
35
- **Note:** If you installed ESLint globally (using the `-g` flag) then you must also install `eslint-plugin-package-json` globally.
36
-
37
29
  ## Usage
38
30
 
39
- Add an override to your ESLint configuration file that specifies this plugin, [`jsonc-eslint-parser`](https://github.com/ota-meshi/jsonc-eslint-parser) and its recommended rules for your `package.json` file:
31
+ Add an override to your ESLint configuration file that specifies this plugin, [`jsonc-eslint-parser`](https://github.com/ota-meshi/jsonc-eslint-parser), and its recommended rules for your `package.json` file:
40
32
 
41
33
  ```js
42
34
  module.exports = {
@@ -51,12 +43,14 @@ module.exports = {
51
43
  };
52
44
  ```
53
45
 
54
- Or, individually configure the rules you want to use under the rules section.
46
+ You may also want to individually configure rules.
47
+ See [ESLint's _Configure Rules_ guide](https://eslint.org/docs/latest/use/configure/rules) for details on how to customize your rules.
55
48
 
56
49
  ```js
57
50
  module.exports = {
58
51
  overrides: [
59
52
  {
53
+ extends: ["plugin:package-json/recommended"],
60
54
  files: ["package.json"],
61
55
  parser: "jsonc-eslint-parser",
62
56
  plugins: ["package-json"],
@@ -73,14 +67,17 @@ module.exports = {
73
67
  <!-- prettier-ignore-start -->
74
68
  <!-- begin auto-generated rules list -->
75
69
 
70
+ 💼 Configurations enabled in.\
71
+ ✅ Set in the `recommended` configuration.\
76
72
  🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).
77
73
 
78
- | Name                   | Description | 🔧 |
79
- | :------------------------------------------------------------- | :-------------------------------------------------------------------------------------- | :- |
80
- | [order-properties](docs/rules/order-properties.md) | Package properties must be declared in standard order | 🔧 |
81
- | [sort-collections](docs/rules/sort-collections.md) | Dependencies, scripts, and configuration values must be declared in alphabetical order. | 🔧 |
82
- | [valid-local-dependency](docs/rules/valid-local-dependency.md) | Checks existence of local dependencies in the package.json | |
83
- | [valid-package-def](docs/rules/valid-package-def.md) | Enforce that package.json has all properties required by NPM spec | |
74
+ | Name                        | Description | 💼 | 🔧 |
75
+ | :----------------------------------------------------------------------- | :-------------------------------------------------------------------------------------- | :- | :- |
76
+ | [order-properties](docs/rules/order-properties.md) | Package properties must be declared in standard order | ✅ | 🔧 |
77
+ | [prefer-repository-shorthand](docs/rules/prefer-repository-shorthand.md) | Enforce shorthand declaration for GitHub repository. | | 🔧 |
78
+ | [sort-collections](docs/rules/sort-collections.md) | Dependencies, scripts, and configuration values must be declared in alphabetical order. || 🔧 |
79
+ | [valid-local-dependency](docs/rules/valid-local-dependency.md) | Checks existence of local dependencies in the package.json | | |
80
+ | [valid-package-def](docs/rules/valid-package-def.md) | Enforce that package.json has all properties required by the npm spec | ✅ | |
84
81
 
85
82
  <!-- end auto-generated rules list -->
86
83
  <!-- prettier-ignore-end -->
@@ -96,15 +93,20 @@ These rules only run on `package.json` files; they will ignore all other files b
96
93
  <table>
97
94
  <tbody>
98
95
  <tr>
96
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/AndreasLindbergPAF"><img src="https://avatars.githubusercontent.com/u/59874563?v=4?s=100" width="100px;" alt="Andreas Lindberg"/><br /><sub><b>Andreas Lindberg</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3Aandreaslindbergpaf" title="Bug reports">🐛</a></td>
97
+ <td align="center" valign="top" width="14.28%"><a href="http://technotes.khitrenovich.com/"><img src="https://avatars.githubusercontent.com/u/3424762?v=4?s=100" width="100px;" alt="Anton Khitrenovich"/><br /><sub><b>Anton Khitrenovich</b></sub></a><br /><a href="#ideas-khitrenovich" title="Ideas, Planning, & Feedback">🤔</a></td>
98
+ <td align="center" valign="top" width="14.28%"><a href="https://azat.io"><img src="https://avatars.githubusercontent.com/u/5698350?v=4?s=100" width="100px;" alt="Azat S."/><br /><sub><b>Azat S.</b></sub></a><br /><a href="#ideas-azat-io" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=azat-io" title="Code">💻</a></td>
99
99
  <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></td>
100
100
  <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>
101
101
  <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>
102
- <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></td>
102
+ <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></td>
103
+ </tr>
104
+ <tr>
103
105
  <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>
106
+ <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></td>
104
107
  <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>
105
108
  <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>
106
- </tr>
107
- <tr>
109
+ <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>
108
110
  <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>
109
111
  </tr>
110
112
  </tbody>
package/lib/index.d.mts CHANGED
@@ -10,6 +10,10 @@ declare const rules: {
10
10
  } | undefined)?]>): jsonc_eslint_parser.RuleListener;
11
11
  meta: eslint.Rule.RuleMetaData;
12
12
  };
13
+ "prefer-repository-shorthand": {
14
+ create(context: PackageJsonRuleContext<unknown[]>): jsonc_eslint_parser.RuleListener;
15
+ meta: eslint.Rule.RuleMetaData;
16
+ };
13
17
  "sort-collections": {
14
18
  create(context: PackageJsonRuleContext<string[]>): jsonc_eslint_parser.RuleListener;
15
19
  meta: eslint.Rule.RuleMetaData;
package/lib/index.d.ts CHANGED
@@ -10,6 +10,10 @@ declare const rules: {
10
10
  } | undefined)?]>): jsonc_eslint_parser.RuleListener;
11
11
  meta: eslint.Rule.RuleMetaData;
12
12
  };
13
+ "prefer-repository-shorthand": {
14
+ create(context: PackageJsonRuleContext<unknown[]>): jsonc_eslint_parser.RuleListener;
15
+ meta: eslint.Rule.RuleMetaData;
16
+ };
13
17
  "sort-collections": {
14
18
  create(context: PackageJsonRuleContext<string[]>): jsonc_eslint_parser.RuleListener;
15
19
  meta: eslint.Rule.RuleMetaData;
package/lib/index.js CHANGED
@@ -33,11 +33,13 @@ __export(src_exports, {
33
33
  });
34
34
  module.exports = __toCommonJS(src_exports);
35
35
  var import_order_properties = __toESM(require("./rules/order-properties.js"));
36
+ var import_prefer_repository_shorthand = __toESM(require("./rules/prefer-repository-shorthand.js"));
36
37
  var import_sort_collections = __toESM(require("./rules/sort-collections.js"));
37
38
  var import_valid_local_dependency = __toESM(require("./rules/valid-local-dependency.js"));
38
39
  var import_valid_package_def = __toESM(require("./rules/valid-package-def.js"));
39
40
  const rules = {
40
41
  "order-properties": import_order_properties.default,
42
+ "prefer-repository-shorthand": import_prefer_repository_shorthand.default,
41
43
  "sort-collections": import_sort_collections.default,
42
44
  "valid-local-dependency": import_valid_local_dependency.default,
43
45
  "valid-package-def": import_valid_package_def.default
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import orderProperties from \"./rules/order-properties.js\";\nimport sortCollections from \"./rules/sort-collections.js\";\nimport validLocalDependency from \"./rules/valid-local-dependency.js\";\nimport validPackageDef from \"./rules/valid-package-def.js\";\n\nexport const rules = {\n\t\"order-properties\": orderProperties,\n\t\"sort-collections\": sortCollections,\n\t\"valid-local-dependency\": validLocalDependency,\n\t\"valid-package-def\": validPackageDef,\n};\n\nexport const configs = {\n\trecommended: {\n\t\trules: Object.fromEntries(\n\t\t\tObject.entries(rules)\n\t\t\t\t.filter(([, rule]) => rule.meta.docs?.recommended)\n\t\t\t\t.map(([name]) => [\"package-json/\" + name, \"error\" as const]),\n\t\t),\n\t},\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAA4B;AAC5B,8BAA4B;AAC5B,oCAAiC;AACjC,+BAA4B;AAErB,MAAM,QAAQ;AAAA,EACpB,oBAAoB,wBAAAA;AAAA,EACpB,oBAAoB,wBAAAC;AAAA,EACpB,0BAA0B,8BAAAC;AAAA,EAC1B,qBAAqB,yBAAAC;AACtB;AAEO,MAAM,UAAU;AAAA,EACtB,aAAa;AAAA,IACZ,OAAO,OAAO;AAAA,MACb,OAAO,QAAQ,KAAK,EAClB,OAAO,CAAC,CAAC,EAAE,IAAI,MAAM,KAAK,KAAK,MAAM,WAAW,EAChD,IAAI,CAAC,CAAC,IAAI,MAAM,CAAC,kBAAkB,MAAM,OAAgB,CAAC;AAAA,IAC7D;AAAA,EACD;AACD;","names":["orderProperties","sortCollections","validLocalDependency","validPackageDef"]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import orderProperties from \"./rules/order-properties.js\";\nimport preferRepositoryShorthand from \"./rules/prefer-repository-shorthand.js\";\nimport sortCollections from \"./rules/sort-collections.js\";\nimport validLocalDependency from \"./rules/valid-local-dependency.js\";\nimport validPackageDef from \"./rules/valid-package-def.js\";\n\nexport const rules = {\n\t\"order-properties\": orderProperties,\n\t\"prefer-repository-shorthand\": preferRepositoryShorthand,\n\t\"sort-collections\": sortCollections,\n\t\"valid-local-dependency\": validLocalDependency,\n\t\"valid-package-def\": validPackageDef,\n};\n\nexport const configs = {\n\trecommended: {\n\t\trules: Object.fromEntries(\n\t\t\tObject.entries(rules)\n\t\t\t\t.filter(([, rule]) => rule.meta.docs?.recommended)\n\t\t\t\t.map(([name]) => [\"package-json/\" + name, \"error\" as const]),\n\t\t),\n\t},\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAA4B;AAC5B,yCAAsC;AACtC,8BAA4B;AAC5B,oCAAiC;AACjC,+BAA4B;AAErB,MAAM,QAAQ;AAAA,EACpB,oBAAoB,wBAAAA;AAAA,EACpB,+BAA+B,mCAAAC;AAAA,EAC/B,oBAAoB,wBAAAC;AAAA,EACpB,0BAA0B,8BAAAC;AAAA,EAC1B,qBAAqB,yBAAAC;AACtB;AAEO,MAAM,UAAU;AAAA,EACtB,aAAa;AAAA,IACZ,OAAO,OAAO;AAAA,MACb,OAAO,QAAQ,KAAK,EAClB,OAAO,CAAC,CAAC,EAAE,IAAI,MAAM,KAAK,KAAK,MAAM,WAAW,EAChD,IAAI,CAAC,CAAC,IAAI,MAAM,CAAC,kBAAkB,MAAM,OAAgB,CAAC;AAAA,IAC7D;AAAA,EACD;AACD;","names":["orderProperties","preferRepositoryShorthand","sortCollections","validLocalDependency","validPackageDef"]}
package/lib/index.mjs CHANGED
@@ -1,9 +1,11 @@
1
1
  import orderProperties from "./rules/order-properties.js";
2
+ import preferRepositoryShorthand from "./rules/prefer-repository-shorthand.js";
2
3
  import sortCollections from "./rules/sort-collections.js";
3
4
  import validLocalDependency from "./rules/valid-local-dependency.js";
4
5
  import validPackageDef from "./rules/valid-package-def.js";
5
6
  const rules = {
6
7
  "order-properties": orderProperties,
8
+ "prefer-repository-shorthand": preferRepositoryShorthand,
7
9
  "sort-collections": sortCollections,
8
10
  "valid-local-dependency": validLocalDependency,
9
11
  "valid-package-def": validPackageDef
package/lib/index.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import orderProperties from \"./rules/order-properties.js\";\nimport sortCollections from \"./rules/sort-collections.js\";\nimport validLocalDependency from \"./rules/valid-local-dependency.js\";\nimport validPackageDef from \"./rules/valid-package-def.js\";\n\nexport const rules = {\n\t\"order-properties\": orderProperties,\n\t\"sort-collections\": sortCollections,\n\t\"valid-local-dependency\": validLocalDependency,\n\t\"valid-package-def\": validPackageDef,\n};\n\nexport const configs = {\n\trecommended: {\n\t\trules: Object.fromEntries(\n\t\t\tObject.entries(rules)\n\t\t\t\t.filter(([, rule]) => rule.meta.docs?.recommended)\n\t\t\t\t.map(([name]) => [\"package-json/\" + name, \"error\" as const]),\n\t\t),\n\t},\n};\n"],"mappings":"AAAA,OAAO,qBAAqB;AAC5B,OAAO,qBAAqB;AAC5B,OAAO,0BAA0B;AACjC,OAAO,qBAAqB;AAErB,MAAM,QAAQ;AAAA,EACpB,oBAAoB;AAAA,EACpB,oBAAoB;AAAA,EACpB,0BAA0B;AAAA,EAC1B,qBAAqB;AACtB;AAEO,MAAM,UAAU;AAAA,EACtB,aAAa;AAAA,IACZ,OAAO,OAAO;AAAA,MACb,OAAO,QAAQ,KAAK,EAClB,OAAO,CAAC,CAAC,EAAE,IAAI,MAAM,KAAK,KAAK,MAAM,WAAW,EAChD,IAAI,CAAC,CAAC,IAAI,MAAM,CAAC,kBAAkB,MAAM,OAAgB,CAAC;AAAA,IAC7D;AAAA,EACD;AACD;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import orderProperties from \"./rules/order-properties.js\";\nimport preferRepositoryShorthand from \"./rules/prefer-repository-shorthand.js\";\nimport sortCollections from \"./rules/sort-collections.js\";\nimport validLocalDependency from \"./rules/valid-local-dependency.js\";\nimport validPackageDef from \"./rules/valid-package-def.js\";\n\nexport const rules = {\n\t\"order-properties\": orderProperties,\n\t\"prefer-repository-shorthand\": preferRepositoryShorthand,\n\t\"sort-collections\": sortCollections,\n\t\"valid-local-dependency\": validLocalDependency,\n\t\"valid-package-def\": validPackageDef,\n};\n\nexport const configs = {\n\trecommended: {\n\t\trules: Object.fromEntries(\n\t\t\tObject.entries(rules)\n\t\t\t\t.filter(([, rule]) => rule.meta.docs?.recommended)\n\t\t\t\t.map(([name]) => [\"package-json/\" + name, \"error\" as const]),\n\t\t),\n\t},\n};\n"],"mappings":"AAAA,OAAO,qBAAqB;AAC5B,OAAO,+BAA+B;AACtC,OAAO,qBAAqB;AAC5B,OAAO,0BAA0B;AACjC,OAAO,qBAAqB;AAErB,MAAM,QAAQ;AAAA,EACpB,oBAAoB;AAAA,EACpB,+BAA+B;AAAA,EAC/B,oBAAoB;AAAA,EACpB,0BAA0B;AAAA,EAC1B,qBAAqB;AACtB;AAEO,MAAM,UAAU;AAAA,EACtB,aAAa;AAAA,IACZ,OAAO,OAAO;AAAA,MACb,OAAO,QAAQ,KAAK,EAClB,OAAO,CAAC,CAAC,EAAE,IAAI,MAAM,KAAK,KAAK,MAAM,WAAW,EAChD,IAAI,CAAC,CAAC,IAAI,MAAM,CAAC,kBAAkB,MAAM,OAAgB,CAAC;AAAA,IAC7D;AAAA,EACD;AACD;","names":[]}
@@ -68,7 +68,10 @@ var order_properties_default = (0, import_createRule.createRule)({
68
68
  return {
69
69
  "Program:exit"() {
70
70
  const { ast, text } = context.sourceCode;
71
- const options = context.options[0] ?? { order: "legacy" };
71
+ const options = {
72
+ order: "sort-package-json",
73
+ ...context.options[0]
74
+ };
72
75
  const requiredOrder = options.order === "legacy" ? standardOrderLegacy : options.order;
73
76
  const orderedSource = (0, import_sort_package_json.default)(
74
77
  JSON.parse(text),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/rules/order-properties.ts"],"sourcesContent":["import sortPackageJson from \"sort-package-json\";\n\nimport { createRule } from \"../createRule.js\";\n\nconst standardOrderLegacy = [\n\t\"name\",\n\t\"version\",\n\t\"private\",\n\t\"publishConfig\",\n\t\"description\",\n\t\"main\",\n\t\"exports\",\n\t\"browser\",\n\t\"files\",\n\t\"bin\",\n\t\"directories\",\n\t\"man\",\n\t\"scripts\",\n\t\"repository\",\n\t\"keywords\",\n\t\"author\",\n\t\"license\",\n\t\"bugs\",\n\t\"homepage\",\n\t\"config\",\n\t\"dependencies\",\n\t\"devDependencies\",\n\t\"peerDependencies\",\n\t\"optionalDependencies\",\n\t\"bundledDependencies\",\n\t\"engines\",\n\t\"os\",\n\t\"cpu\",\n];\n\ntype Order = \"legacy\" | \"sort-package-json\";\n\ntype Options = [{ order: Order }?];\n\nexport default createRule<Options>({\n\tcreate(context) {\n\t\treturn {\n\t\t\t\"Program:exit\"() {\n\t\t\t\tconst { ast, text } = context.sourceCode;\n\n\t\t\t\tconst options = context.options[0] ?? { order: \"legacy\" };\n\t\t\t\tconst requiredOrder =\n\t\t\t\t\toptions.order === \"legacy\"\n\t\t\t\t\t\t? standardOrderLegacy\n\t\t\t\t\t\t: options.order;\n\t\t\t\tconst orderedSource = sortPackageJson(\n\t\t\t\t\tJSON.parse(text) as object,\n\t\t\t\t\trequiredOrder === \"sort-package-json\"\n\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\tsortOrder: requiredOrder,\n\t\t\t\t\t\t },\n\t\t\t\t);\n\t\t\t\tconst orderedKeys = Object.keys(orderedSource);\n\n\t\t\t\tconst { properties } = ast.body[0].expression;\n\n\t\t\t\tfor (let i = 0; i < properties.length; i += 1) {\n\t\t\t\t\tif (properties[i].value !== orderedKeys[i]) {\n\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\t\t\treturn fixer.replaceText(\n\t\t\t\t\t\t\t\t\tcontext.sourceCode.ast,\n\t\t\t\t\t\t\t\t\tJSON.stringify(orderedSource, null, 2) +\n\t\t\t\t\t\t\t\t\t\t`\\n`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\"Package top-level properties are not ordered in the npm standard way. Run the ESLint auto-fixer to correct.\",\n\t\t\t\t\t\t\tnode: context.sourceCode.ast,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n\n\tmeta: {\n\t\tdocs: {\n\t\t\tcategory: \"Best Practices\",\n\t\t\tdescription:\n\t\t\t\t\"Package properties must be declared in standard order\",\n\t\t\trecommended: true,\n\t\t},\n\t\tfixable: \"code\",\n\t\tschema: [\n\t\t\t{\n\t\t\t\tproperties: {\n\t\t\t\t\torder: {\n\t\t\t\t\t\tanyOf: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tenum: [\"legacy\", \"sort-package-json\"],\n\t\t\t\t\t\t\t\ttype: [\"string\"],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\titems: {\n\t\t\t\t\t\t\t\t\ttype: [\"string\"],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\ttype: [\"array\"],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\ttype: \"object\",\n\t\t\t},\n\t\t],\n\t},\n});\n"],"mappings":";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A,UACF;AAEA;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAAA,EAEA,MAAM;AAAA,IACL,MAAM;AAAA,MACL,UAAU;AAAA,MACV,aACC;AAAA,MACD,aAAa;AAAA,IACd;AAAA,IACA,SAAS;AAAA,IACT,QAAQ;AAAA,MACP;AAAA,QACC,YAAY;AAAA,UACX,OAAO;AAAA,YACN,OAAO;AAAA,cACN;AAAA,gBACC,MAAM,CAAC,UAAU,mBAAmB;AAAA,gBACpC,MAAM,CAAC,QAAQ;AAAA,cAChB;AAAA,cACA;AAAA,gBACC,OAAO;AAAA,kBACN,MAAM,CAAC,QAAQ;AAAA,gBAChB;AAAA,gBACA,MAAM,CAAC,OAAO;AAAA,cACf;AAAA,YACD;AAAA,UACD;AAAA,QACD;AAAA,QACA,MAAM;AAAA,MACP;AAAA,IACD;AAAA,EACD;AACD,CAAC;","names":["sortPackageJson"]}
1
+ {"version":3,"sources":["../../src/rules/order-properties.ts"],"sourcesContent":["import sortPackageJson from \"sort-package-json\";\n\nimport { createRule } from \"../createRule.js\";\n\nconst standardOrderLegacy = [\n\t\"name\",\n\t\"version\",\n\t\"private\",\n\t\"publishConfig\",\n\t\"description\",\n\t\"main\",\n\t\"exports\",\n\t\"browser\",\n\t\"files\",\n\t\"bin\",\n\t\"directories\",\n\t\"man\",\n\t\"scripts\",\n\t\"repository\",\n\t\"keywords\",\n\t\"author\",\n\t\"license\",\n\t\"bugs\",\n\t\"homepage\",\n\t\"config\",\n\t\"dependencies\",\n\t\"devDependencies\",\n\t\"peerDependencies\",\n\t\"optionalDependencies\",\n\t\"bundledDependencies\",\n\t\"engines\",\n\t\"os\",\n\t\"cpu\",\n];\n\ntype Order = \"legacy\" | \"sort-package-json\";\n\ntype Options = [{ order: Order }?];\n\nexport default createRule<Options>({\n\tcreate(context) {\n\t\treturn {\n\t\t\t\"Program:exit\"() {\n\t\t\t\tconst { ast, text } = context.sourceCode;\n\n\t\t\t\tconst options = {\n\t\t\t\t\torder: \"sort-package-json\",\n\t\t\t\t\t...context.options[0],\n\t\t\t\t} satisfies Options[0];\n\n\t\t\t\tconst requiredOrder =\n\t\t\t\t\toptions.order === \"legacy\"\n\t\t\t\t\t\t? standardOrderLegacy\n\t\t\t\t\t\t: options.order;\n\t\t\t\tconst orderedSource = sortPackageJson(\n\t\t\t\t\tJSON.parse(text) as object,\n\t\t\t\t\trequiredOrder === \"sort-package-json\"\n\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\tsortOrder: requiredOrder,\n\t\t\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t\tconst orderedKeys = Object.keys(orderedSource);\n\n\t\t\t\tconst { properties } = ast.body[0].expression;\n\n\t\t\t\tfor (let i = 0; i < properties.length; i += 1) {\n\t\t\t\t\tif (properties[i].value !== orderedKeys[i]) {\n\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\t\t\treturn fixer.replaceText(\n\t\t\t\t\t\t\t\t\tcontext.sourceCode.ast,\n\t\t\t\t\t\t\t\t\tJSON.stringify(orderedSource, null, 2) +\n\t\t\t\t\t\t\t\t\t\t`\\n`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\"Package top-level properties are not ordered in the npm standard way. Run the ESLint auto-fixer to correct.\",\n\t\t\t\t\t\t\tnode: context.sourceCode.ast,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n\n\tmeta: {\n\t\tdocs: {\n\t\t\tcategory: \"Best Practices\",\n\t\t\tdescription:\n\t\t\t\t\"Package properties must be declared in standard order\",\n\t\t\trecommended: true,\n\t\t},\n\t\tfixable: \"code\",\n\t\tschema: [\n\t\t\t{\n\t\t\t\tproperties: {\n\t\t\t\t\torder: {\n\t\t\t\t\t\tanyOf: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tenum: [\"legacy\", \"sort-package-json\"],\n\t\t\t\t\t\t\t\ttype: [\"string\"],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\titems: {\n\t\t\t\t\t\t\t\t\ttype: [\"string\"],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\ttype: [\"array\"],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\ttype: \"object\",\n\t\t\t},\n\t\t],\n\t},\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAA4B;AAE5B,wBAA2B;AAE3B,MAAM,sBAAsB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAMA,IAAO,+BAAQ,8BAAoB;AAAA,EAClC,OAAO,SAAS;AACf,WAAO;AAAA,MACN,iBAAiB;AAChB,cAAM,EAAE,KAAK,KAAK,IAAI,QAAQ;AAE9B,cAAM,UAAU;AAAA,UACf,OAAO;AAAA,UACP,GAAG,QAAQ,QAAQ,CAAC;AAAA,QACrB;AAEA,cAAM,gBACL,QAAQ,UAAU,WACf,sBACA,QAAQ;AACZ,cAAM,oBAAgB,yBAAAA;AAAA,UACrB,KAAK,MAAM,IAAI;AAAA,UACf,kBAAkB,sBACf,SACA;AAAA,YACA,WAAW;AAAA,UACZ;AAAA,QACH;AACA,cAAM,cAAc,OAAO,KAAK,aAAa;AAE7C,cAAM,EAAE,WAAW,IAAI,IAAI,KAAK,CAAC,EAAE;AAEnC,iBAAS,IAAI,GAAG,IAAI,WAAW,QAAQ,KAAK,GAAG;AAC9C,cAAI,WAAW,CAAC,EAAE,UAAU,YAAY,CAAC,GAAG;AAC3C,oBAAQ,OAAO;AAAA,cACd,IAAI,OAAO;AACV,uBAAO,MAAM;AAAA,kBACZ,QAAQ,WAAW;AAAA,kBACnB,KAAK,UAAU,eAAe,MAAM,CAAC,IACpC;AAAA;AAAA,gBACF;AAAA,cACD;AAAA,cACA,SACC;AAAA,cACD,MAAM,QAAQ,WAAW;AAAA,YAC1B,CAAC;AAAA,UACF;AAEA;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAAA,EAEA,MAAM;AAAA,IACL,MAAM;AAAA,MACL,UAAU;AAAA,MACV,aACC;AAAA,MACD,aAAa;AAAA,IACd;AAAA,IACA,SAAS;AAAA,IACT,QAAQ;AAAA,MACP;AAAA,QACC,YAAY;AAAA,UACX,OAAO;AAAA,YACN,OAAO;AAAA,cACN;AAAA,gBACC,MAAM,CAAC,UAAU,mBAAmB;AAAA,gBACpC,MAAM,CAAC,QAAQ;AAAA,cAChB;AAAA,cACA;AAAA,gBACC,OAAO;AAAA,kBACN,MAAM,CAAC,QAAQ;AAAA,gBAChB;AAAA,gBACA,MAAM,CAAC,OAAO;AAAA,cACf;AAAA,YACD;AAAA,UACD;AAAA,QACD;AAAA,QACA,MAAM;AAAA,MACP;AAAA,IACD;AAAA,EACD;AACD,CAAC;","names":["sortPackageJson"]}
@@ -35,7 +35,10 @@ var order_properties_default = createRule({
35
35
  return {
36
36
  "Program:exit"() {
37
37
  const { ast, text } = context.sourceCode;
38
- const options = context.options[0] ?? { order: "legacy" };
38
+ const options = {
39
+ order: "sort-package-json",
40
+ ...context.options[0]
41
+ };
39
42
  const requiredOrder = options.order === "legacy" ? standardOrderLegacy : options.order;
40
43
  const orderedSource = sortPackageJson(
41
44
  JSON.parse(text),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/rules/order-properties.ts"],"sourcesContent":["import sortPackageJson from \"sort-package-json\";\n\nimport { createRule } from \"../createRule.js\";\n\nconst standardOrderLegacy = [\n\t\"name\",\n\t\"version\",\n\t\"private\",\n\t\"publishConfig\",\n\t\"description\",\n\t\"main\",\n\t\"exports\",\n\t\"browser\",\n\t\"files\",\n\t\"bin\",\n\t\"directories\",\n\t\"man\",\n\t\"scripts\",\n\t\"repository\",\n\t\"keywords\",\n\t\"author\",\n\t\"license\",\n\t\"bugs\",\n\t\"homepage\",\n\t\"config\",\n\t\"dependencies\",\n\t\"devDependencies\",\n\t\"peerDependencies\",\n\t\"optionalDependencies\",\n\t\"bundledDependencies\",\n\t\"engines\",\n\t\"os\",\n\t\"cpu\",\n];\n\ntype Order = \"legacy\" | \"sort-package-json\";\n\ntype Options = [{ order: Order }?];\n\nexport default createRule<Options>({\n\tcreate(context) {\n\t\treturn {\n\t\t\t\"Program:exit\"() {\n\t\t\t\tconst { ast, text } = context.sourceCode;\n\n\t\t\t\tconst options = context.options[0] ?? { order: \"legacy\" };\n\t\t\t\tconst requiredOrder =\n\t\t\t\t\toptions.order === \"legacy\"\n\t\t\t\t\t\t? standardOrderLegacy\n\t\t\t\t\t\t: options.order;\n\t\t\t\tconst orderedSource = sortPackageJson(\n\t\t\t\t\tJSON.parse(text) as object,\n\t\t\t\t\trequiredOrder === \"sort-package-json\"\n\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\tsortOrder: requiredOrder,\n\t\t\t\t\t\t },\n\t\t\t\t);\n\t\t\t\tconst orderedKeys = Object.keys(orderedSource);\n\n\t\t\t\tconst { properties } = ast.body[0].expression;\n\n\t\t\t\tfor (let i = 0; i < properties.length; i += 1) {\n\t\t\t\t\tif (properties[i].value !== orderedKeys[i]) {\n\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\t\t\treturn fixer.replaceText(\n\t\t\t\t\t\t\t\t\tcontext.sourceCode.ast,\n\t\t\t\t\t\t\t\t\tJSON.stringify(orderedSource, null, 2) +\n\t\t\t\t\t\t\t\t\t\t`\\n`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\"Package top-level properties are not ordered in the npm standard way. Run the ESLint auto-fixer to correct.\",\n\t\t\t\t\t\t\tnode: context.sourceCode.ast,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n\n\tmeta: {\n\t\tdocs: {\n\t\t\tcategory: \"Best Practices\",\n\t\t\tdescription:\n\t\t\t\t\"Package properties must be declared in standard order\",\n\t\t\trecommended: true,\n\t\t},\n\t\tfixable: \"code\",\n\t\tschema: [\n\t\t\t{\n\t\t\t\tproperties: {\n\t\t\t\t\torder: {\n\t\t\t\t\t\tanyOf: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tenum: [\"legacy\", \"sort-package-json\"],\n\t\t\t\t\t\t\t\ttype: [\"string\"],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\titems: {\n\t\t\t\t\t\t\t\t\ttype: [\"string\"],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\ttype: [\"array\"],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\ttype: \"object\",\n\t\t\t},\n\t\t],\n\t},\n});\n"],"mappings":"AAAA,OAAO,qBAAqB;AAE5B,SAAS,kBAAkB;AAE3B,MAAM,sBAAsB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;A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AC,UAAU,mBAAmB;AAAA,gBACpC,MAAM,CAAC,QAAQ;AAAA,cAChB;AAAA,cACA;AAAA,gBACC,OAAO;AAAA,kBACN,MAAM,CAAC,QAAQ;AAAA,gBAChB;AAAA,gBACA,MAAM,CAAC,OAAO;AAAA,cACf;AAAA,YACD;AAAA,UACD;AAAA,QACD;AAAA,QACA,MAAM;AAAA,MACP;AAAA,IACD;AAAA,EACD;AACD,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../src/rules/order-properties.ts"],"sourcesContent":["import sortPackageJson from \"sort-package-json\";\n\nimport { createRule } from \"../createRule.js\";\n\nconst standardOrderLegacy = [\n\t\"name\",\n\t\"version\",\n\t\"private\",\n\t\"publishConfig\",\n\t\"description\",\n\t\"main\",\n\t\"exports\",\n\t\"browser\",\n\t\"files\",\n\t\"bin\",\n\t\"directories\",\n\t\"man\",\n\t\"scripts\",\n\t\"repository\",\n\t\"keywords\",\n\t\"author\",\n\t\"license\",\n\t\"bugs\",\n\t\"homepage\",\n\t\"config\",\n\t\"dependencies\",\n\t\"devDependencies\",\n\t\"peerDependencies\",\n\t\"optionalDependencies\",\n\t\"bundledDependencies\",\n\t\"engines\",\n\t\"os\",\n\t\"cpu\",\n];\n\ntype Order = \"legacy\" | \"sort-package-json\";\n\ntype Options = [{ order: Order }?];\n\nexport default createRule<Options>({\n\tcreate(context) {\n\t\treturn {\n\t\t\t\"Program:exit\"() {\n\t\t\t\tconst { ast, text } = context.sourceCode;\n\n\t\t\t\tconst options = {\n\t\t\t\t\torder: \"sort-package-json\",\n\t\t\t\t\t...context.options[0],\n\t\t\t\t} satisfies Options[0];\n\n\t\t\t\tconst requiredOrder =\n\t\t\t\t\toptions.order === \"legacy\"\n\t\t\t\t\t\t? standardOrderLegacy\n\t\t\t\t\t\t: options.order;\n\t\t\t\tconst orderedSource = sortPackageJson(\n\t\t\t\t\tJSON.parse(text) as object,\n\t\t\t\t\trequiredOrder === \"sort-package-json\"\n\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\tsortOrder: requiredOrder,\n\t\t\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t\tconst orderedKeys = Object.keys(orderedSource);\n\n\t\t\t\tconst { properties } = ast.body[0].expression;\n\n\t\t\t\tfor (let i = 0; i < properties.length; i += 1) {\n\t\t\t\t\tif (properties[i].value !== orderedKeys[i]) {\n\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\t\t\treturn fixer.replaceText(\n\t\t\t\t\t\t\t\t\tcontext.sourceCode.ast,\n\t\t\t\t\t\t\t\t\tJSON.stringify(orderedSource, null, 2) +\n\t\t\t\t\t\t\t\t\t\t`\\n`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\"Package top-level properties are not ordered in the npm standard way. Run the ESLint auto-fixer to correct.\",\n\t\t\t\t\t\t\tnode: context.sourceCode.ast,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n\n\tmeta: {\n\t\tdocs: {\n\t\t\tcategory: \"Best Practices\",\n\t\t\tdescription:\n\t\t\t\t\"Package properties must be declared in standard order\",\n\t\t\trecommended: true,\n\t\t},\n\t\tfixable: \"code\",\n\t\tschema: [\n\t\t\t{\n\t\t\t\tproperties: {\n\t\t\t\t\torder: {\n\t\t\t\t\t\tanyOf: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tenum: [\"legacy\", \"sort-package-json\"],\n\t\t\t\t\t\t\t\ttype: [\"string\"],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\titems: {\n\t\t\t\t\t\t\t\t\ttype: [\"string\"],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\ttype: [\"array\"],\n\t\t\t\t\t\t\t},\n\t\t\t\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A,SACC;AAAA,cACD,MAAM,QAAQ,WAAW;AAAA,YAC1B,CAAC;AAAA,UACF;AAEA;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAAA,EAEA,MAAM;AAAA,IACL,MAAM;AAAA,MACL,UAAU;AAAA,MACV,aACC;AAAA,MACD,aAAa;AAAA,IACd;AAAA,IACA,SAAS;AAAA,IACT,QAAQ;AAAA,MACP;AAAA,QACC,YAAY;AAAA,UACX,OAAO;AAAA,YACN,OAAO;AAAA,cACN;AAAA,gBACC,MAAM,CAAC,UAAU,mBAAmB;AAAA,gBACpC,MAAM,CAAC,QAAQ;AAAA,cAChB;AAAA,cACA;AAAA,gBACC,OAAO;AAAA,kBACN,MAAM,CAAC,QAAQ;AAAA,gBAChB;AAAA,gBACA,MAAM,CAAC,OAAO;AAAA,cACf;AAAA,YACD;AAAA,UACD;AAAA,QACD;AAAA,QACA,MAAM;AAAA,MACP;AAAA,IACD;AAAA,EACD;AACD,CAAC;","names":[]}
@@ -0,0 +1,11 @@
1
+ import * as eslint from 'eslint';
2
+ import * as jsonc_eslint_parser from 'jsonc-eslint-parser';
3
+ import { PackageJsonRuleContext } from '../createRule.mjs';
4
+ import 'estree';
5
+
6
+ declare const _default: {
7
+ create(context: PackageJsonRuleContext<unknown[]>): jsonc_eslint_parser.RuleListener;
8
+ meta: eslint.Rule.RuleMetaData;
9
+ };
10
+
11
+ export { _default as default };
@@ -0,0 +1,11 @@
1
+ import * as eslint from 'eslint';
2
+ import * as jsonc_eslint_parser from 'jsonc-eslint-parser';
3
+ import { PackageJsonRuleContext } from '../createRule.js';
4
+ import 'estree';
5
+
6
+ declare const _default: {
7
+ create(context: PackageJsonRuleContext<unknown[]>): jsonc_eslint_parser.RuleListener;
8
+ meta: eslint.Rule.RuleMetaData;
9
+ };
10
+
11
+ export { _default as default };
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var prefer_repository_shorthand_exports = {};
20
+ __export(prefer_repository_shorthand_exports, {
21
+ default: () => prefer_repository_shorthand_default
22
+ });
23
+ module.exports = __toCommonJS(prefer_repository_shorthand_exports);
24
+ var import_createRule = require("../createRule.js");
25
+ const githubUrlRegex = /^(?:git\+)?(?:ssh:\/\/git@|http?s:\/\/)?(?:www\.)?github\.com\//;
26
+ const isGitHubUrl = (url) => githubUrlRegex.test(url);
27
+ const cleanGitHubUrl = (url) => url.replace(githubUrlRegex, "").replace(/\.git$/, "");
28
+ function findJSONLiteralWithValue(properties, value) {
29
+ return properties.find(
30
+ (property) => property.key.type === "JSONLiteral" && property.key.value === value
31
+ );
32
+ }
33
+ var prefer_repository_shorthand_default = (0, import_createRule.createRule)({
34
+ create(context) {
35
+ return {
36
+ JSONProperty(node) {
37
+ if (node.key.type !== "JSONLiteral" || node.key.value !== "repository" || node.parent.parent.parent.type !== "Program") {
38
+ return;
39
+ }
40
+ if (node.value.type === "JSONObjectExpression") {
41
+ const { properties } = node.value;
42
+ if (findJSONLiteralWithValue(properties, "directory")) {
43
+ return;
44
+ }
45
+ const typeProperty = findJSONLiteralWithValue(
46
+ properties,
47
+ "type"
48
+ );
49
+ if (typeProperty?.value.type !== "JSONLiteral" || typeProperty.value.value !== "git") {
50
+ return;
51
+ }
52
+ const urlProperty = findJSONLiteralWithValue(
53
+ properties,
54
+ "url"
55
+ );
56
+ if (urlProperty?.value.type !== "JSONLiteral" || typeof urlProperty.value.value !== "string" || !isGitHubUrl(urlProperty.value.value)) {
57
+ return;
58
+ }
59
+ const url = urlProperty.value.value;
60
+ context.report({
61
+ fix(fixer) {
62
+ return fixer.replaceText(
63
+ node.value,
64
+ JSON.stringify(cleanGitHubUrl(url))
65
+ );
66
+ },
67
+ messageId: "preferShorthand",
68
+ node: node.value
69
+ });
70
+ }
71
+ if (node.value.type === "JSONLiteral") {
72
+ const { value } = node.value;
73
+ if (typeof value === "string" && isGitHubUrl(value)) {
74
+ context.report({
75
+ fix(fixer) {
76
+ return fixer.replaceText(
77
+ node.value,
78
+ JSON.stringify(cleanGitHubUrl(value))
79
+ );
80
+ },
81
+ messageId: "preferShorthand",
82
+ node: node.value
83
+ });
84
+ }
85
+ }
86
+ }
87
+ };
88
+ },
89
+ meta: {
90
+ docs: {
91
+ category: "Best Practices",
92
+ description: "Enforce shorthand declaration for GitHub repository.",
93
+ recommended: true
94
+ },
95
+ fixable: "code",
96
+ messages: {
97
+ preferShorthand: "Prefer a shorthand locator for a GitHub repository."
98
+ }
99
+ }
100
+ });
101
+ //# sourceMappingURL=prefer-repository-shorthand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/rules/prefer-repository-shorthand.ts"],"sourcesContent":["import type ESTree from \"estree\";\nimport type { AST as JsonAST } from \"jsonc-eslint-parser\";\n\nimport { createRule } from \"../createRule.js\";\n\nconst githubUrlRegex =\n\t/^(?:git\\+)?(?:ssh:\\/\\/git@|http?s:\\/\\/)?(?:www\\.)?github\\.com\\//;\n\nconst isGitHubUrl = (url: string) => githubUrlRegex.test(url);\n\nconst cleanGitHubUrl = (url: string) =>\n\turl.replace(githubUrlRegex, \"\").replace(/\\.git$/, \"\");\n\ntype JSONPropertyWithKeyAndValue<Value extends string> =\n\tJsonAST.JSONProperty & {\n\t\tkey: JsonAST.JSONStringLiteral;\n\t\tvalue: Value;\n\t};\n\nfunction findJSONLiteralWithValue<Value extends string>(\n\tproperties: JsonAST.JSONProperty[],\n\tvalue: Value,\n) {\n\treturn properties.find(\n\t\t(property): property is JSONPropertyWithKeyAndValue<Value> =>\n\t\t\tproperty.key.type === \"JSONLiteral\" && property.key.value === value,\n\t);\n}\n\nexport default createRule({\n\tcreate(context) {\n\t\treturn {\n\t\t\tJSONProperty(node) {\n\t\t\t\tif (\n\t\t\t\t\tnode.key.type !== \"JSONLiteral\" ||\n\t\t\t\t\tnode.key.value !== \"repository\" ||\n\t\t\t\t\tnode.parent.parent.parent.type !== \"Program\"\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (node.value.type === \"JSONObjectExpression\") {\n\t\t\t\t\tconst { properties } = node.value;\n\n\t\t\t\t\tif (findJSONLiteralWithValue(properties, \"directory\")) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst typeProperty = findJSONLiteralWithValue(\n\t\t\t\t\t\tproperties,\n\t\t\t\t\t\t\"type\",\n\t\t\t\t\t);\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeProperty?.value.type !== \"JSONLiteral\" ||\n\t\t\t\t\t\ttypeProperty.value.value !== \"git\"\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst urlProperty = findJSONLiteralWithValue(\n\t\t\t\t\t\tproperties,\n\t\t\t\t\t\t\"url\",\n\t\t\t\t\t);\n\t\t\t\t\tif (\n\t\t\t\t\t\turlProperty?.value.type !== \"JSONLiteral\" ||\n\t\t\t\t\t\ttypeof urlProperty.value.value !== \"string\" ||\n\t\t\t\t\t\t!isGitHubUrl(urlProperty.value.value)\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst url = urlProperty.value.value;\n\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\t\treturn fixer.replaceText(\n\t\t\t\t\t\t\t\tnode.value as unknown as ESTree.Node,\n\t\t\t\t\t\t\t\tJSON.stringify(cleanGitHubUrl(url)),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tmessageId: \"preferShorthand\",\n\t\t\t\t\t\tnode: node.value as unknown as ESTree.Node,\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tif (node.value.type === \"JSONLiteral\") {\n\t\t\t\t\tconst { value } = node.value;\n\t\t\t\t\tif (typeof value === \"string\" && isGitHubUrl(value)) {\n\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\t\t\treturn fixer.replaceText(\n\t\t\t\t\t\t\t\t\tnode.value as unknown as ESTree.Node,\n\t\t\t\t\t\t\t\t\tJSON.stringify(cleanGitHubUrl(value)),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmessageId: \"preferShorthand\",\n\t\t\t\t\t\t\tnode: node.value as unknown as ESTree.Node,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n\n\tmeta: {\n\t\tdocs: {\n\t\t\tcategory: \"Best Practices\",\n\t\t\tdescription: \"Enforce shorthand declaration for GitHub repository.\",\n\t\t\trecommended: true,\n\t\t},\n\t\tfixable: \"code\",\n\t\tmessages: {\n\t\t\tpreferShorthand:\n\t\t\t\t\"Prefer a shorthand locator for a GitHub repository.\",\n\t\t},\n\t},\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA2B;AAE3B,MAAM,iBACL;AAED,MAAM,cAAc,CAAC,QAAgB,eAAe,KAAK,GAAG;AAE5D,MAAM,iBAAiB,CAAC,QACvB,IAAI,QAAQ,gBAAgB,EAAE,EAAE,QAAQ,UAAU,EAAE;AAQrD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Ae,KAAK,CAAC;AAAA,gBACrC;AAAA,cACD;AAAA,cACA,WAAW;AAAA,cACX,MAAM,KAAK;AAAA,YACZ,CAAC;AAAA,UACF;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAAA,EAEA,MAAM;AAAA,IACL,MAAM;AAAA,MACL,UAAU;AAAA,MACV,aAAa;AAAA,MACb,aAAa;AAAA,IACd;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,MACT,iBACC;AAAA,IACF;AAAA,EACD;AACD,CAAC;","names":[]}
@@ -0,0 +1,81 @@
1
+ import { createRule } from "../createRule.js";
2
+ const githubUrlRegex = /^(?:git\+)?(?:ssh:\/\/git@|http?s:\/\/)?(?:www\.)?github\.com\//;
3
+ const isGitHubUrl = (url) => githubUrlRegex.test(url);
4
+ const cleanGitHubUrl = (url) => url.replace(githubUrlRegex, "").replace(/\.git$/, "");
5
+ function findJSONLiteralWithValue(properties, value) {
6
+ return properties.find(
7
+ (property) => property.key.type === "JSONLiteral" && property.key.value === value
8
+ );
9
+ }
10
+ var prefer_repository_shorthand_default = createRule({
11
+ create(context) {
12
+ return {
13
+ JSONProperty(node) {
14
+ if (node.key.type !== "JSONLiteral" || node.key.value !== "repository" || node.parent.parent.parent.type !== "Program") {
15
+ return;
16
+ }
17
+ if (node.value.type === "JSONObjectExpression") {
18
+ const { properties } = node.value;
19
+ if (findJSONLiteralWithValue(properties, "directory")) {
20
+ return;
21
+ }
22
+ const typeProperty = findJSONLiteralWithValue(
23
+ properties,
24
+ "type"
25
+ );
26
+ if (typeProperty?.value.type !== "JSONLiteral" || typeProperty.value.value !== "git") {
27
+ return;
28
+ }
29
+ const urlProperty = findJSONLiteralWithValue(
30
+ properties,
31
+ "url"
32
+ );
33
+ if (urlProperty?.value.type !== "JSONLiteral" || typeof urlProperty.value.value !== "string" || !isGitHubUrl(urlProperty.value.value)) {
34
+ return;
35
+ }
36
+ const url = urlProperty.value.value;
37
+ context.report({
38
+ fix(fixer) {
39
+ return fixer.replaceText(
40
+ node.value,
41
+ JSON.stringify(cleanGitHubUrl(url))
42
+ );
43
+ },
44
+ messageId: "preferShorthand",
45
+ node: node.value
46
+ });
47
+ }
48
+ if (node.value.type === "JSONLiteral") {
49
+ const { value } = node.value;
50
+ if (typeof value === "string" && isGitHubUrl(value)) {
51
+ context.report({
52
+ fix(fixer) {
53
+ return fixer.replaceText(
54
+ node.value,
55
+ JSON.stringify(cleanGitHubUrl(value))
56
+ );
57
+ },
58
+ messageId: "preferShorthand",
59
+ node: node.value
60
+ });
61
+ }
62
+ }
63
+ }
64
+ };
65
+ },
66
+ meta: {
67
+ docs: {
68
+ category: "Best Practices",
69
+ description: "Enforce shorthand declaration for GitHub repository.",
70
+ recommended: true
71
+ },
72
+ fixable: "code",
73
+ messages: {
74
+ preferShorthand: "Prefer a shorthand locator for a GitHub repository."
75
+ }
76
+ }
77
+ });
78
+ export {
79
+ prefer_repository_shorthand_default as default
80
+ };
81
+ //# sourceMappingURL=prefer-repository-shorthand.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/rules/prefer-repository-shorthand.ts"],"sourcesContent":["import type ESTree from \"estree\";\nimport type { AST as JsonAST } from \"jsonc-eslint-parser\";\n\nimport { createRule } from \"../createRule.js\";\n\nconst githubUrlRegex =\n\t/^(?:git\\+)?(?:ssh:\\/\\/git@|http?s:\\/\\/)?(?:www\\.)?github\\.com\\//;\n\nconst isGitHubUrl = (url: string) => githubUrlRegex.test(url);\n\nconst cleanGitHubUrl = (url: string) =>\n\turl.replace(githubUrlRegex, \"\").replace(/\\.git$/, \"\");\n\ntype JSONPropertyWithKeyAndValue<Value extends string> =\n\tJsonAST.JSONProperty & {\n\t\tkey: JsonAST.JSONStringLiteral;\n\t\tvalue: Value;\n\t};\n\nfunction findJSONLiteralWithValue<Value extends string>(\n\tproperties: JsonAST.JSONProperty[],\n\tvalue: Value,\n) {\n\treturn properties.find(\n\t\t(property): property is JSONPropertyWithKeyAndValue<Value> =>\n\t\t\tproperty.key.type === \"JSONLiteral\" && property.key.value === value,\n\t);\n}\n\nexport default createRule({\n\tcreate(context) {\n\t\treturn {\n\t\t\tJSONProperty(node) {\n\t\t\t\tif (\n\t\t\t\t\tnode.key.type !== \"JSONLiteral\" ||\n\t\t\t\t\tnode.key.value !== \"repository\" ||\n\t\t\t\t\tnode.parent.parent.parent.type !== \"Program\"\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (node.value.type === \"JSONObjectExpression\") {\n\t\t\t\t\tconst { properties } = node.value;\n\n\t\t\t\t\tif (findJSONLiteralWithValue(properties, \"directory\")) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst typeProperty = findJSONLiteralWithValue(\n\t\t\t\t\t\tproperties,\n\t\t\t\t\t\t\"type\",\n\t\t\t\t\t);\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeProperty?.value.type !== \"JSONLiteral\" ||\n\t\t\t\t\t\ttypeProperty.value.value !== \"git\"\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst urlProperty = findJSONLiteralWithValue(\n\t\t\t\t\t\tproperties,\n\t\t\t\t\t\t\"url\",\n\t\t\t\t\t);\n\t\t\t\t\tif (\n\t\t\t\t\t\turlProperty?.value.type !== \"JSONLiteral\" ||\n\t\t\t\t\t\ttypeof urlProperty.value.value !== \"string\" ||\n\t\t\t\t\t\t!isGitHubUrl(urlProperty.value.value)\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst url = urlProperty.value.value;\n\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\t\treturn fixer.replaceText(\n\t\t\t\t\t\t\t\tnode.value as unknown as ESTree.Node,\n\t\t\t\t\t\t\t\tJSON.stringify(cleanGitHubUrl(url)),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tmessageId: \"preferShorthand\",\n\t\t\t\t\t\tnode: node.value as unknown as ESTree.Node,\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tif (node.value.type === \"JSONLiteral\") {\n\t\t\t\t\tconst { value } = node.value;\n\t\t\t\t\tif (typeof value === \"string\" && isGitHubUrl(value)) {\n\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\t\t\treturn fixer.replaceText(\n\t\t\t\t\t\t\t\t\tnode.value as unknown as ESTree.Node,\n\t\t\t\t\t\t\t\t\tJSON.stringify(cleanGitHubUrl(value)),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmessageId: \"preferShorthand\",\n\t\t\t\t\t\t\tnode: node.value as unknown as ESTree.Node,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n\n\tmeta: {\n\t\tdocs: {\n\t\t\tcategory: \"Best Practices\",\n\t\t\tdescription: \"Enforce shorthand declaration for GitHub repository.\",\n\t\t\trecommended: true,\n\t\t},\n\t\tfixable: \"code\",\n\t\tmessages: {\n\t\t\tpreferShorthand:\n\t\t\t\t\"Prefer a shorthand locator for a GitHub repository.\",\n\t\t},\n\t},\n});\n"],"mappings":"AAGA,SAAS,kBAAkB;AAE3B,MAAM,iBACL;AAED,MAAM,cAAc,CAAC,QAAgB,eAAe,KAAK,GAAG;AAE5D,MAAM,iBAAiB,CAAC,QACvB,IAAI,QAAQ,gBAAgB,EAAE,EAAE,QAAQ,UAAU,EAAE;AAQrD,SAAS,yBACR,YACA,OACC;AACD,SAAO,WAAW;AAAA,IACjB,CAAC,aACA,SAAS,IAAI,SAAS,iBAAiB,SAAS,IAAI,UAAU;AAAA,EAChE;AACD;AAEA,IAAO,sCAAQ,WAAW;AAAA,EACzB,OAAO,SAAS;AACf,WAAO;AAAA,MACN,aAAa,MAAM;A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ACV,aAAa;AAAA,MACb,aAAa;AAAA,IACd;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,MACT,iBACC;AAAA,IACF;AAAA,EACD;AACD,CAAC;","names":[]}
@@ -40,9 +40,9 @@ var valid_local_dependency_default = (0, import_createRule.createRule)({
40
40
  const original = JSON.parse(context.sourceCode.text);
41
41
  const { dependencies, devDependencies, peerDependencies } = original;
42
42
  const depObjs = [
43
- Object.entries(dependencies || {}),
44
- Object.entries(peerDependencies || {}),
45
- Object.entries(devDependencies || {})
43
+ Object.entries(dependencies ?? {}),
44
+ Object.entries(peerDependencies ?? {}),
45
+ Object.entries(devDependencies ?? {})
46
46
  ];
47
47
  depObjs.forEach((obj) => {
48
48
  obj.forEach(([key, value]) => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/rules/valid-local-dependency.ts"],"sourcesContent":["import path from \"path\";\n\nimport { createRule } from \"../createRule.js\";\n\n//------------------------------------------------------------------------------\n// Rule Definition\n//------------------------------------------------------------------------------\n\nexport default createRule({\n\tcreate(context) {\n\t\treturn {\n\t\t\t\"Program:exit\"() {\n\t\t\t\tconst original = JSON.parse(context.sourceCode.text) as Record<\n\t\t\t\t\tstring,\n\t\t\t\t\tunknown\n\t\t\t\t>;\n\t\t\t\tconst { dependencies, devDependencies, peerDependencies } =\n\t\t\t\t\toriginal;\n\n\t\t\t\tconst depObjs = [\n\t\t\t\t\tObject.entries(dependencies || {}),\n\t\t\t\t\tObject.entries(peerDependencies || {}),\n\t\t\t\t\tObject.entries(devDependencies || {}),\n\t\t\t\t] as [string, string][][];\n\n\t\t\t\tdepObjs.forEach((obj) => {\n\t\t\t\t\tobj.forEach(([key, value]) => {\n\t\t\t\t\t\tconst response = (localPath: RegExp | string) => {\n\t\t\t\t\t\t\tconst filePath = path.join(\n\t\t\t\t\t\t\t\tcontext.filename.replace(/package\\.json/g, \"/\"),\n\t\t\t\t\t\t\t\tvalue.replace(new RegExp(localPath, \"g\"), \"\"),\n\t\t\t\t\t\t\t\t\"/package.json\",\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tif (!require.resolve(filePath)) {\n\t\t\t\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\t\t\t\tmessage: `The package ${key} does not exist given the specified path: ${value}.`,\n\t\t\t\t\t\t\t\t\t\tnode: context.sourceCode.ast,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\t\t\tmessage: `The package ${key} does not exist given the specified path: ${value}.`,\n\t\t\t\t\t\t\t\t\tnode: context.sourceCode.ast,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tif (value.startsWith(\"link:\")) {\n\t\t\t\t\t\t\tresponse(\"link:\");\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (value.startsWith(\"file:\")) {\n\t\t\t\t\t\t\tresponse(\"file:\");\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n\n\tmeta: {\n\t\tdocs: {\n\t\t\tcategory: \"Best Practices\",\n\t\t\tdescription:\n\t\t\t\t\"Checks existence of local dependencies in the package.json\",\n\t\t\trecommended: true,\n\t\t},\n\t},\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,wBAA2B;AAM3B,IAAO,qCAAQ,8BAAW;AAAA,EACzB,OAAO,SAAS;AACf,WAAO;AAAA,MACN,iBAAiB;AAChB,cAAM,WAAW,KAAK,MAAM,QAAQ,WAAW,IAAI;AAInD,cAAM,EAAE,cAAc,iBAAiB,iBAAiB,IACvD;AAED,cAAM,UAAU;AAAA,UACf,OAAO,QAAQ,gBAAgB,CAAC,CAAC;AAAA,UACjC,OAAO,QAAQ,oBAAoB,CAAC,CAAC;AAAA,UACrC,OAAO,QAAQ,mBAAmB,CAAC,CAAC;AAAA,QACrC;AAEA,gBAAQ,QAAQ,CAAC,QAAQ;AACxB,cAAI,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AAC7B,kBAAM,WAAW,CAAC,cAA+B;AAChD,oBAAM,WAAW,YAAAA,QAAK;AAAA,gBACrB,QAAQ,SAAS,QAAQ,kBAAkB,GAAG;AAAA,gBAC9C,MAAM,QAAQ,IAAI,OAAO,WAAW,GAAG,GAAG,EAAE;AAAA,gBAC5C;AAAA,cACD;AAEA,kBAAI;AACH,oBAAI,CAAC,QAAQ,QAAQ,QAAQ,GAAG;AAC/B,0BAAQ,OAAO;AAAA,oBACd,SAAS,eAAe,GAAG,6CAA6C,KAAK;AAAA,oBAC7E,MAAM,QAAQ,WAAW;AAAA,kBAC1B,CAAC;AAAA,gBACF;AAAA,cACD,QAAQ;AACP,wBAAQ,OAAO;AAAA,kBACd,SAAS,eAAe,GAAG,6CAA6C,KAAK;AAAA,kBAC7E,MAAM,QAAQ,WAAW;AAAA,gBAC1B,CAAC;AAAA,cACF;AAAA,YACD;AAEA,gBAAI,MAAM,WAAW,OAAO,GAAG;AAC9B,uBAAS,OAAO;AAAA,YACjB;AAEA,gBAAI,MAAM,WAAW,OAAO,GAAG;AAC9B,uBAAS,OAAO;AAAA,YACjB;AAAA,UACD,CAAC;AAAA,QACF,CAAC;AAAA,MACF;AAAA,IACD;AAAA,EACD;AAAA,EAEA,MAAM;AAAA,IACL,MAAM;AAAA,MACL,UAAU;AAAA,MACV,aACC;AAAA,MACD,aAAa;AAAA,IACd;AAAA,EACD;AACD,CAAC;","names":["path"]}
1
+ {"version":3,"sources":["../../src/rules/valid-local-dependency.ts"],"sourcesContent":["import path from \"path\";\n\nimport { createRule } from \"../createRule.js\";\n\n//------------------------------------------------------------------------------\n// Rule Definition\n//------------------------------------------------------------------------------\n\nexport default createRule({\n\tcreate(context) {\n\t\treturn {\n\t\t\t\"Program:exit\"() {\n\t\t\t\tconst original = JSON.parse(context.sourceCode.text) as Record<\n\t\t\t\t\tstring,\n\t\t\t\t\tunknown\n\t\t\t\t>;\n\t\t\t\tconst { dependencies, devDependencies, peerDependencies } =\n\t\t\t\t\toriginal;\n\n\t\t\t\tconst depObjs = [\n\t\t\t\t\tObject.entries(dependencies ?? {}),\n\t\t\t\t\tObject.entries(peerDependencies ?? {}),\n\t\t\t\t\tObject.entries(devDependencies ?? {}),\n\t\t\t\t] as [string, string][][];\n\n\t\t\t\tdepObjs.forEach((obj) => {\n\t\t\t\t\tobj.forEach(([key, value]) => {\n\t\t\t\t\t\tconst response = (localPath: RegExp | string) => {\n\t\t\t\t\t\t\tconst filePath = path.join(\n\t\t\t\t\t\t\t\tcontext.filename.replace(/package\\.json/g, \"/\"),\n\t\t\t\t\t\t\t\tvalue.replace(new RegExp(localPath, \"g\"), \"\"),\n\t\t\t\t\t\t\t\t\"/package.json\",\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tif (!require.resolve(filePath)) {\n\t\t\t\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\t\t\t\tmessage: `The package ${key} does not exist given the specified path: ${value}.`,\n\t\t\t\t\t\t\t\t\t\tnode: context.sourceCode.ast,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\t\t\tmessage: `The package ${key} does not exist given the specified path: ${value}.`,\n\t\t\t\t\t\t\t\t\tnode: context.sourceCode.ast,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tif (value.startsWith(\"link:\")) {\n\t\t\t\t\t\t\tresponse(\"link:\");\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (value.startsWith(\"file:\")) {\n\t\t\t\t\t\t\tresponse(\"file:\");\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n\n\tmeta: {\n\t\tdocs: {\n\t\t\tcategory: \"Best Practices\",\n\t\t\tdescription:\n\t\t\t\t\"Checks existence of local dependencies in the package.json\",\n\t\t\trecommended: true,\n\t\t},\n\t},\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,wBAA2B;AAM3B,IAAO,qCAAQ,8BAAW;AAAA,EACzB,OAAO,SAAS;AACf,WAAO;AAAA,MACN,iBAAiB;AAChB,cAAM,WAAW,KAAK,MAAM,QAAQ,WAAW,IAAI;AAInD,cAAM,EAAE,cAAc,iBAAiB,iBAAiB,IACvD;AAED,cAAM,UAAU;AAAA,UACf,OAAO,QAAQ,gBAAgB,CAAC,CAAC;AAAA,UACjC,OAAO,QAAQ,oBAAoB,CAAC,CAAC;AAAA,UACrC,OAAO,QAAQ,mBAAmB,CAAC,CAAC;AAAA,QACrC;AAEA,gBAAQ,QAAQ,CAAC,QAAQ;AACxB,cAAI,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AAC7B,kBAAM,WAAW,CAAC,cAA+B;AAChD,oBAAM,WAAW,YAAAA,QAAK;AAAA,gBACrB,QAAQ,SAAS,QAAQ,kBAAkB,GAAG;AAAA,gBAC9C,MAAM,QAAQ,IAAI,OAAO,WAAW,GAAG,GAAG,EAAE;AAAA,gBAC5C;AAAA,cACD;AAEA,kBAAI;AACH,oBAAI,CAAC,QAAQ,QAAQ,QAAQ,GAAG;AAC/B,0BAAQ,OAAO;AAAA,oBACd,SAAS,eAAe,GAAG,6CAA6C,KAAK;AAAA,oBAC7E,MAAM,QAAQ,WAAW;AAAA,kBAC1B,CAAC;AAAA,gBACF;AAAA,cACD,QAAQ;AACP,wBAAQ,OAAO;AAAA,kBACd,SAAS,eAAe,GAAG,6CAA6C,KAAK;AAAA,kBAC7E,MAAM,QAAQ,WAAW;AAAA,gBAC1B,CAAC;AAAA,cACF;AAAA,YACD;AAEA,gBAAI,MAAM,WAAW,OAAO,GAAG;AAC9B,uBAAS,OAAO;AAAA,YACjB;AAEA,gBAAI,MAAM,WAAW,OAAO,GAAG;AAC9B,uBAAS,OAAO;AAAA,YACjB;AAAA,UACD,CAAC;AAAA,QACF,CAAC;AAAA,MACF;AAAA,IACD;AAAA,EACD;AAAA,EAEA,MAAM;AAAA,IACL,MAAM;AAAA,MACL,UAAU;AAAA,MACV,aACC;AAAA,MACD,aAAa;AAAA,IACd;AAAA,EACD;AACD,CAAC;","names":["path"]}
@@ -7,9 +7,9 @@ var valid_local_dependency_default = createRule({
7
7
  const original = JSON.parse(context.sourceCode.text);
8
8
  const { dependencies, devDependencies, peerDependencies } = original;
9
9
  const depObjs = [
10
- Object.entries(dependencies || {}),
11
- Object.entries(peerDependencies || {}),
12
- Object.entries(devDependencies || {})
10
+ Object.entries(dependencies ?? {}),
11
+ Object.entries(peerDependencies ?? {}),
12
+ Object.entries(devDependencies ?? {})
13
13
  ];
14
14
  depObjs.forEach((obj) => {
15
15
  obj.forEach(([key, value]) => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/rules/valid-local-dependency.ts"],"sourcesContent":["import path from \"path\";\n\nimport { createRule } from \"../createRule.js\";\n\n//------------------------------------------------------------------------------\n// Rule Definition\n//------------------------------------------------------------------------------\n\nexport default createRule({\n\tcreate(context) {\n\t\treturn {\n\t\t\t\"Program:exit\"() {\n\t\t\t\tconst original = JSON.parse(context.sourceCode.text) as Record<\n\t\t\t\t\tstring,\n\t\t\t\t\tunknown\n\t\t\t\t>;\n\t\t\t\tconst { dependencies, devDependencies, peerDependencies } =\n\t\t\t\t\toriginal;\n\n\t\t\t\tconst depObjs = [\n\t\t\t\t\tObject.entries(dependencies || {}),\n\t\t\t\t\tObject.entries(peerDependencies || {}),\n\t\t\t\t\tObject.entries(devDependencies || {}),\n\t\t\t\t] as [string, string][][];\n\n\t\t\t\tdepObjs.forEach((obj) => {\n\t\t\t\t\tobj.forEach(([key, value]) => {\n\t\t\t\t\t\tconst response = (localPath: RegExp | string) => {\n\t\t\t\t\t\t\tconst filePath = path.join(\n\t\t\t\t\t\t\t\tcontext.filename.replace(/package\\.json/g, \"/\"),\n\t\t\t\t\t\t\t\tvalue.replace(new RegExp(localPath, \"g\"), \"\"),\n\t\t\t\t\t\t\t\t\"/package.json\",\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tif (!require.resolve(filePath)) {\n\t\t\t\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\t\t\t\tmessage: `The package ${key} does not exist given the specified path: ${value}.`,\n\t\t\t\t\t\t\t\t\t\tnode: context.sourceCode.ast,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\t\t\tmessage: `The package ${key} does not exist given the specified path: ${value}.`,\n\t\t\t\t\t\t\t\t\tnode: context.sourceCode.ast,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tif (value.startsWith(\"link:\")) {\n\t\t\t\t\t\t\tresponse(\"link:\");\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (value.startsWith(\"file:\")) {\n\t\t\t\t\t\t\tresponse(\"file:\");\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n\n\tmeta: {\n\t\tdocs: {\n\t\t\tcategory: \"Best Practices\",\n\t\t\tdescription:\n\t\t\t\t\"Checks existence of local dependencies in the package.json\",\n\t\t\trecommended: true,\n\t\t},\n\t},\n});\n"],"mappings":"AAAA,OAAO,UAAU;AAEjB,SAAS,kBAAkB;AAM3B,IAAO,iCAAQ,WAAW;AAAA,EACzB,OAAO,SAAS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;AACD,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../src/rules/valid-local-dependency.ts"],"sourcesContent":["import path from \"path\";\n\nimport { createRule } from \"../createRule.js\";\n\n//------------------------------------------------------------------------------\n// Rule Definition\n//------------------------------------------------------------------------------\n\nexport default createRule({\n\tcreate(context) {\n\t\treturn {\n\t\t\t\"Program:exit\"() {\n\t\t\t\tconst original = JSON.parse(context.sourceCode.text) as Record<\n\t\t\t\t\tstring,\n\t\t\t\t\tunknown\n\t\t\t\t>;\n\t\t\t\tconst { dependencies, devDependencies, peerDependencies } =\n\t\t\t\t\toriginal;\n\n\t\t\t\tconst depObjs = [\n\t\t\t\t\tObject.entries(dependencies ?? {}),\n\t\t\t\t\tObject.entries(peerDependencies ?? {}),\n\t\t\t\t\tObject.entries(devDependencies ?? {}),\n\t\t\t\t] as [string, string][][];\n\n\t\t\t\tdepObjs.forEach((obj) => {\n\t\t\t\t\tobj.forEach(([key, value]) => {\n\t\t\t\t\t\tconst response = (localPath: RegExp | string) => {\n\t\t\t\t\t\t\tconst filePath = path.join(\n\t\t\t\t\t\t\t\tcontext.filename.replace(/package\\.json/g, \"/\"),\n\t\t\t\t\t\t\t\tvalue.replace(new RegExp(localPath, \"g\"), \"\"),\n\t\t\t\t\t\t\t\t\"/package.json\",\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tif (!require.resolve(filePath)) {\n\t\t\t\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\t\t\t\tmessage: `The package ${key} does not exist given the specified path: ${value}.`,\n\t\t\t\t\t\t\t\t\t\tnode: context.sourceCode.ast,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\t\t\tmessage: `The package ${key} does not exist given the specified path: ${value}.`,\n\t\t\t\t\t\t\t\t\tnode: context.sourceCode.ast,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tif (value.startsWith(\"link:\")) {\n\t\t\t\t\t\t\tresponse(\"link:\");\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (value.startsWith(\"file:\")) {\n\t\t\t\t\t\t\tresponse(\"file:\");\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n\n\tmeta: {\n\t\tdocs: {\n\t\t\tcategory: \"Best Practices\",\n\t\t\tdescription:\n\t\t\t\t\"Checks existence of local dependencies in the package.json\",\n\t\t\trecommended: true,\n\t\t},\n\t},\n});\n"],"mappings":"AAAA,OAAO,UAAU;AAEjB,SAAS,kBAAkB;AAM3B,IAAO,iCAAQ,WAAW;AAAA,EACzB,OAAO,SAAS;AACf,WAAO;AAAA,MACN,iBAAiB;AAChB,cAAM,WAAW,KAAK,MAAM,QAAQ,WAAW,IAAI;AAInD,cAAM,EAAE,cAAc,iBAAiB,iBAAiB,IACvD;AAED,cAAM,UAAU;AAAA,UACf,OAAO,QAAQ,gBAAgB,CAAC,CAAC;AAAA,UACjC,OAAO,QAAQ,oBAAoB,CAAC,CAAC;AAAA,UACrC,OAAO,QAAQ,mBAAmB,CAAC,CAAC;AAAA,QACrC;AAEA,gBAAQ,QAAQ,CAAC,QAAQ;AACxB,cAAI,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AAC7B,kBAAM,WAAW,CAAC,cAA+B;AAChD,oBAAM,WAAW,KAAK;AAAA,gBACrB,QAAQ,SAAS,QAAQ,kBAAkB,GAAG;AAAA,gBAC9C,MAAM,QAAQ,IAAI,OAAO,WAAW,GAAG,GAAG,EAAE;AAAA,gBAC5C;AAAA,cACD;AAEA,kBAAI;AACH,oBAAI,CAAC,QAAQ,QAAQ,QAAQ,GAAG;AAC/B,0BAAQ,OAAO;AAAA,oBACd,SAAS,eAAe,GAAG,6CAA6C,KAAK;AAAA,oBAC7E,MAAM,QAAQ,WAAW;AAAA,kBAC1B,CAAC;AAAA,gBACF;AAAA,cACD,QAAQ;AACP,wBAAQ,OAAO;AAAA,kBACd,SAAS,eAAe,GAAG,6CAA6C,KAAK;AAAA,kBAC7E,MAAM,QAAQ,WAAW;AAAA,gBAC1B,CAAC;AAAA,cACF;AAAA,YACD;AAEA,gBAAI,MAAM,WAAW,OAAO,GAAG;AAC9B,uBAAS,OAAO;AAAA,YACjB;AAEA,gBAAI,MAAM,WAAW,OAAO,GAAG;AAC9B,uBAAS,OAAO;AAAA,YACjB;AAAA,UACD,CAAC;AAAA,QACF,CAAC;AAAA,MACF;AAAA,IACD;AAAA,EACD;AAAA,EAEA,MAAM;AAAA,IACL,MAAM;AAAA,MACL,UAAU;AAAA,MACV,aACC;AAAA,MACD,aAAa;AAAA,IACd;AAAA,EACD;AACD,CAAC;","names":[]}
@@ -50,7 +50,7 @@ var valid_package_def_default = (0, import_createRule.createRule)({
50
50
  meta: {
51
51
  docs: {
52
52
  category: "Best Practices",
53
- description: "Enforce that package.json has all properties required by NPM spec",
53
+ description: "Enforce that package.json has all properties required by the npm spec",
54
54
  recommended: true
55
55
  }
56
56
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/rules/valid-package-def.ts"],"sourcesContent":["\"use strict\";\nimport { PJV as PackageValidator } from \"package-json-validator\";\n\nimport { createRule } from \"../createRule.js\";\n\n// package-json-validator does not correctly recognize shorthand for repositories and alternate dependency statements, so we discard those values.\n// it also enforces a stricter code for NPM than is really appropriate,\n// so we disable some other errors here.\nconst unusedErrorPatterns = [\n\t/^Url not valid/i,\n\t/^Invalid version range for .+?: file:/i,\n\t/^author field should have name/i,\n];\n\nconst isUsableError = (errorText: string) =>\n\tunusedErrorPatterns.every((pattern) => !pattern.test(errorText));\n\nexport default createRule({\n\tcreate(context) {\n\t\treturn {\n\t\t\t\"Program:exit\"() {\n\t\t\t\tconst validation = PackageValidator.validate(\n\t\t\t\t\tcontext.sourceCode.text,\n\t\t\t\t) as PackageValidator.ValidationSuccessResult;\n\n\t\t\t\tvalidation.errors?.filter(isUsableError).forEach((message) => {\n\t\t\t\t\tif (message) {\n\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\tnode: context.sourceCode.ast,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n\n\tmeta: {\n\t\tdocs: {\n\t\t\tcategory: \"Best Practices\",\n\t\t\tdescription:\n\t\t\t\t\"Enforce that package.json has all properties required by NPM spec\",\n\t\t\trecommended: true,\n\t\t},\n\t},\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oCAAwC;AAExC,wBAA2B;AAK3B,MAAM,sBAAsB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AACD;AAEA,MAAM,gBAAgB,CAAC,cACtB,oBAAoB,MAAM,CAAC,YAAY,CAAC,QAAQ,KAAK,SAAS,CAAC;AAEhE,IAAO,gCAAQ,8BAAW;AAAA,EACzB,OAAO,SAAS;AACf,WAAO;AAAA,MACN,iBAAiB;AAChB,cAAM,aAAa,8BAAAA,IAAiB;AAAA,UACnC,QAAQ,WAAW;AAAA,QACpB;AAEA,mBAAW,QAAQ,OAAO,aAAa,EAAE,QAAQ,CAAC,YAAY;AAC7D,cAAI,SAAS;AACZ,oBAAQ,OAAO;AAAA,cACd;AAAA,cACA,MAAM,QAAQ,WAAW;AAAA,YAC1B,CAAC;AAAA,UACF;AAAA,QACD,CAAC;AAAA,MACF;AAAA,IACD;AAAA,EACD;AAAA,EAEA,MAAM;AAAA,IACL,MAAM;AAAA,MACL,UAAU;AAAA,MACV,aACC;AAAA,MACD,aAAa;AAAA,IACd;AAAA,EACD;AACD,CAAC;","names":["PackageValidator"]}
1
+ {"version":3,"sources":["../../src/rules/valid-package-def.ts"],"sourcesContent":["\"use strict\";\nimport { PJV as PackageValidator } from \"package-json-validator\";\n\nimport { createRule } from \"../createRule.js\";\n\n// package-json-validator does not correctly recognize shorthand for repositories and alternate dependency statements, so we discard those values.\n// it also enforces a stricter code for npm than is really appropriate,\n// so we disable some other errors here.\nconst unusedErrorPatterns = [\n\t/^Url not valid/i,\n\t/^Invalid version range for .+?: file:/i,\n\t/^author field should have name/i,\n];\n\nconst isUsableError = (errorText: string) =>\n\tunusedErrorPatterns.every((pattern) => !pattern.test(errorText));\n\nexport default createRule({\n\tcreate(context) {\n\t\treturn {\n\t\t\t\"Program:exit\"() {\n\t\t\t\tconst validation = PackageValidator.validate(\n\t\t\t\t\tcontext.sourceCode.text,\n\t\t\t\t) as PackageValidator.ValidationSuccessResult;\n\n\t\t\t\tvalidation.errors?.filter(isUsableError).forEach((message) => {\n\t\t\t\t\tif (message) {\n\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\tnode: context.sourceCode.ast,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n\n\tmeta: {\n\t\tdocs: {\n\t\t\tcategory: \"Best Practices\",\n\t\t\tdescription:\n\t\t\t\t\"Enforce that package.json has all properties required by the npm spec\",\n\t\t\trecommended: true,\n\t\t},\n\t},\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oCAAwC;AAExC,wBAA2B;AAK3B,MAAM,sBAAsB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AACD;AAEA,MAAM,gBAAgB,CAAC,cACtB,oBAAoB,MAAM,CAAC,YAAY,CAAC,QAAQ,KAAK,SAAS,CAAC;AAEhE,IAAO,gCAAQ,8BAAW;AAAA,EACzB,OAAO,SAAS;AACf,WAAO;AAAA,MACN,iBAAiB;AAChB,cAAM,aAAa,8BAAAA,IAAiB;AAAA,UACnC,QAAQ,WAAW;AAAA,QACpB;AAEA,mBAAW,QAAQ,OAAO,aAAa,EAAE,QAAQ,CAAC,YAAY;AAC7D,cAAI,SAAS;AACZ,oBAAQ,OAAO;AAAA,cACd;AAAA,cACA,MAAM,QAAQ,WAAW;AAAA,YAC1B,CAAC;AAAA,UACF;AAAA,QACD,CAAC;AAAA,MACF;AAAA,IACD;AAAA,EACD;AAAA,EAEA,MAAM;AAAA,IACL,MAAM;AAAA,MACL,UAAU;AAAA,MACV,aACC;AAAA,MACD,aAAa;AAAA,IACd;AAAA,EACD;AACD,CAAC;","names":["PackageValidator"]}
@@ -27,7 +27,7 @@ var valid_package_def_default = createRule({
27
27
  meta: {
28
28
  docs: {
29
29
  category: "Best Practices",
30
- description: "Enforce that package.json has all properties required by NPM spec",
30
+ description: "Enforce that package.json has all properties required by the npm spec",
31
31
  recommended: true
32
32
  }
33
33
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/rules/valid-package-def.ts"],"sourcesContent":["\"use strict\";\nimport { PJV as PackageValidator } from \"package-json-validator\";\n\nimport { createRule } from \"../createRule.js\";\n\n// package-json-validator does not correctly recognize shorthand for repositories and alternate dependency statements, so we discard those values.\n// it also enforces a stricter code for NPM than is really appropriate,\n// so we disable some other errors here.\nconst unusedErrorPatterns = [\n\t/^Url not valid/i,\n\t/^Invalid version range for .+?: file:/i,\n\t/^author field should have name/i,\n];\n\nconst isUsableError = (errorText: string) =>\n\tunusedErrorPatterns.every((pattern) => !pattern.test(errorText));\n\nexport default createRule({\n\tcreate(context) {\n\t\treturn {\n\t\t\t\"Program:exit\"() {\n\t\t\t\tconst validation = PackageValidator.validate(\n\t\t\t\t\tcontext.sourceCode.text,\n\t\t\t\t) as PackageValidator.ValidationSuccessResult;\n\n\t\t\t\tvalidation.errors?.filter(isUsableError).forEach((message) => {\n\t\t\t\t\tif (message) {\n\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\tnode: context.sourceCode.ast,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n\n\tmeta: {\n\t\tdocs: {\n\t\t\tcategory: \"Best Practices\",\n\t\t\tdescription:\n\t\t\t\t\"Enforce that package.json has all properties required by NPM spec\",\n\t\t\trecommended: true,\n\t\t},\n\t},\n});\n"],"mappings":"AACA,SAAS,OAAO,wBAAwB;AAExC,SAAS,kBAAkB;AAK3B,MAAM,sBAAsB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AACD;AAEA,MAAM,gBAAgB,CAAC,cACtB,oBAAoB,MAAM,CAAC,YAAY,CAAC,QAAQ,KAAK,SAAS,CAAC;AAEhE,IAAO,4BAAQ,WAAW;AAAA,EACzB,OAAO,SAAS;AACf,WAAO;AAAA,MACN,iBAAiB;AAChB,cAAM,aAAa,iBAAiB;AAAA,UACnC,QAAQ,WAAW;AAAA,QACpB;AAEA,mBAAW,QAAQ,OAAO,aAAa,EAAE,QAAQ,CAAC,YAAY;AAC7D,cAAI,SAAS;AACZ,oBAAQ,OAAO;AAAA,cACd;AAAA,cACA,MAAM,QAAQ,WAAW;AAAA,YAC1B,CAAC;AAAA,UACF;AAAA,QACD,CAAC;AAAA,MACF;AAAA,IACD;AAAA,EACD;AAAA,EAEA,MAAM;AAAA,IACL,MAAM;AAAA,MACL,UAAU;AAAA,MACV,aACC;AAAA,MACD,aAAa;AAAA,IACd;AAAA,EACD;AACD,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../src/rules/valid-package-def.ts"],"sourcesContent":["\"use strict\";\nimport { PJV as PackageValidator } from \"package-json-validator\";\n\nimport { createRule } from \"../createRule.js\";\n\n// package-json-validator does not correctly recognize shorthand for repositories and alternate dependency statements, so we discard those values.\n// it also enforces a stricter code for npm than is really appropriate,\n// so we disable some other errors here.\nconst unusedErrorPatterns = [\n\t/^Url not valid/i,\n\t/^Invalid version range for .+?: file:/i,\n\t/^author field should have name/i,\n];\n\nconst isUsableError = (errorText: string) =>\n\tunusedErrorPatterns.every((pattern) => !pattern.test(errorText));\n\nexport default createRule({\n\tcreate(context) {\n\t\treturn {\n\t\t\t\"Program:exit\"() {\n\t\t\t\tconst validation = PackageValidator.validate(\n\t\t\t\t\tcontext.sourceCode.text,\n\t\t\t\t) as PackageValidator.ValidationSuccessResult;\n\n\t\t\t\tvalidation.errors?.filter(isUsableError).forEach((message) => {\n\t\t\t\t\tif (message) {\n\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\tnode: context.sourceCode.ast,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n\n\tmeta: {\n\t\tdocs: {\n\t\t\tcategory: \"Best Practices\",\n\t\t\tdescription:\n\t\t\t\t\"Enforce that package.json has all properties required by the npm spec\",\n\t\t\trecommended: true,\n\t\t},\n\t},\n});\n"],"mappings":"AACA,SAAS,OAAO,wBAAwB;AAExC,SAAS,kBAAkB;AAK3B,MAAM,sBAAsB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AACD;AAEA,MAAM,gBAAgB,CAAC,cACtB,oBAAoB,MAAM,CAAC,YAAY,CAAC,QAAQ,KAAK,SAAS,CAAC;AAEhE,IAAO,4BAAQ,WAAW;AAAA,EACzB,OAAO,SAAS;AACf,WAAO;AAAA,MACN,iBAAiB;AAChB,cAAM,aAAa,iBAAiB;AAAA,UACnC,QAAQ,WAAW;AAAA,QACpB;AAEA,mBAAW,QAAQ,OAAO,aAAa,EAAE,QAAQ,CAAC,YAAY;AAC7D,cAAI,SAAS;AACZ,oBAAQ,OAAO;AAAA,cACd;AAAA,cACA,MAAM,QAAQ,WAAW;AAAA,YAC1B,CAAC;AAAA,UACF;AAAA,QACD,CAAC;AAAA,MACF;AAAA,IACD;AAAA,EACD;AAAA,EAEA,MAAM;AAAA,IACL,MAAM;AAAA,MACL,UAAU;AAAA,MACV,aACC;AAAA,MACD,aAAa;AAAA,IACd;AAAA,EACD;AACD,CAAC;","names":[]}
package/package.json CHANGED
@@ -1,15 +1,12 @@
1
1
  {
2
2
  "name": "eslint-plugin-package-json",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "Rules for consistent, readable, and valid package.json files. 🗂️",
5
- "homepage": "https://github.com/zetlen/eslint-plugin-package-json#readme",
5
+ "homepage": "https://github.com/JoshuaKGoldberg/eslint-plugin-package-json#readme",
6
6
  "bugs": {
7
- "url": "https://github.com/zetlen/eslint-plugin-package-json/issues"
8
- },
9
- "repository": {
10
- "type": "git",
11
- "url": "https://github.com/JoshuaKGoldberg/eslint-plugin-package-json"
7
+ "url": "https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues"
12
8
  },
9
+ "repository": "JoshuaKGoldberg/eslint-plugin-package-json",
13
10
  "license": "MIT",
14
11
  "author": {
15
12
  "name": "James Zetlan",
@@ -57,45 +54,45 @@
57
54
  "sort-package-json": "^1.57.0"
58
55
  },
59
56
  "devDependencies": {
60
- "@release-it/conventional-changelog": "^8.0.0",
61
- "@types/eslint": "^8.44.7",
62
- "@types/estree": "^1.0.2",
63
- "@types/node": "^20.8.6",
64
- "@types/package-json-validator": "^0.6.0",
65
- "@typescript-eslint/eslint-plugin": "^6.10.0",
66
- "@typescript-eslint/parser": "^6.10.0",
67
- "@vitest/coverage-v8": "^1.0.0",
57
+ "@release-it/conventional-changelog": "^8.0.1",
58
+ "@types/eslint": "^8.56.2",
59
+ "@types/estree": "^1.0.5",
60
+ "@types/node": "^20.11.5",
61
+ "@types/package-json-validator": "^0.6.1",
62
+ "@typescript-eslint/eslint-plugin": "^6.19.0",
63
+ "@typescript-eslint/parser": "^6.19.0",
64
+ "@vitest/coverage-v8": "^1.2.1",
68
65
  "console-fail-test": "^0.2.3",
69
- "cspell": "^8.0.0",
70
- "eslint": "^8.53.0",
71
- "eslint-doc-generator": "^1.5.4",
66
+ "cspell": "^8.3.2",
67
+ "eslint": "^8.56.0",
68
+ "eslint-doc-generator": "^1.6.2",
72
69
  "eslint-plugin-deprecation": "^2.0.0",
73
70
  "eslint-plugin-eslint-comments": "^3.2.0",
74
- "eslint-plugin-jsdoc": "^48.0.0",
75
- "eslint-plugin-jsonc": "^2.10.0",
71
+ "eslint-plugin-jsdoc": "^48.0.2",
72
+ "eslint-plugin-jsonc": "^2.12.2",
76
73
  "eslint-plugin-markdown": "^3.0.1",
77
- "eslint-plugin-n": "^16.3.1",
74
+ "eslint-plugin-n": "^16.6.2",
78
75
  "eslint-plugin-no-only-tests": "^3.1.0",
79
- "eslint-plugin-perfectionist": "^2.2.0",
80
- "eslint-plugin-regexp": "^2.1.1",
81
- "eslint-plugin-vitest": "^0.3.9",
82
- "eslint-plugin-yml": "^1.10.0",
76
+ "eslint-plugin-perfectionist": "^2.5.0",
77
+ "eslint-plugin-regexp": "^2.2.0",
78
+ "eslint-plugin-vitest": "^0.3.20",
79
+ "eslint-plugin-yml": "^1.12.2",
83
80
  "husky": "^8.0.3",
84
81
  "jsonc-eslint-parser": "^2.4.0",
85
- "knip": "^4.0.0",
86
- "lint-staged": "^15.1.0",
82
+ "knip": "^4.0.4",
83
+ "lint-staged": "^15.2.0",
87
84
  "markdownlint": "^0.33.0",
88
85
  "markdownlint-cli": "^0.38.0",
89
86
  "npm-package-json-lint": "^7.1.0",
90
87
  "npm-package-json-lint-config-default": "^6.0.0",
91
- "prettier": "^3.0.3",
88
+ "prettier": "^3.2.4",
92
89
  "prettier-plugin-curly": "^0.1.3",
93
- "prettier-plugin-packagejson": "^2.4.6",
94
- "release-it": "^17.0.0",
90
+ "prettier-plugin-packagejson": "^2.4.9",
91
+ "release-it": "^17.0.1",
95
92
  "should-semantic-release": "^0.2.1",
96
- "tsup": "^8.0.0",
97
- "typescript": "^5.2.2",
98
- "vitest": "^1.0.0",
93
+ "tsup": "^8.0.1",
94
+ "typescript": "^5.3.3",
95
+ "vitest": "^1.2.1",
99
96
  "yaml-eslint-parser": "^1.2.2"
100
97
  },
101
98
  "peerDependencies": {