exadev-eslint-config 2.10.6 → 2.12.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 +1 -1
- package/dist/index.cjs +49 -2
- package/dist/index.js +47 -2
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ Consumers need `eslint >=10.0.0` and `typescript-eslint >=8.0.0` as required pee
|
|
|
16
16
|
pnpm add -D @exadev/eslint-config typescript-eslint eslint
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
The default export is the full, type-checked ruleset: typescript-eslint's `strictTypeChecked` + `stylisticTypeChecked` presets (`strictTypeChecked` subsumes `recommendedTypeChecked`, so it already includes `no-deprecated`, `no-misused-spread`, `no-mixed-enums`, `no-unnecessary-condition`, `use-unknown-in-catch-callback-variable`, `return-await`, `related-getter-setter-pairs`, `no-unnecessary-type-parameters`, and more -- those are no longer re-listed below), `exadev/barrel-policy` at `mode: 'banned'` (see [Barrel policy](#barrel-policy)), `exadev/no-object-assign`, `exadev/no-mutable-union-array-param`, `exadev/no-array-isarray-mutation`, `exadev/no-enum-number-widening`, `exadev/no-enum-reverse-lookup-widening`, `exadev/no-map-instanceof-mutation`, `exadev/no-set-instanceof-mutation`, `exadev/prefer-readonly-array-param`, `exadev/prefer-readonly-object-param`, `exadev/prefer-numeric-sort-compare`, `exadev/no-pointless-reassignment`, `linterOptions.noInlineConfig`, `@typescript-eslint/consistent-type-assertions` banning all type assertions, `@typescript-eslint/consistent-type-imports`, `@typescript-eslint/consistent-type-exports`, `@typescript-eslint/consistent-return` (a function that implicitly returns `undefined` on one path and a real value on another -- a common real bug, not a deliberate design), `@typescript-eslint/no-non-null-assertion` banning the `!` operator (the same manual-override escape hatch as a type assertion, under a different spelling), `@typescript-eslint/no-redeclare`, `@typescript-eslint/no-shadow`, `@typescript-eslint/no-use-before-define` set to `{ functions: false }` (a genuine temporal-dead-zone crash risk for `let`/`const`/`class`/enum bindings, but exempting function declarations, which are fully hoisted and therefore runtime-safe to call before their point of textual declaration -- this codebase's own rule files consistently define their helper functions after the logic that calls them), `@typescript-eslint/ban-ts-comment` banning `@ts-expect-error` outright, `@typescript-eslint/method-signature-style` set to `'property'` (method-shorthand signatures are checked bivariantly under `strictFunctionTypes`, which is unsound), `@typescript-eslint/prefer-readonly`, `@typescript-eslint/promise-function-async`, `@typescript-eslint/require-array-sort-compare`, `@typescript-eslint/strict-void-return` (not yet in any typescript-eslint preset -- disallows passing a value-returning function where a void-returning one is expected, e.g. `arr.forEach(x => otherArray.push(x))`, which typechecks today under TS's own void-return contravariance leniency), `@typescript-eslint/switch-exhaustiveness-check`, `@typescript-eslint/strict-boolean-expressions` at the rule's own bare defaults (an unambiguous non-nullable truthy check stays allowed; an ambiguous nullable check does not),
|
|
19
|
+
The default export is the full, type-checked ruleset: typescript-eslint's `strictTypeChecked` + `stylisticTypeChecked` presets (`strictTypeChecked` subsumes `recommendedTypeChecked`, so it already includes `no-deprecated`, `no-misused-spread`, `no-mixed-enums`, `no-unnecessary-condition`, `use-unknown-in-catch-callback-variable`, `return-await`, `related-getter-setter-pairs`, `no-unnecessary-type-parameters`, and more -- those are no longer re-listed below), `exadev/barrel-policy` at `mode: 'banned'` (see [Barrel policy](#barrel-policy)), `exadev/no-object-assign`, `exadev/no-mutable-union-array-param`, `exadev/no-array-isarray-mutation`, `exadev/no-enum-number-widening`, `exadev/no-enum-reverse-lookup-widening`, `exadev/no-map-instanceof-mutation`, `exadev/no-set-instanceof-mutation`, `exadev/prefer-readonly-array-param`, `exadev/prefer-readonly-object-param`, `exadev/prefer-numeric-sort-compare`, `exadev/no-pointless-reassignment`, `linterOptions.noInlineConfig`, `@typescript-eslint/consistent-type-assertions` banning all type assertions, `@typescript-eslint/consistent-type-imports`, `@typescript-eslint/consistent-type-exports`, `@typescript-eslint/consistent-return` (a function that implicitly returns `undefined` on one path and a real value on another -- a common real bug, not a deliberate design), `@typescript-eslint/no-non-null-assertion` banning the `!` operator (the same manual-override escape hatch as a type assertion, under a different spelling), `@typescript-eslint/no-redeclare`, `@typescript-eslint/no-shadow`, `@typescript-eslint/no-use-before-define` set to `{ functions: false }` (a genuine temporal-dead-zone crash risk for `let`/`const`/`class`/enum bindings, but exempting function declarations, which are fully hoisted and therefore runtime-safe to call before their point of textual declaration -- this codebase's own rule files consistently define their helper functions after the logic that calls them), `@typescript-eslint/ban-ts-comment` banning `@ts-expect-error` outright, `@typescript-eslint/method-signature-style` set to `'property'` (method-shorthand signatures are checked bivariantly under `strictFunctionTypes`, which is unsound), `@typescript-eslint/prefer-readonly`, `@typescript-eslint/promise-function-async`, `@typescript-eslint/require-array-sort-compare`, `@typescript-eslint/strict-void-return` (not yet in any typescript-eslint preset -- disallows passing a value-returning function where a void-returning one is expected, e.g. `arr.forEach(x => otherArray.push(x))`, which typechecks today under TS's own void-return contravariance leniency), `@typescript-eslint/switch-exhaustiveness-check`, `@typescript-eslint/strict-boolean-expressions` at the rule's own bare defaults (an unambiguous non-nullable truthy check stays allowed; an ambiguous nullable check does not), `@typescript-eslint/no-magic-numbers` tuned to exempt array indexes, enum members, readonly class properties, default parameter values, and the handful of universally-idiomatic bare numbers (`-1`, `0`, `1`, `2`), `max-lines` set to `{ max: 800, skipBlankLines: true, skipComments: true }` (counting only real code, so a file isn't pushed over the limit by whitespace or its own WHY-explanation comments), and `no-warning-comments` banning any comment containing `Stryker disable` (Stryker's own mutation-testing suppression directive, invisible to ESLint's `noInlineConfig` above since it isn't an eslint-disable comment at all) -- the type-assertion and ts-comment rules are relaxed in test files, and `no-magic-numbers`/`max-lines`/`no-warning-comments` are not (see below). Spread it directly into `tseslint.config(...)`:
|
|
20
20
|
|
|
21
21
|
```ts
|
|
22
22
|
// eslint.config.ts
|
package/dist/index.cjs
CHANGED
|
@@ -24,6 +24,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
enumerable: true
|
|
25
25
|
}) : target, mod));
|
|
26
26
|
//#endregion
|
|
27
|
+
let eslint_plugin_jsdoc = require("eslint-plugin-jsdoc");
|
|
28
|
+
eslint_plugin_jsdoc = __toESM(eslint_plugin_jsdoc, 1);
|
|
29
|
+
let eslint_plugin_tsdoc = require("eslint-plugin-tsdoc");
|
|
30
|
+
eslint_plugin_tsdoc = __toESM(eslint_plugin_tsdoc, 1);
|
|
27
31
|
let node_module = require("node:module");
|
|
28
32
|
let _eslint_js = require("@eslint/js");
|
|
29
33
|
_eslint_js = __toESM(_eslint_js, 1);
|
|
@@ -34,6 +38,39 @@ let _typescript_eslint_utils = require("@typescript-eslint/utils");
|
|
|
34
38
|
let typescript = require("typescript");
|
|
35
39
|
typescript = __toESM(typescript, 1);
|
|
36
40
|
let ts_api_utils = require("ts-api-utils");
|
|
41
|
+
//#region src/jsdoc.ts
|
|
42
|
+
const jsdocConfig = eslint_plugin_jsdoc.default.configs["flat/recommended-tsdoc-error"];
|
|
43
|
+
const REQUIREMENTS_TIER_RULES = [
|
|
44
|
+
"jsdoc/require-example",
|
|
45
|
+
"jsdoc/require-jsdoc",
|
|
46
|
+
"jsdoc/require-next-type",
|
|
47
|
+
"jsdoc/require-param",
|
|
48
|
+
"jsdoc/require-param-description",
|
|
49
|
+
"jsdoc/require-param-name",
|
|
50
|
+
"jsdoc/require-param-type",
|
|
51
|
+
"jsdoc/require-property",
|
|
52
|
+
"jsdoc/require-property-description",
|
|
53
|
+
"jsdoc/require-property-name",
|
|
54
|
+
"jsdoc/require-property-type",
|
|
55
|
+
"jsdoc/require-returns",
|
|
56
|
+
"jsdoc/require-returns-description",
|
|
57
|
+
"jsdoc/require-returns-type",
|
|
58
|
+
"jsdoc/require-template",
|
|
59
|
+
"jsdoc/require-throws-type",
|
|
60
|
+
"jsdoc/require-yields",
|
|
61
|
+
"jsdoc/require-yields-type"
|
|
62
|
+
];
|
|
63
|
+
const jsdocAndTsdoc = [{
|
|
64
|
+
...jsdocConfig,
|
|
65
|
+
rules: {
|
|
66
|
+
...jsdocConfig.rules,
|
|
67
|
+
...Object.fromEntries(REQUIREMENTS_TIER_RULES.map((rule) => [rule, "off"]))
|
|
68
|
+
}
|
|
69
|
+
}, {
|
|
70
|
+
plugins: { tsdoc: eslint_plugin_tsdoc.default },
|
|
71
|
+
rules: { "tsdoc/syntax": "error" }
|
|
72
|
+
}];
|
|
73
|
+
//#endregion
|
|
37
74
|
//#region src/optional-plugin.ts
|
|
38
75
|
const nodeRequire = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
39
76
|
function tryRequire(specifier, requireFn = nodeRequire) {
|
|
@@ -119,7 +156,7 @@ function buildReactConfig(options = {}) {
|
|
|
119
156
|
}
|
|
120
157
|
//#endregion
|
|
121
158
|
//#region package.json
|
|
122
|
-
var version = "2.
|
|
159
|
+
var version = "2.12.0";
|
|
123
160
|
//#endregion
|
|
124
161
|
//#region src/rules/barrel-helpers.ts
|
|
125
162
|
const INDEX_BASENAME$1 = /^index\.[cm]?[tj]sx?$/;
|
|
@@ -1409,7 +1446,16 @@ const recommendedTypeChecked = [
|
|
|
1409
1446
|
"@typescript-eslint/require-array-sort-compare": "error",
|
|
1410
1447
|
"@typescript-eslint/strict-boolean-expressions": "error",
|
|
1411
1448
|
"@typescript-eslint/strict-void-return": "error",
|
|
1412
|
-
"@typescript-eslint/switch-exhaustiveness-check": "error"
|
|
1449
|
+
"@typescript-eslint/switch-exhaustiveness-check": "error",
|
|
1450
|
+
"max-lines": ["error", {
|
|
1451
|
+
max: 800,
|
|
1452
|
+
skipBlankLines: true,
|
|
1453
|
+
skipComments: true
|
|
1454
|
+
}],
|
|
1455
|
+
"no-warning-comments": ["error", {
|
|
1456
|
+
terms: ["stryker disable"],
|
|
1457
|
+
location: "anywhere"
|
|
1458
|
+
}]
|
|
1413
1459
|
}
|
|
1414
1460
|
},
|
|
1415
1461
|
{
|
|
@@ -1430,6 +1476,7 @@ function toPublicConfigArray(built) {
|
|
|
1430
1476
|
function exadevConfig(options = {}, ...userConfigs) {
|
|
1431
1477
|
return toPublicConfigArray([
|
|
1432
1478
|
...recommendedTypeChecked,
|
|
1479
|
+
...jsdocAndTsdoc,
|
|
1433
1480
|
...buildReactConfig({ enabled: options.react }),
|
|
1434
1481
|
...buildNextjsConfig({ enabled: options.nextjs }),
|
|
1435
1482
|
...userConfigs
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import jsdoc from "eslint-plugin-jsdoc";
|
|
2
|
+
import tsdoc from "eslint-plugin-tsdoc";
|
|
1
3
|
import { createRequire } from "node:module";
|
|
2
4
|
import js from "@eslint/js";
|
|
3
5
|
import tseslint from "typescript-eslint";
|
|
@@ -5,6 +7,39 @@ import { posix } from "node:path";
|
|
|
5
7
|
import { AST_NODE_TYPES, ESLintUtils, TSESLint } from "@typescript-eslint/utils";
|
|
6
8
|
import * as ts from "typescript";
|
|
7
9
|
import { isPropertyReadonlyInType, isTypeReference } from "ts-api-utils";
|
|
10
|
+
//#region src/jsdoc.ts
|
|
11
|
+
const jsdocConfig = jsdoc.configs["flat/recommended-tsdoc-error"];
|
|
12
|
+
const REQUIREMENTS_TIER_RULES = [
|
|
13
|
+
"jsdoc/require-example",
|
|
14
|
+
"jsdoc/require-jsdoc",
|
|
15
|
+
"jsdoc/require-next-type",
|
|
16
|
+
"jsdoc/require-param",
|
|
17
|
+
"jsdoc/require-param-description",
|
|
18
|
+
"jsdoc/require-param-name",
|
|
19
|
+
"jsdoc/require-param-type",
|
|
20
|
+
"jsdoc/require-property",
|
|
21
|
+
"jsdoc/require-property-description",
|
|
22
|
+
"jsdoc/require-property-name",
|
|
23
|
+
"jsdoc/require-property-type",
|
|
24
|
+
"jsdoc/require-returns",
|
|
25
|
+
"jsdoc/require-returns-description",
|
|
26
|
+
"jsdoc/require-returns-type",
|
|
27
|
+
"jsdoc/require-template",
|
|
28
|
+
"jsdoc/require-throws-type",
|
|
29
|
+
"jsdoc/require-yields",
|
|
30
|
+
"jsdoc/require-yields-type"
|
|
31
|
+
];
|
|
32
|
+
const jsdocAndTsdoc = [{
|
|
33
|
+
...jsdocConfig,
|
|
34
|
+
rules: {
|
|
35
|
+
...jsdocConfig.rules,
|
|
36
|
+
...Object.fromEntries(REQUIREMENTS_TIER_RULES.map((rule) => [rule, "off"]))
|
|
37
|
+
}
|
|
38
|
+
}, {
|
|
39
|
+
plugins: { tsdoc },
|
|
40
|
+
rules: { "tsdoc/syntax": "error" }
|
|
41
|
+
}];
|
|
42
|
+
//#endregion
|
|
8
43
|
//#region src/optional-plugin.ts
|
|
9
44
|
const nodeRequire = createRequire(import.meta.url);
|
|
10
45
|
function tryRequire(specifier, requireFn = nodeRequire) {
|
|
@@ -90,7 +125,7 @@ function buildReactConfig(options = {}) {
|
|
|
90
125
|
}
|
|
91
126
|
//#endregion
|
|
92
127
|
//#region package.json
|
|
93
|
-
var version = "2.
|
|
128
|
+
var version = "2.12.0";
|
|
94
129
|
//#endregion
|
|
95
130
|
//#region src/rules/barrel-helpers.ts
|
|
96
131
|
const INDEX_BASENAME$1 = /^index\.[cm]?[tj]sx?$/;
|
|
@@ -1380,7 +1415,16 @@ const recommendedTypeChecked = [
|
|
|
1380
1415
|
"@typescript-eslint/require-array-sort-compare": "error",
|
|
1381
1416
|
"@typescript-eslint/strict-boolean-expressions": "error",
|
|
1382
1417
|
"@typescript-eslint/strict-void-return": "error",
|
|
1383
|
-
"@typescript-eslint/switch-exhaustiveness-check": "error"
|
|
1418
|
+
"@typescript-eslint/switch-exhaustiveness-check": "error",
|
|
1419
|
+
"max-lines": ["error", {
|
|
1420
|
+
max: 800,
|
|
1421
|
+
skipBlankLines: true,
|
|
1422
|
+
skipComments: true
|
|
1423
|
+
}],
|
|
1424
|
+
"no-warning-comments": ["error", {
|
|
1425
|
+
terms: ["stryker disable"],
|
|
1426
|
+
location: "anywhere"
|
|
1427
|
+
}]
|
|
1384
1428
|
}
|
|
1385
1429
|
},
|
|
1386
1430
|
{
|
|
@@ -1401,6 +1445,7 @@ function toPublicConfigArray(built) {
|
|
|
1401
1445
|
function exadevConfig(options = {}, ...userConfigs) {
|
|
1402
1446
|
return toPublicConfigArray([
|
|
1403
1447
|
...recommendedTypeChecked,
|
|
1448
|
+
...jsdocAndTsdoc,
|
|
1404
1449
|
...buildReactConfig({ enabled: options.react }),
|
|
1405
1450
|
...buildNextjsConfig({ enabled: options.nextjs }),
|
|
1406
1451
|
...userConfigs
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "exadev-eslint-config",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.12.0",
|
|
4
4
|
"description": "Shared custom ESLint rules and plugin for ExaDev projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -86,6 +86,8 @@
|
|
|
86
86
|
"dependencies": {
|
|
87
87
|
"@eslint/js": "^10.0.1",
|
|
88
88
|
"@typescript-eslint/utils": "^8.67.0",
|
|
89
|
+
"eslint-plugin-jsdoc": "^64.3.9",
|
|
90
|
+
"eslint-plugin-tsdoc": "^0.5.2",
|
|
89
91
|
"ts-api-utils": "^2.5.0"
|
|
90
92
|
},
|
|
91
93
|
"scripts": {
|