@pumpn/eslint-config 16.0.0 → 16.1.2

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.
Files changed (52) hide show
  1. package/.vscode/settings.json +14 -1
  2. package/config.js +31 -39
  3. package/deno.json +23 -23
  4. package/deno.lock +1689 -20
  5. package/eslint.config.js +13 -5
  6. package/package.json +20 -20
  7. package/plugins.js +13 -9
  8. package/rules/command.js +1 -1
  9. package/rules/depend.js +1 -1
  10. package/rules/eslint-comments.js +1 -1
  11. package/rules/github.js +1 -1
  12. package/rules/import-x/helpful-warnings.js +2 -2
  13. package/rules/import-x/static-analysis.js +1 -1
  14. package/rules/import-x/style-guide.js +10 -2
  15. package/rules/import-x.js +1 -1
  16. package/rules/jsdoc.js +3 -27
  17. package/rules/jsx-a11y.js +1 -1
  18. package/rules/layout-and-formatting.js +1 -1
  19. package/rules/no-secrets.js +1 -1
  20. package/rules/no-unsanitized.js +1 -1
  21. package/rules/perfectionist.js +19 -31
  22. package/rules/possible-problems.js +1 -1
  23. package/rules/promise.js +20 -5
  24. package/rules/react/naming-convention.js +0 -2
  25. package/rules/react.js +1 -1
  26. package/rules/redos.js +1 -1
  27. package/rules/regexp.js +1 -1
  28. package/rules/security.js +1 -1
  29. package/rules/sonarjs/bug-detection.js +0 -1
  30. package/rules/sonarjs.js +1 -1
  31. package/rules/stylistic/_common/min-items-for-array-newline.js +1 -1
  32. package/rules/stylistic/indent.js +0 -1
  33. package/rules/stylistic/jsx.js +0 -1
  34. package/rules/stylistic/linebreaks.js +3 -15
  35. package/rules/stylistic.js +1 -1
  36. package/rules/suggestions.js +4 -16
  37. package/rules/tailwindcss.js +1 -1
  38. package/rules/unicorn.js +19 -6
  39. package/rules.js +1 -1
  40. package/scripts/update-package-json.js +42 -22
  41. package/documentation/global.html +0 -566
  42. package/documentation/index.html +0 -135
  43. package/documentation/index.js.html +0 -35865
  44. package/documentation/scripts/app.min.js +0 -1
  45. package/documentation/scripts/linenumber.js +0 -26
  46. package/documentation/scripts/search.js +0 -39
  47. package/documentation/styles/app.min.css +0 -1
  48. package/documentation/styles/iframe.css +0 -13
  49. package/documentation/styles/prettify-jsdoc.css +0 -111
  50. package/documentation/styles/prettify-tomorrow.css +0 -132
  51. package/documentation/styles/reset.css +0 -44
  52. package/jsdoc.json +0 -51
package/rules/unicorn.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @import { Linter } from "eslint"
2
+ * @import { Linter } from "eslint";
3
3
  */
4
4
 
5
5
  const hexadecimalGroupLength = 2;
@@ -48,11 +48,12 @@ const unicornRules = {
48
48
  "unicorn/custom-error-definition": "error",
49
49
  "unicorn/empty-brace-spaces": "error",
50
50
  "unicorn/error-message": "error",
51
- "unicorn/escape-case": "error",
51
+ "unicorn/escape-case": ["error", "uppercase"],
52
52
  "unicorn/expiring-todo-comments": [
53
53
  "error",
54
54
  {
55
- allowWarningComments: false
55
+ allowWarningComments: false,
56
+ terms: ["todo", "fixme"]
56
57
  }
57
58
  ],
58
59
  "unicorn/explicit-length-check": "error",
@@ -65,8 +66,8 @@ const unicornRules = {
65
66
  "unicorn/no-array-callback-reference": "off",
66
67
  "unicorn/no-array-for-each": "error",
67
68
  "unicorn/no-array-method-this-argument": "error",
68
- "unicorn/no-array-push-push": "error",
69
69
  "unicorn/no-array-reduce": "off",
70
+ "unicorn/no-array-reverse": "error",
70
71
  "unicorn/no-await-expression-member": "error",
71
72
  "unicorn/no-await-in-promise-methods": "error",
72
73
  "unicorn/no-console-spaces": "error",
@@ -85,7 +86,6 @@ const unicornRules = {
85
86
  onlyCamelCase: true
86
87
  }
87
88
  ],
88
- "unicorn/no-length-as-slice-end": "error",
89
89
  "unicorn/no-lonely-if": "error",
90
90
  "unicorn/no-magic-array-flat-depth": "error",
91
91
  "unicorn/no-named-default": "error",
@@ -102,11 +102,15 @@ const unicornRules = {
102
102
  "unicorn/no-thenable": "error",
103
103
  "unicorn/no-this-assignment": "error",
104
104
  "unicorn/no-typeof-undefined": "error",
105
+ "unicorn/no-unnecessary-array-flat-depth": "error",
106
+ "unicorn/no-unnecessary-array-splice-count": "error",
105
107
  "unicorn/no-unnecessary-await": "error",
106
108
  "unicorn/no-unnecessary-polyfills": "error",
109
+ "unicorn/no-unnecessary-slice-end": "error",
107
110
  "unicorn/no-unreadable-array-destructuring": "error",
108
111
  "unicorn/no-unreadable-iife": "error",
109
112
  "unicorn/no-unused-properties": "error",
113
+ "unicorn/no-useless-error-capture-stack-trace": "error",
110
114
  "unicorn/no-useless-fallback-in-spread": "error",
111
115
  "unicorn/no-useless-length-check": "error",
112
116
  "unicorn/no-useless-promise-resolve-reject": "error",
@@ -114,7 +118,12 @@ const unicornRules = {
114
118
  "unicorn/no-useless-switch-case": "error",
115
119
  "unicorn/no-useless-undefined": "error",
116
120
  "unicorn/no-zero-fractions": "error",
117
- "unicorn/number-literal-case": "error",
121
+ "unicorn/number-literal-case": [
122
+ "error",
123
+ {
124
+ hexadecimalValue: "uppercase"
125
+ }
126
+ ],
118
127
  "unicorn/numeric-separators-style": [
119
128
  "error",
120
129
  {
@@ -145,6 +154,7 @@ const unicornRules = {
145
154
  "unicorn/prefer-array-some": "error",
146
155
  "unicorn/prefer-at": "error",
147
156
  "unicorn/prefer-blob-reading-methods": "error",
157
+ "unicorn/prefer-class-fields": "error",
148
158
  "unicorn/prefer-code-point": "error",
149
159
  "unicorn/prefer-date-now": "error",
150
160
  "unicorn/prefer-default-parameters": "error",
@@ -155,6 +165,7 @@ const unicornRules = {
155
165
  "unicorn/prefer-event-target": "error",
156
166
  "unicorn/prefer-export-from": "error",
157
167
  "unicorn/prefer-global-this": "error",
168
+ "unicorn/prefer-import-meta-properties": "error",
158
169
  "unicorn/prefer-includes": "error",
159
170
  "unicorn/prefer-json-parse-buffer": "off",
160
171
  "unicorn/prefer-keyboard-event-key": "error",
@@ -181,6 +192,7 @@ const unicornRules = {
181
192
  "unicorn/prefer-regexp-test": "error",
182
193
  "unicorn/prefer-set-has": "error",
183
194
  "unicorn/prefer-set-size": "error",
195
+ "unicorn/prefer-single-call": "error",
184
196
  "unicorn/prefer-spread": "error",
185
197
  "unicorn/prefer-string-raw": "error",
186
198
  "unicorn/prefer-string-replace-all": "error",
@@ -195,6 +207,7 @@ const unicornRules = {
195
207
  "unicorn/prevent-abbreviations": "error",
196
208
  "unicorn/relative-url-style": "error",
197
209
  "unicorn/require-array-join-separator": "error",
210
+ "unicorn/require-module-specifiers": "error",
198
211
  "unicorn/require-number-to-fixed-digits-argument": "error",
199
212
  "unicorn/require-post-message-target-origin": "off",
200
213
  "unicorn/string-content": [
package/rules.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as ruleSets from "./rules/_exports.js";
2
2
 
3
3
  /**
4
- * @import { Linter } from "eslint"
4
+ * @import { Linter } from "eslint";
5
5
  */
6
6
 
7
7
  /**
@@ -1,42 +1,62 @@
1
1
  import { join } from "@std/path";
2
2
 
3
+ import denoJson from "../deno.json" with { type: "json" };
4
+ import packageJson from "../package.json" with { type: "json" };
5
+
3
6
  const {
4
7
  cwd,
5
- readTextFile,
6
8
  writeTextFile
7
9
  } = Deno;
8
10
 
9
- const importMapFilePath = join(cwd(), "deno.json");
10
- const importMapFileContent = await readTextFile(importMapFilePath);
11
- const importMap = JSON.parse(importMapFileContent);
12
-
13
11
  const packageJsonFilePath = join(cwd(), "package.json");
14
- const packageJsonFileContent = await readTextFile(packageJsonFilePath);
15
- const packageJson = JSON.parse(packageJsonFileContent);
16
12
 
17
13
  const collator = new Intl.Collator("en", {
18
14
  numeric: true
19
15
  });
20
16
 
17
+ /**
18
+ * Parses the version from a URL.
19
+ *
20
+ * @param {string} url - The URL to parse.
21
+ * @returns {string} - The parsed version.
22
+ */
23
+ const parseVersion = (url) => url.replace(/^npm:.*?@(?=[^@]+$)/v, "");
24
+
25
+ /**
26
+ * Converts import map entries to a sorted array of tuples with specificer and version.
27
+ *
28
+ * @param {readonly (readonly [string, string])[]} entries - The import map entries to convert.
29
+ * @returns {readonly (readonly [string, string])[]} - The sorted array of tuples.
30
+ */
31
+ const convertImportMapEntries = (entries) => entries
32
+ .map(([specificer, url]) => /** @type {const} */ ([specificer, parseVersion(url)]))
33
+ .toSorted((
34
+ [packageNameA],
35
+ [packageNameB]
36
+ ) => collator.compare(
37
+ packageNameA,
38
+ packageNameB
39
+ ));
40
+
21
41
  const updatedPackageJson = {
22
42
  ...packageJson,
23
43
  dependencies: Object.fromEntries(
24
- Object.entries(
25
- importMap.imports
44
+ convertImportMapEntries(
45
+ Object.entries(denoJson.imports)
46
+ .filter(([specifier, url]) => url.startsWith("npm:") && specifier !== "eslint")
47
+ )
48
+ ),
49
+ devDependencies: Object.fromEntries(
50
+ convertImportMapEntries(
51
+ Object.entries(denoJson.imports)
52
+ .filter(([specifier, url]) => url.startsWith("npm:") && specifier === "eslint")
53
+ )
54
+ ),
55
+ peerDependencies: Object.fromEntries(
56
+ convertImportMapEntries(
57
+ Object.entries(denoJson.imports)
58
+ .filter(([specifier, url]) => url.startsWith("npm:") && specifier === "eslint")
26
59
  )
27
- .filter(([specifier, url]) => url.startsWith("npm:"))
28
- .map(([specificer, url]) => {
29
- const version = url.replace(/^npm:.*?@(?<version>[^@]+)$/v, "$<version>");
30
-
31
- return [specificer, version];
32
- })
33
- .toSorted((
34
- [packageNameA],
35
- [packageNameB]
36
- ) => collator.compare(
37
- packageNameA,
38
- packageNameB
39
- ))
40
60
  )
41
61
  };
42
62