@aditosoftware/eslint-config-adito-platform 2.0.4 → 2.1.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +50 -5
  2. package/index.mjs +216 -3
  3. package/package.json +12 -5
package/CHANGELOG.md CHANGED
@@ -5,13 +5,58 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## 2.1.0
9
+
10
+ ### Added
11
+
12
+ - Added `eslint-plugin-unicorn` for more rule checks
13
+ - `jsdoc/require-jsdoc` now requires a TSDoc block above every test method call: `suite`/`suiteSetup`/`suiteTeardown`/`test`/`setup`/`teardown`
14
+ - Enabled `@stylistic` rules (`warn`): `semi`, `eol-last`,
15
+ `lines-between-class-members`, `no-multi-spaces`,
16
+ `no-multiple-empty-lines`, `lines-around-comment`, `line-comment-position`. None of those rules conflicts with prettier formatting
17
+
18
+ ### Changed
19
+
20
+ - Also validated that types and interfaces will get TSDoc comments
21
+ - Bumped peer dependencies:
22
+ - eslint to 10.12.0
23
+ - eslint-plugin-jsdoc to 65.3.0
24
+ - `jsdoc/require-jsdoc` only requires JSDoc for type properties (interface
25
+ members, named type members) outside of function parameters: one-off inline
26
+ parameter shapes (`function f(x: { a: string })`) no longer require docs,
27
+ interfaces and named types still do
28
+ - `unicorn/no-non-function-verb-prefix` only checks the `get`, `set` and `is`
29
+ prefixes (configured via the rule's `verbs` option); the default verb list
30
+ (`unset`, `delete`, `add`, `remove`, `destroy`, `create`) is no longer enforced
31
+ - Disabled `jsdoc/require-throws-type`: the required `@throws {Type}` brace
32
+ syntax is JSDoc-only — the TSDoc parser rejects it (malformed inline tag)
33
+ and it renders poorly in the IDE hover. Throws are documented as `` `Type` ``
34
+ or `{@link Type}` instead
35
+ - Disabled `unicorn/prefer-iterator-to-array`: the suggested
36
+ `Iterator#toArray()` is ES2025 (iterator helpers) and not available with the
37
+ projects' ES2022/ES2023 target/lib
38
+ - `unicorn/filename-case` now ignores directory names: only the filename itself is checked against the allowed cases
39
+ - Disabled `unicorn/no-unsafe-property-key`: false positive for the required
40
+ Immer idiom `[immerable] = true` (and for `keyof` access on such classes) —
41
+ the rule's unique-symbol detection checks `TypeFlags.UniqueESSymbol`
42
+ (16384), but TypeScript reports the type of a unique symbol expression as
43
+ `ESSymbolLiteral` (8192), so the guard never matches; TS itself already
44
+ checks the key types
45
+ - Allowed `unicorn/no-top-level-assignment-in-function` in
46
+ `**/extension.ts`: the extension entry point keeps module-level state that
47
+ is assigned during `activate()` and by the exported test setters (the rule
48
+ has no options)
49
+ - Typed linting now uses `parserOptions.projectService: true` instead of the
50
+ legacy `project: true` auto-discovery option: same behavior (each file's
51
+ `tsconfig.json` is auto-detected) but with better caching and project-
52
+ reference support
53
+
8
54
  ## 2.0.4
9
55
 
10
56
  ### Changed
11
57
 
12
58
  - ci: used npm 11 for publishing with OIDC and used only supported node versions for pipelines by @rH4rtinger in #34
13
59
 
14
-
15
60
  - Upgraded dependencies:
16
61
  - chore(deps): bump flatted from 3.4.1 to 3.4.2 by @dependabot[bot] in #20
17
62
  - chore(deps): bump picomatch from 4.0.3 to 4.0.4 by @dependabot[bot] in #21
@@ -53,10 +98,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
53
98
  ### Changed
54
99
 
55
100
  - Upgraded dependencies:
56
- - @typescript-eslint/eslint-plugin to 8.46.1
57
- - @typescript-eslint/parser to 8.46.1
58
- - @stylistic/eslint-plugin to 5.4.0
59
- - eslint-plugin-jsdoc to 60.8.3
101
+ - @typescript-eslint/eslint-plugin to 8.46.1
102
+ - @typescript-eslint/parser to 8.46.1
103
+ - @stylistic/eslint-plugin to 5.4.0
104
+ - eslint-plugin-jsdoc to 60.8.3
60
105
 
61
106
  ## 2.0.1
62
107
 
package/index.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import typescriptEslint from "@typescript-eslint/eslint-plugin";
2
2
  import tsdoc from "eslint-plugin-tsdoc";
3
+ import unicorn from "eslint-plugin-unicorn";
3
4
  import globals from "globals";
4
5
  import tsParser from "@typescript-eslint/parser";
5
6
  import path from "node:path";
@@ -25,6 +26,7 @@ export default [
25
26
  "**/build",
26
27
  "**/*.js",
27
28
  "**/*.mjs",
29
+ "**/*.json",
28
30
  ".vscode-test/**",
29
31
  ],
30
32
  },
@@ -36,13 +38,21 @@ export default [
36
38
  "plugin:chai-friendly/recommended",
37
39
  "plugin:chai-expect/recommended",
38
40
  // prettier needs to be the last line
39
- "plugin:prettier/recommended"
41
+ "plugin:prettier/recommended",
40
42
  ),
43
+ // unicorn v77+ ships flat configs: spread them directly instead of using FlatCompat
44
+ unicorn.configs.recommended,
41
45
  {
46
+ // scope the TS parser and typed linting to TS files only, so other file
47
+ // types (e.g. *.json) never hit the parser error for files that are not
48
+ // included in any `tsconfig.json` project
49
+ files: ["**/*.ts", "**/*.tsx"],
50
+
42
51
  plugins: {
43
52
  "@typescript-eslint": typescriptEslint,
44
53
  "@stylistic": stylistic,
45
54
  tsdoc,
55
+ unicorn,
46
56
  },
47
57
 
48
58
  languageOptions: {
@@ -52,11 +62,14 @@ export default [
52
62
  },
53
63
 
54
64
  parser: tsParser,
55
- ecmaVersion: 6,
65
+ ecmaVersion: "latest",
56
66
  sourceType: "module",
57
67
 
58
68
  parserOptions: {
59
- project: true,
69
+ // typed linting via the TS project service (recommended over the
70
+ // legacy `project` option): each file's `tsconfig.json` is
71
+ // auto-detected, with better caching and project-reference support
72
+ projectService: true,
60
73
  },
61
74
  },
62
75
 
@@ -73,6 +86,101 @@ export default [
73
86
 
74
87
  "prettier/prettier": "warn",
75
88
 
89
+ // conflicting with prettier formatting (prettier is the last word here)
90
+ "unicorn/empty-brace-spaces": "off",
91
+
92
+ // our documentation style keeps the asterisk prefix
93
+ "unicorn/no-asterisk-prefix-in-documentation-comments": "off",
94
+
95
+ "unicorn/consistent-boolean-name": "off",
96
+ "unicorn/explicit-length-check": "off",
97
+ // `null` is fine as long as the type checks (validate) pass
98
+ "unicorn/no-null": "off",
99
+ // only `get`/`set`/`is` prefixes must denote functions
100
+ "unicorn/no-non-function-verb-prefix": [
101
+ "error",
102
+ {
103
+ verbs: ["get", "set", "is"],
104
+ },
105
+ ],
106
+ // false positive for the required Immer idiom `[immerable] = true`
107
+ // (and for `keyof` access on such classes): the rule's unique-symbol
108
+ // detection checks TypeFlags.UniqueESSymbol (16384), but TS reports
109
+ // the type of a unique symbol expression as ESSymbolLiteral (8192),
110
+ // so the guard never matches and the generic property heuristic fires;
111
+ // TS itself already checks the key types
112
+ "unicorn/no-unsafe-property-key": "off",
113
+ "unicorn/no-useless-undefined": "off",
114
+ "unicorn/prefer-await": "off",
115
+ // `Iterator#toArray()` is ES2025 (iterator helpers) and not available with the
116
+ // projects' ES2022/ES2023 target/lib (nor in all VS Code extension hosts);
117
+ // spreading an iterator stays the portable way
118
+ "unicorn/prefer-iterator-to-array": "off",
119
+ "unicorn/prefer-module": "off",
120
+ "unicorn/prefer-ternary": "off",
121
+ "unicorn/prefer-default-parameters": "off",
122
+ "unicorn/prefer-includes-over-repeated-comparisons": "off",
123
+
124
+ // Allow one more nested call
125
+ "unicorn/max-nested-calls": [
126
+ "error",
127
+ {
128
+ max: 4,
129
+ },
130
+ ],
131
+
132
+ // we allow naming variables and files `config`/`util(s)`
133
+ "unicorn/name-replacements": [
134
+ "error",
135
+ {
136
+ replacements: {
137
+ configuration: false,
138
+ util: false,
139
+ utils: false,
140
+ db: false,
141
+ doc: false,
142
+ },
143
+ },
144
+ ],
145
+
146
+ // public methods should be written before private elements
147
+ "unicorn/consistent-class-member-order": [
148
+ "error",
149
+ {
150
+ order: [
151
+ "static-field",
152
+ "static-block",
153
+ "public-field",
154
+ "private-field",
155
+ "constructor",
156
+ "static-method",
157
+ "public-method",
158
+ "private-method",
159
+ ],
160
+ },
161
+ ],
162
+
163
+ // our file naming convention: camelCase (with acronyms) and PascalCase
164
+ "unicorn/filename-case": [
165
+ "error",
166
+ {
167
+ cases: {
168
+ kebabCase: true,
169
+ camelCase: true,
170
+ camelCaseWithAcronyms: true,
171
+ pascalCase: true,
172
+ },
173
+ // only the filename itself is checked for case; directory names
174
+ // within the file path are ignored (e.g. 01_webview, RMB)
175
+ checkDirectories: false,
176
+ // allow the fully uppercase acronym GUI in filenames
177
+ // (e.g. LiquibaseGUITestUtils.ts) — the case variants above only
178
+ // accept lowercase acronyms or a leading acronym, so matching
179
+ // files are skipped instead
180
+ ignore: [/GUI/],
181
+ },
182
+ ],
183
+
76
184
  "@typescript-eslint/no-deprecated": "error",
77
185
 
78
186
  "@typescript-eslint/no-floating-promises": "error",
@@ -94,6 +202,43 @@ export default [
94
202
  },
95
203
  ],
96
204
  "@stylistic/semi": "warn",
205
+ // Prettier always emits a trailing newline at EOF — no conflict
206
+ "@stylistic/eol-last": "warn",
207
+ // Prettier keeps but never adds the blank line between members
208
+ "@stylistic/lines-between-class-members": "warn",
209
+ // Prettier normalizes to single spaces as well
210
+ "@stylistic/no-multi-spaces": "warn",
211
+ // exactly what Prettier collapses multiple empty lines to
212
+ "@stylistic/no-multiple-empty-lines": [
213
+ "warn",
214
+ {
215
+ max: 1,
216
+ },
217
+ ],
218
+ "@stylistic/line-comment-position": [
219
+ "warn",
220
+ {
221
+ position: "above",
222
+ },
223
+ ],
224
+ // blank line before a standalone block comment; JSDoc blocks are
225
+ // attached documentation (excluded via ignorePattern) and
226
+ // block/class/module boundaries are exempt
227
+ "@stylistic/lines-around-comment": [
228
+ "warn",
229
+ {
230
+ beforeBlockComment: true,
231
+ allowBlockStart: true,
232
+ allowBlockEnd: true,
233
+ allowClassStart: false,
234
+ allowClassEnd: false,
235
+ allowModuleStart: true,
236
+ allowModuleEnd: false,
237
+ // JSDoc/TSDoc blocks are attached documentation (their token
238
+ // value starts with "*") — exclude them from the check
239
+ ignorePattern: "^\\*",
240
+ },
241
+ ],
97
242
  curly: "warn",
98
243
  eqeqeq: "warn",
99
244
  "no-throw-literal": "warn",
@@ -132,6 +277,15 @@ export default [
132
277
 
133
278
  "jsdoc/check-indentation": "warn",
134
279
  "jsdoc/check-line-alignment": "warn",
280
+ // each line of a multiline JSDoc block must start with an asterisk
281
+ // (fixes the un-asterisked output of unicorn/single-line-block-comment-style)
282
+ "jsdoc/require-asterisk-prefix": "warn",
283
+
284
+ // we document with TSDoc: a `@throws {Type}` brace type is JSDoc syntax
285
+ // that tsdoc/syntax rejects (malformed inline tag) and that renders
286
+ // poorly in the IDE hover. Throws are documented as `Type` (code span)
287
+ // or {@link Type} instead — the type requirement is therefore off
288
+ "jsdoc/require-throws-type": "off",
135
289
 
136
290
  "jsdoc/require-jsdoc": [
137
291
  "warn",
@@ -144,8 +298,67 @@ export default [
144
298
  ArrowFunctionExpression: false,
145
299
  FunctionExpression: false,
146
300
  },
301
+ // the rule's fixer inserts *empty* JSDoc blocks, which is not the
302
+ // goal (documentation should be written by hand); keep reporting,
303
+ // but never auto-fix
304
+ enableFixer: false,
305
+ contexts: [
306
+ "TSInterfaceDeclaration",
307
+ "TSMethodSignature",
308
+ // only outside function parameters: one-off inline parameter shapes
309
+ // stay out of scope, interfaces and named types still require docs.
310
+ // .params/.parameters are field selectors that match the parameter
311
+ // nodes themselves (elements of a function's params/parameters
312
+ // array) — @typescript-eslint 8.x has no TSParameter node type
313
+ // (parameters are plain Identifiers with a typeAnnotation)
314
+ "TSPropertySignature:not(.params TSPropertySignature, .parameters TSPropertySignature)",
315
+ "TSEnumMember",
316
+ // class attributes / fields
317
+ // (PropertyDefinition: current ESTree-aligned name, TSPropertyDefinition:
318
+ // older @typescript-eslint versions; the unused one simply never fires)
319
+ "PropertyDefinition",
320
+ "TSPropertyDefinition",
321
+ "TSAbstractPropertyDefinition",
322
+ // WebdriverIO/Mocha test elements: a TSDoc block is expected
323
+ // above every suite/test/setup/teardown call (only bare global
324
+ // calls match — member expressions like regex.test(…) are safe)
325
+ "CallExpression[callee.name='suite']",
326
+ "CallExpression[callee.name='suiteSetup']",
327
+ "CallExpression[callee.name='suiteTeardown']",
328
+ "CallExpression[callee.name='test']",
329
+ "CallExpression[callee.name='setup']",
330
+ "CallExpression[callee.name='teardown']",
331
+ ],
147
332
  },
148
333
  ],
149
334
  },
150
335
  },
336
+ {
337
+ // Config files (vite.config.ts, webpack.config.ts, …) and everything under a
338
+ // test/ directory (incl. test utilities like chai setup files) are entry
339
+ // points run by the tooling, not libraries imported by production code.
340
+ // Top-level side effects (defineConfig({…}), chai.use(…), before(…)) and
341
+ // Mocha's test-context `this` (this.timeout(), this.test) are expected
342
+ // there; unicorn has no options to exempt those contexts.
343
+ files: [
344
+ "**/*.config.*",
345
+ "**/test/**",
346
+ "**/e2e/**",
347
+ "**/*.test.ts",
348
+ "**/*.spec.ts",
349
+ ],
350
+ rules: {
351
+ "unicorn/no-top-level-side-effects": "off",
352
+ "unicorn/no-this-outside-of-class": "off",
353
+ },
354
+ },
355
+ {
356
+ // The extension entry point keeps module-level state that is assigned
357
+ // during activate() and re-assigned by the exported test setters; the
358
+ // rule has no options to exempt this intended pattern
359
+ files: ["**/extension.ts"],
360
+ rules: {
361
+ "unicorn/no-top-level-assignment-in-function": "off",
362
+ },
363
+ },
151
364
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aditosoftware/eslint-config-adito-platform",
3
- "version": "2.0.4",
3
+ "version": "2.1.0",
4
4
  "description": "eslint configuration for the platform team of ADITO",
5
5
  "main": "index.mjs",
6
6
  "license": "MIT",
@@ -8,17 +8,24 @@
8
8
  "type": "git",
9
9
  "url": "https://github.com/aditosoftware/eslint-config-adito-platform.git"
10
10
  },
11
+ "scripts": {
12
+ "validate": "node test/validate.mjs"
13
+ },
11
14
  "peerDependencies": {
15
+ "@eslint/eslintrc": "^3.3.7",
16
+ "@eslint/js": "^10.0.1",
17
+ "@stylistic/eslint-plugin": "^5.10.0",
12
18
  "@typescript-eslint/eslint-plugin": "^8.57.0",
13
19
  "@typescript-eslint/parser": "^8.57.0",
14
- "@stylistic/eslint-plugin": "^5.10.0",
15
- "eslint": "^9.37.0",
20
+ "eslint": "^10.12.0",
16
21
  "eslint-config-prettier": "^10.1.8",
17
22
  "eslint-plugin-chai-expect": "^4.0.0",
18
23
  "eslint-plugin-chai-friendly": "^1.1.0",
19
- "eslint-plugin-jsdoc": "^62.8.0",
24
+ "eslint-plugin-jsdoc": "^65.3.0",
20
25
  "eslint-plugin-prettier": "^5.5.5",
21
26
  "eslint-plugin-tsdoc": "^0.5.2",
27
+ "eslint-plugin-unicorn": "^77.0.0",
28
+ "globals": "^17.13.0",
22
29
  "prettier": "3.6.2"
23
30
  }
24
- }
31
+ }