eslint-config-vylda-typescript 5.4.1 → 5.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/Changelog.md CHANGED
@@ -4,6 +4,21 @@ All notable changes to this component will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [5.6.0] - 2025-12-06
8
+ ### Updated
9
+ - eslint-config-vylda-vanilla package [Vilda Lipold]
10
+
11
+ ## [5.5.0] - 2025-12-06
12
+ ### Added
13
+ - Rules
14
+ - @typescript-eslint/no-unused-private-class-members [Vilda Lipold]
15
+ ### Fixed
16
+ - typescript errors in create stylictic rules [Vilda Lipold]
17
+ ### Removed
18
+ - deprecated option overrides.arrow in type-annotation-spacing rule [Vilda Lipold]
19
+ ### Updated
20
+ - packages [Vilda Lipold]
21
+
7
22
  ## [5.4.1] - 2025-11-13
8
23
  ### Updated
9
24
  - index.d.ts file [Vilda Lipold]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-vylda-typescript",
3
- "version": "5.4.1",
3
+ "version": "5.6.0",
4
4
  "description": "Eslint Typescript rules for JS and TS vanilla projects",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -24,7 +24,7 @@
24
24
  "homepage": "https://gitlab.com/Vylda/eslint-config-vylda-typescript",
25
25
  "license": "MIT",
26
26
  "devDependencies": {
27
- "@eslint/config-inspector": "^1.3.0",
27
+ "@eslint/config-inspector": "^1.4.2",
28
28
  "@types/espree": "^10.1.0",
29
29
  "@types/node": "^24.10.1",
30
30
  "espree": "^11.0.0",
@@ -33,10 +33,10 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "eslint": "^9.39.1",
36
- "eslint-config-vylda-vanilla": "^4.4.2",
36
+ "eslint-config-vylda-vanilla": "^4.6.0",
37
37
  "eslint-import-resolver-typescript": "^4.4.4",
38
38
  "tslib": "^2.8.1",
39
- "typescript-eslint": "^8.46.4"
39
+ "typescript-eslint": "^8.48.1"
40
40
  },
41
41
  "engines": {
42
42
  "node": ">=20"
package/rules/off.mjs CHANGED
@@ -45,6 +45,7 @@ const config = [
45
45
  'no-unreachable': 'off',
46
46
  'no-unsafe-negation': 'off',
47
47
  'no-unused-expressions': 'off',
48
+ 'no-unused-private-class-members': 'off',
48
49
  'no-unused-vars': 'off',
49
50
  'no-use-before-define': 'off',
50
51
  'no-useless-constructor': 'off',
@@ -82,6 +82,10 @@ const config = [
82
82
  // https://typescript-eslint.io/rules/no-unsafe-unary-minus/
83
83
  '@typescript-eslint/no-unsafe-unary-minus': 'error',
84
84
 
85
+ // Disallow unused private class members.
86
+ // https://typescript-eslint.io/rules/no-unused-private-class-members/
87
+ '@typescript-eslint/no-unused-private-class-members': 'error',
88
+
85
89
  // Disallows throwing literals as exceptions.
86
90
  // https://typescript-eslint.io/rules/only-throw-error/
87
91
  '@typescript-eslint/only-throw-error': [
@@ -3,6 +3,27 @@ import { constants, plus, stylistic } from 'eslint-config-vylda-vanilla';
3
3
 
4
4
  const { OBJECT_CURLY_MIN_PROPS } = constants;
5
5
 
6
+ /**
7
+ * Checks if the given item is an object and optionally validates required keys.
8
+ * @param {unknown} optionsItem - The item to check if it's an object
9
+ * @param {Array<string>} [requiredKeys] - Optional array of required keys to validate in the object
10
+ * @returns {boolean} True if the item is an object and contains all required keys (if specified)
11
+ */
12
+ const isObjectOptions = (
13
+ optionsItem,
14
+ requiredKeys,
15
+ ) => {
16
+ if (!optionsItem || typeof optionsItem !== 'object') {
17
+ return false;
18
+ }
19
+
20
+ if (!Array.isArray(requiredKeys)) {
21
+ return true;
22
+ }
23
+
24
+ return requiredKeys.every((key) => key in optionsItem);
25
+ };
26
+
6
27
  /**
7
28
  *
8
29
  * @returns {import('eslint').Linter.RuleEntry | undefined}
@@ -30,18 +51,20 @@ const createComaRule = () => {
30
51
  options,
31
52
  ] = rule;
32
53
 
33
- if (typeof options === 'string') {
54
+ if (typeof options === 'string' || !isObjectOptions(options, ['arrays'])) {
34
55
  return rule;
35
56
  }
36
57
 
58
+ const opts = /** @type {Record<string, unknown>} */ (options);
59
+
37
60
  /** @type {import('eslint').Linter.RuleEntry} */
38
61
  const enhancedRule = [
39
62
  severity,
40
63
  {
41
- ...options,
42
- enums: options.arrays,
43
- generics: options.arrays,
44
- tuples: options.arrays,
64
+ ...opts,
65
+ enums: opts.arrays,
66
+ generics: opts.arrays,
67
+ tuples: opts.arrays,
45
68
  },
46
69
  ];
47
70
 
@@ -75,15 +98,17 @@ const createCurlyNewLineRule = () => {
75
98
  options,
76
99
  ] = rule;
77
100
 
78
- if (typeof options === 'string') {
101
+ if (typeof options === 'string' || !isObjectOptions(options)) {
79
102
  return rule;
80
103
  }
81
104
 
105
+ const opts = /** @type {Record<string, unknown>} */ (options);
106
+
82
107
  /** @type {import('eslint').Linter.RuleEntry} */
83
108
  const enhancedRule = [
84
109
  severity,
85
110
  {
86
- ...options,
111
+ ...opts,
87
112
  TSModuleBlock: 'always',
88
113
  },
89
114
  ];
@@ -112,11 +137,17 @@ const createIndentRule = () => {
112
137
  if (typeof rule === 'object') {
113
138
  const [severity, indent, options] = rule;
114
139
 
140
+ if (!isObjectOptions(options)) {
141
+ return rule;
142
+ }
143
+
144
+ const opts = /** @type {Record<string, unknown>} */ (options);
145
+
115
146
  return [
116
147
  severity,
117
148
  indent,
118
149
  {
119
- ...options,
150
+ ...opts,
120
151
  FunctionDeclaration: {
121
152
  body: 1,
122
153
  parameters: 1,
@@ -161,15 +192,17 @@ const createLinesAroundCommentRule = () => {
161
192
  options,
162
193
  ] = rule;
163
194
 
164
- if (typeof options === 'string') {
195
+ if (typeof options === 'string' || !isObjectOptions(options)) {
165
196
  return rule;
166
197
  }
167
198
 
199
+ const opts = /** @type {Record<string, unknown>} */ (options);
200
+
168
201
  /** @type {import('eslint').Linter.RuleEntry} */
169
202
  const enhancedRule = [
170
203
  severity,
171
204
  {
172
- ...options,
205
+ ...opts,
173
206
  allowEnumEnd: false,
174
207
  allowEnumStart: false,
175
208
  allowInterfaceEnd: false,
@@ -211,15 +244,17 @@ const createLinesBetweenClassMembersRule = () => {
211
244
  options,
212
245
  ] = rule;
213
246
 
214
- if (typeof options === 'string') {
247
+ if (typeof options === 'string' || !isObjectOptions(options)) {
215
248
  return rule;
216
249
  }
217
250
 
251
+ const opts = /** @type {Record<string, unknown>} */ (options);
252
+
218
253
  /** @type {import('eslint').Linter.RuleEntry} */
219
254
  const enhancedRule = [
220
255
  severity,
221
256
  {
222
- ...options,
257
+ ...opts,
223
258
  exceptAfterOverload: true,
224
259
  },
225
260
  ];
@@ -254,15 +289,17 @@ const createObjectCurlyNewLineRule = () => {
254
289
  options,
255
290
  ] = rule;
256
291
 
257
- if (typeof options === 'string') {
292
+ if (typeof options === 'string' || !isObjectOptions(options)) {
258
293
  return rule;
259
294
  }
260
295
 
296
+ const opts = /** @type {Record<string, unknown>} */ (options);
297
+
261
298
  /** @type {import('eslint').Linter.RuleEntry} */
262
299
  const enhancedRule = [
263
300
  severity,
264
301
  {
265
- ...options,
302
+ ...opts,
266
303
  TSEnumBody: {
267
304
  consistent: true,
268
305
  minProperties: OBJECT_CURLY_MIN_PROPS,
@@ -416,10 +453,6 @@ const rules = {
416
453
  after: true,
417
454
  before: false,
418
455
  overrides: {
419
- arrow: {
420
- after: true,
421
- before: true,
422
- },
423
456
  colon: {
424
457
  after: true,
425
458
  before: false,