@pumpn/eslint-config 15.5.3 → 16.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pumpn/eslint-config",
3
- "version": "15.5.3",
3
+ "version": "16.0.0",
4
4
  "description": "standard eslint config for pumpn code projects",
5
5
  "main": "config.js",
6
6
  "author": "Nano Miratus <nanomiratus@gmail.com>",
@@ -17,35 +17,30 @@
17
17
  "test": "echo 'no tests yet'"
18
18
  },
19
19
  "devDependencies": {
20
- "eslint": "^9.13.0"
20
+ "eslint": "^9.21.0"
21
21
  },
22
22
  "dependencies": {
23
- "@eslint-community/eslint-plugin-eslint-comments": "^4.4.0",
24
- "@eslint-react/eslint-plugin": "^1.15.0",
25
- "@stylistic/eslint-plugin": "^2.9.0",
26
- "@typescript-eslint/parser": "^8.11.0",
27
- "eslint-plugin-depend": "^0.11.0",
28
- "eslint-plugin-disable-autofix": "^5.0.1",
29
- "eslint-plugin-func-params-args": "^4.0.0",
30
- "eslint-plugin-import-x": "^4.3.1",
31
- "eslint-plugin-jsdoc": "^50.4.3",
32
- "eslint-plugin-no-secrets": "^1.0.2",
33
- "eslint-plugin-perfectionist": "^3.9.1",
34
- "eslint-plugin-promise": "^7.1.0",
23
+ "@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
24
+ "@eslint-react/eslint-plugin": "^1.28.0",
25
+ "@stylistic/eslint-plugin": "^4.1.0",
26
+ "@typescript-eslint/parser": "^8.25.0",
27
+ "eslint-plugin-command": "^3.1.0",
28
+ "eslint-plugin-depend": "^0.12.0",
29
+ "eslint-plugin-import-x": "^4.6.1",
30
+ "eslint-plugin-jsdoc": "^50.6.3",
31
+ "eslint-plugin-no-secrets": "^2.2.1",
32
+ "eslint-plugin-perfectionist": "^4.9.0",
33
+ "eslint-plugin-promise": "^7.2.1",
34
+ "eslint-plugin-react": "^7.37.4",
35
35
  "eslint-plugin-redos": "^4.4.5",
36
- "eslint-plugin-regexp": "^2.6.0",
36
+ "eslint-plugin-regexp": "^2.7.0",
37
37
  "eslint-plugin-security": "^3.0.1",
38
- "eslint-plugin-sonarjs": "^2.0.4",
39
- "eslint-plugin-tailwindcss": "^3.17.5",
40
- "eslint-plugin-unicorn": "^56.0.0",
41
- "globals": "^15.11.0"
38
+ "eslint-plugin-sonarjs": "^3.0.2",
39
+ "eslint-plugin-tailwindcss": "^3.18.0",
40
+ "eslint-plugin-unicorn": "^57.0.0",
41
+ "globals": "^16.0.0"
42
42
  },
43
43
  "peerDependencies": {
44
- "eslint": "^9.13.0"
45
- },
46
- "overrides": {
47
- "@typescript-eslint/type-utils": "^8.11.0",
48
- "@typescript-eslint/utils": "^8.11.0",
49
- "eslint": "^9.13.0"
44
+ "eslint": "^9.21.0"
50
45
  }
51
- }
46
+ }
package/plugins.js CHANGED
@@ -8,9 +8,8 @@
8
8
  import eslintComments from "@eslint-community/eslint-plugin-eslint-comments";
9
9
  import react from "@eslint-react/eslint-plugin";
10
10
  import stylistic from "@stylistic/eslint-plugin";
11
+ import command from "eslint-plugin-command";
11
12
  import depend from "eslint-plugin-depend";
12
- import disableAutofix from "eslint-plugin-disable-autofix";
13
- import funcParamsArgs from "eslint-plugin-func-params-args";
14
13
  import importX from "eslint-plugin-import-x";
15
14
  import jsdoc from "eslint-plugin-jsdoc";
16
15
  import noSecrets from "eslint-plugin-no-secrets";
@@ -40,9 +39,8 @@ const plugins = /** @type {const} */ ({
40
39
  // "no-unsanitized": noUnsanitized,
41
40
  "@eslint-community/eslint-comments": eslintComments,
42
41
  "@stylistic": /** @type {ESLint.Plugin} */ (stylistic),
42
+ command,
43
43
  depend,
44
- "disable-autofix": disableAutofix,
45
- "func-params-args": funcParamsArgs,
46
44
  "import-x": /** @type {ESLint.Plugin} */ (
47
45
  /** @type {unknown} */ (importX)
48
46
  ),
package/rules/_exports.js CHANGED
@@ -1,6 +1,5 @@
1
1
  export { default as dependRules } from "./depend.js";
2
2
  export { default as eslintCommentsRules } from "./eslint-comments.js";
3
- export { default as funcParamsArgsRules } from "./func-params-args.js";
4
3
  // export { default as githubRules } from "./github.js";
5
4
  export { default as importXRules } from "./import-x.js";
6
5
  export { default as jsdocRules } from "./jsdoc.js";
@@ -14,6 +13,7 @@ export { default as perfectionistRules } from "./perfectionist.js";
14
13
  export { default as possibleProblemsRules } from "./possible-problems.js";
15
14
  export { default as reactRules } from "./react.js";
16
15
  // export { default as redosRules } from "./redos.js";
16
+ export { default as commandRules } from "./command.js";
17
17
  export { default as regexpRules } from "./regexp.js";
18
18
  export { default as securityRules } from "./security.js";
19
19
  export { default as sonarjsRules } from "./sonarjs.js";
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @import { Linter } from "eslint"
3
+ */
4
+
5
+ /**
6
+ * @satisfies {Linter.RulesRecord}
7
+ */
8
+ const commandRules = {
9
+ "command/command": "error"
10
+ };
11
+
12
+ export default commandRules;
@@ -57,7 +57,7 @@ const staticAnalysisRules = {
57
57
  }
58
58
  ],
59
59
  "import-x/no-self-import": "error",
60
- // TODO [2024-11-01]: Change to "error" when there is a resolver for deno
60
+ // TODO [2025-03-01]: Change to "error" when there is a resolver for deno (maybe https://github.com/redabacha/eslint-import-resolver-deno)
61
61
  "import-x/no-unresolved": "off",
62
62
  "import-x/no-useless-path-segments": [
63
63
  "error",
@@ -31,12 +31,7 @@ const styleGuideRules = {
31
31
  "import-x/no-duplicates": "error",
32
32
  "import-x/no-named-default": "error",
33
33
  "import-x/no-named-export": "off",
34
- "import-x/no-namespace": [
35
- "error",
36
- {
37
- ignore: ["{./**/,**/}_exports.?(*.)js", "@typescript-eslint/parser"]
38
- }
39
- ],
34
+ "import-x/no-namespace": "off",
40
35
  "import-x/no-unassigned-import": "error",
41
36
  "import-x/order": [
42
37
  "off",
package/rules/jsdoc.js CHANGED
@@ -176,14 +176,14 @@ const jsdocRules = {
176
176
  Property > AssignmentPattern
177
177
  )
178
178
  ) > ArrowFunctionExpression
179
- `.replaceAll(/\s/gu, "")
179
+ `.replaceAll(/\s/gv, "")
180
180
  ],
181
181
  require: {
182
182
  ArrowFunctionExpression: false,
183
183
  ClassDeclaration: true,
184
184
  ClassExpression: true,
185
185
  FunctionDeclaration: true,
186
- FunctionExpression: true,
186
+ FunctionExpression: false,
187
187
  MethodDefinition: true
188
188
  }
189
189
  }
@@ -17,12 +17,12 @@ const perfectionistRules = {
17
17
  {
18
18
  groups: [
19
19
  "index-signature",
20
+ ["private-static-property", "private-static-accessor-property"],
21
+ ["private-static-get-method", "private-static-set-method"],
20
22
  ["static-property", "static-accessor-property"],
21
23
  ["static-get-method", "static-set-method"],
22
24
  ["protected-static-property", "protected-static-accessor-property"],
23
25
  ["protected-static-get-method", "protected-static-set-method"],
24
- ["private-static-property", "private-static-accessor-property"],
25
- ["private-static-get-method", "private-static-set-method"],
26
26
  "static-block",
27
27
  ["property", "accessor-property"],
28
28
  ["get-method", "set-method"],
@@ -39,7 +39,8 @@ const perfectionistRules = {
39
39
  ["private-method", "private-function-property"],
40
40
  "unknown"
41
41
  ],
42
- partitionByComment: false
42
+ partitionByComment: String.raw`\/\/`,
43
+ partitionByNewLine: false
43
44
  }
44
45
  ],
45
46
  "perfectionist/sort-enums": ["error"],
@@ -50,12 +51,12 @@ const perfectionistRules = {
50
51
  customGroups: {
51
52
  type: {},
52
53
  value: {
53
- components: "@/components/**",
54
- islands: "@/islands/**",
55
- logic: "@/logic/**",
56
- plugins: "@/plugins/**",
57
- std: "@std/**",
58
- utilities: "@/utilities/**"
54
+ components: "^@/components/.*",
55
+ islands: "^@/islands/.*",
56
+ logic: "^@/logic/.*",
57
+ plugins: "^@/plugins/.*",
58
+ std: "^@std/.*",
59
+ utilities: "^@/utilities/.*"
59
60
  }
60
61
  },
61
62
  groups: [
@@ -79,8 +80,9 @@ const perfectionistRules = {
79
80
  "index",
80
81
  "unknown"
81
82
  ],
82
- internalPattern: ["@/**"],
83
+ internalPattern: ["^@/.*"],
83
84
  newlinesBetween: "always",
85
+ partitionByNewLine: false,
84
86
  sortSideEffects: true
85
87
  }
86
88
  ],
@@ -96,7 +98,15 @@ const perfectionistRules = {
96
98
  ]
97
99
  }
98
100
  ],
99
- "perfectionist/sort-maps": ["error"],
101
+ "perfectionist/sort-maps": [
102
+ "error",
103
+ {
104
+ ignoreCase: false,
105
+ order: "asc",
106
+ partitionByNewLine: true,
107
+ type: "natural"
108
+ }
109
+ ],
100
110
  "perfectionist/sort-named-exports": ["error"],
101
111
  "perfectionist/sort-named-imports": ["error", { partitionByComment: false }],
102
112
  "perfectionist/sort-object-types": ["error"],
@@ -104,46 +114,46 @@ const perfectionistRules = {
104
114
  "error",
105
115
  {
106
116
  customGroups: {
107
- id: ["id"],
108
- groupBeforeAfter1: ["before*"],
109
- groupBeforeAfter2: ["after*"],
110
- groupColor1: ["r", "l"],
117
+ id: ["^id$"],
118
+ groupBeforeAfter1: ["^before.*"],
119
+ groupBeforeAfter2: ["^after.*"],
120
+ groupColor1: ["^r$", "^l$"],
111
121
  groupColor2: [
112
- "g",
113
- "c",
114
- "a"
122
+ "^g$",
123
+ "^c$",
124
+ "^a$"
115
125
  ],
116
- groupColor3: ["b", "h"],
117
- groupMinMax1: ["min*"],
118
- groupMinMax2: ["max*"],
119
- groupMinimumMaximum1: ["minimum*"],
120
- groupMinimumMaximum2: ["maximum*"],
121
- groupPrecedenceOrdinal1: ["primary*"],
122
- groupPrecedenceOrdinal2: ["secondary*"],
123
- groupPrecedenceOrdinal3: ["tertiary*"],
124
- groupPrecedenceOrdinal4: ["quaternary*"],
125
- groupPrecedenceOrdinal5: ["quinary*"],
126
- groupPrecedenceOrdinal6: ["senary*"],
127
- groupPrecedenceOrdinal7: ["septenary*"],
128
- groupPrecedenceOrdinal8: ["octonary*"],
129
- groupPrecedenceOrdinal9: ["nonary*"],
130
- groupPrecedenceOrdinal10: ["denary*"],
131
- groupPrecedenceOrdinalLast: ["ultimate*"],
132
- groupPrevNext1: ["prev!(ent*)"],
133
- groupPrevNext2: ["next*"],
134
- groupPreviousNext1: ["previous*"],
135
- groupPreviousNext2: ["next*"],
136
- groupSpatialOrdinal1: ["first*"],
137
- groupSpatialOrdinal2: ["second*"],
138
- groupSpatialOrdinal3: ["third*"],
139
- groupSpatialOrdinal4: ["fourth*"],
140
- groupSpatialOrdinal5: ["fifth*"],
141
- groupSpatialOrdinal6: ["sixth*"],
142
- groupSpatialOrdinal7: ["seventh*"],
143
- groupSpatialOrdinal8: ["eighth*"],
144
- groupSpatialOrdinal9: ["ninth*"],
145
- groupSpatialOrdinal10: ["tenth*"],
146
- groupSpatialOrdinalLast: ["last*"]
126
+ groupColor3: ["^b$", "^h$"],
127
+ groupMinimumMaximum1: ["^minimum(([A-Z].*)|$)"],
128
+ groupMinimumMaximum2: ["^maximum(([A-Z].*)|$)"],
129
+ groupMinMax1: ["^min(([A-Z_-].*)|$)"],
130
+ groupMinMax2: ["^max(([A-Z_-].*)|$)"],
131
+ groupPrecedenceOrdinal1: ["^primary.*"],
132
+ groupPrecedenceOrdinal2: ["^secondary.*"],
133
+ groupPrecedenceOrdinal3: ["^tertiary.*"],
134
+ groupPrecedenceOrdinal4: ["^quaternary.*"],
135
+ groupPrecedenceOrdinal5: ["^quinary.*"],
136
+ groupPrecedenceOrdinal6: ["^senary.*"],
137
+ groupPrecedenceOrdinal7: ["^septenary.*"],
138
+ groupPrecedenceOrdinal8: ["^octonary.*"],
139
+ groupPrecedenceOrdinal9: ["^nonary.*"],
140
+ groupPrecedenceOrdinal10: ["^denary.*"],
141
+ groupPrecedenceOrdinalLast: ["^ultimate.*"],
142
+ groupPreviousNext1: ["^previous.*"],
143
+ groupPreviousNext2: ["^next.*"],
144
+ groupPrevNext1: ["^prev(?!ent).*"],
145
+ groupPrevNext2: ["^next.*"],
146
+ groupSpatialOrdinal1: ["^first.*"],
147
+ groupSpatialOrdinal2: ["^second.*"],
148
+ groupSpatialOrdinal3: ["^third.*"],
149
+ groupSpatialOrdinal4: ["^fourth.*"],
150
+ groupSpatialOrdinal5: ["^fifth.*"],
151
+ groupSpatialOrdinal6: ["^sixth.*"],
152
+ groupSpatialOrdinal7: ["^seventh.*"],
153
+ groupSpatialOrdinal8: ["^eighth.*"],
154
+ groupSpatialOrdinal9: ["^ninth.*"],
155
+ groupSpatialOrdinal10: ["^tenth.*"],
156
+ groupSpatialOrdinalLast: ["^last.*"]
147
157
  },
148
158
  groups: [
149
159
  "id",
@@ -33,8 +33,7 @@ const bestPracticesRules = {
33
33
  "regexp/prefer-regexp-test": "off",
34
34
  "regexp/prefer-set-operation": "error",
35
35
  "regexp/require-unicode-regexp": "error",
36
- // TODO [2024-11-01]: enable when https://github.com/microsoft/TypeScript-TmLanguage/pull/1032 is resolved
37
- "regexp/require-unicode-sets-regexp": "off",
36
+ "regexp/require-unicode-sets-regexp": "error",
38
37
  "regexp/simplify-set-operations": "error",
39
38
  "regexp/sort-alternatives": "error",
40
39
  "regexp/use-ignore-case": "error"
package/rules/unicorn.js CHANGED
@@ -9,29 +9,29 @@ const numberGroupLength = 3;
9
9
 
10
10
  const patterns = {
11
11
  "'": "’",
12
- "(?<=[!?])\\.": "",
12
+ "(?<=“[^“]*?\\s)['‘]([^'‘]+?)['’](?=\\s[^“]*?”)": "‘$1’",
13
13
  "(?<=[!?])”\\.(?=(?:(?:\\s+[\\p{Letter}\\p{Number}])|$))": "”",
14
+ "(?<=[!?])\\.": "",
14
15
  "(?<=[\\p{Letter}\\p{Number}] )-+(?= [\\p{Letter}\\p{Number}])": "—",
15
16
  "(?<=\\p{Punctuation})\\p{Zs}{2,}(?=[\\p{Letter}\\p{Number}])": " ",
16
- "(?<=“[^“]*?\\s)['‘]([^'‘]+?)['’](?=\\s[^“]*?”)": "‘$1’",
17
17
  "([\"'])((?:\\\\.|[^\\\\])*?)\\1": "“$2”",
18
+ "-->": "⟶",
19
+ "->": "→",
20
+ "\\.”\\.(?=(?:(?:\\s+[\\p{Letter}\\p{Number}])|$))": ".”",
21
+ "<-": "←",
22
+ "<--": "⟵",
23
+ "<-->": "⟷",
24
+ "<->": "↔",
18
25
  "<=": "≤",
19
26
  "<==": "⇐",
20
27
  "<===": "⟸",
21
28
  "<==>": "⟺",
22
29
  "<=>": "⇔",
23
- "<-": "←",
24
- "<->": "↔",
25
- "<--": "⟵",
26
- "<-->": "⟷",
27
30
  "===>": "⟹",
28
31
  "==>": "⇒",
29
32
  ">=": "≥",
30
33
  "\\.\\.(?=(?:(?:\\s+[\\p{Letter}\\p{Number}])|$))": ".",
31
- "\\.\\.\\.": "…",
32
- "\\.”\\.(?=(?:(?:\\s+[\\p{Letter}\\p{Number}])|$))": ".”",
33
- "->": "→",
34
- "-->": "⟶"
34
+ "\\.\\.\\.": "…"
35
35
  };
36
36
 
37
37
  /**
@@ -39,6 +39,8 @@ const patterns = {
39
39
  */
40
40
  const unicornRules = {
41
41
  "unicorn/catch-error-name": "error",
42
+ "unicorn/consistent-assert": "error",
43
+ "unicorn/consistent-date-clone": "error",
42
44
  "unicorn/consistent-destructuring": "error",
43
45
  "unicorn/consistent-empty-array-spread": "error",
44
46
  "unicorn/consistent-existence-index-check": "error",
@@ -58,6 +60,7 @@ const unicornRules = {
58
60
  "unicorn/import-style": "error",
59
61
  "unicorn/new-for-builtins": "error",
60
62
  "unicorn/no-abusive-eslint-disable": "error",
63
+ "unicorn/no-accessor-recursion": "error",
61
64
  "unicorn/no-anonymous-default-export": "error",
62
65
  "unicorn/no-array-callback-reference": "off",
63
66
  "unicorn/no-array-for-each": "error",
@@ -72,6 +75,7 @@ const unicornRules = {
72
75
  "unicorn/no-for-loop": "error",
73
76
  "unicorn/no-hex-escape": "error",
74
77
  "unicorn/no-instanceof-array": "error",
78
+ "unicorn/no-instanceof-builtins": "error",
75
79
  "unicorn/no-invalid-fetch-options": "error",
76
80
  "unicorn/no-invalid-remove-event-listener": "error",
77
81
  "unicorn/no-keyword-prefix": [
@@ -84,6 +88,7 @@ const unicornRules = {
84
88
  "unicorn/no-length-as-slice-end": "error",
85
89
  "unicorn/no-lonely-if": "error",
86
90
  "unicorn/no-magic-array-flat-depth": "error",
91
+ "unicorn/no-named-default": "error",
87
92
  "unicorn/no-negated-condition": "error",
88
93
  "unicorn/no-negation-in-equality-check": "error",
89
94
  "unicorn/no-nested-ternary": "error",
@@ -0,0 +1,46 @@
1
+ import { join } from "@std/path";
2
+
3
+ const {
4
+ cwd,
5
+ readTextFile,
6
+ writeTextFile
7
+ } = Deno;
8
+
9
+ const importMapFilePath = join(cwd(), "deno.json");
10
+ const importMapFileContent = await readTextFile(importMapFilePath);
11
+ const importMap = JSON.parse(importMapFileContent);
12
+
13
+ const packageJsonFilePath = join(cwd(), "package.json");
14
+ const packageJsonFileContent = await readTextFile(packageJsonFilePath);
15
+ const packageJson = JSON.parse(packageJsonFileContent);
16
+
17
+ const collator = new Intl.Collator("en", {
18
+ numeric: true
19
+ });
20
+
21
+ const updatedPackageJson = {
22
+ ...packageJson,
23
+ dependencies: Object.fromEntries(
24
+ Object.entries(
25
+ importMap.imports
26
+ )
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
+ )
41
+ };
42
+
43
+ await writeTextFile(
44
+ packageJsonFilePath,
45
+ JSON.stringify(updatedPackageJson, null, "\t")
46
+ );
package/.tool-versions DELETED
@@ -1 +0,0 @@
1
- nodejs 22.5.1
@@ -1,18 +0,0 @@
1
- /**
2
- * @import { Linter } from "eslint"
3
- */
4
-
5
- /**
6
- * @satisfies {Linter.RulesRecord}
7
- */
8
- const funcParamsArgsRules = {
9
- "func-params-args/func-args": [
10
- "warn",
11
- {
12
- global: 3,
13
- reduce: 4
14
- }
15
- ]
16
- };
17
-
18
- export default funcParamsArgsRules;