@abinnovision/eslint-config-base 3.4.1 → 3.4.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.
@@ -1,4 +1,3 @@
1
- require("../_virtual/_rolldown/runtime.cjs");
2
1
  //#region src/configs/flavour-nestjs.ts
3
2
  /**
4
3
  * ESLint configuration tailored for NestJS projects.
@@ -10,9 +9,33 @@ require("../_virtual/_rolldown/runtime.cjs");
10
9
  const config = (0, require("eslint/config").defineConfig)([{
11
10
  files: ["**/*.{ts,js}"],
12
11
  rules: {
12
+ /**
13
+ * Enforce a maximum number of parameters in function definitions.
14
+ * Increased to 8 for NestJS dependency injection patterns.
15
+ *
16
+ * @see https://eslint.org/docs/latest/rules/max-params
17
+ */
13
18
  "max-params": ["error", 8],
19
+ /**
20
+ * Disallow useless constructors.
21
+ * Disabled for NestJS as DI decorators make constructors appear "useless".
22
+ *
23
+ * @see https://typescript-eslint.io/rules/no-useless-constructor
24
+ */
14
25
  "@typescript-eslint/no-useless-constructor": "off",
26
+ /**
27
+ * Disallow empty functions.
28
+ * Allow empty constructors for NestJS DI parameter properties.
29
+ *
30
+ * @see https://typescript-eslint.io/rules/no-empty-function
31
+ */
15
32
  "@typescript-eslint/no-empty-function": ["error", { allow: ["constructors"] }],
33
+ /**
34
+ * Require or disallow parameter properties in class constructors.
35
+ * Enforces NestJS DI pattern using parameter properties.
36
+ *
37
+ * @see https://typescript-eslint.io/rules/parameter-properties
38
+ */
16
39
  "@typescript-eslint/parameter-properties": ["error", {
17
40
  allow: [
18
41
  "private readonly",
@@ -1,5 +1,3 @@
1
- import * as eslint_config0 from "eslint/config";
2
-
3
1
  //#region src/configs/flavour-nestjs.d.ts
4
2
  /**
5
3
  * ESLint configuration tailored for NestJS projects.
@@ -8,6 +6,6 @@ import * as eslint_config0 from "eslint/config";
8
6
  * NOTE: This configuration is meant to be used in conjunction with
9
7
  * the base TypeScript ESLint configuration.
10
8
  */
11
- declare const config: eslint_config0.Config[];
9
+ declare const config: import("eslint/config").Config[];
12
10
  //#endregion
13
11
  export { config };
@@ -1,5 +1,3 @@
1
- import * as eslint_config0 from "eslint/config";
2
-
3
1
  //#region src/configs/flavour-nestjs.d.ts
4
2
  /**
5
3
  * ESLint configuration tailored for NestJS projects.
@@ -8,6 +6,6 @@ import * as eslint_config0 from "eslint/config";
8
6
  * NOTE: This configuration is meant to be used in conjunction with
9
7
  * the base TypeScript ESLint configuration.
10
8
  */
11
- declare const config: eslint_config0.Config[];
9
+ declare const config: import("eslint/config").Config[];
12
10
  //#endregion
13
11
  export { config };
@@ -10,9 +10,33 @@ import { defineConfig } from "eslint/config";
10
10
  const config = defineConfig([{
11
11
  files: ["**/*.{ts,js}"],
12
12
  rules: {
13
+ /**
14
+ * Enforce a maximum number of parameters in function definitions.
15
+ * Increased to 8 for NestJS dependency injection patterns.
16
+ *
17
+ * @see https://eslint.org/docs/latest/rules/max-params
18
+ */
13
19
  "max-params": ["error", 8],
20
+ /**
21
+ * Disallow useless constructors.
22
+ * Disabled for NestJS as DI decorators make constructors appear "useless".
23
+ *
24
+ * @see https://typescript-eslint.io/rules/no-useless-constructor
25
+ */
14
26
  "@typescript-eslint/no-useless-constructor": "off",
27
+ /**
28
+ * Disallow empty functions.
29
+ * Allow empty constructors for NestJS DI parameter properties.
30
+ *
31
+ * @see https://typescript-eslint.io/rules/no-empty-function
32
+ */
15
33
  "@typescript-eslint/no-empty-function": ["error", { allow: ["constructors"] }],
34
+ /**
35
+ * Require or disallow parameter properties in class constructors.
36
+ * Enforces NestJS DI pattern using parameter properties.
37
+ *
38
+ * @see https://typescript-eslint.io/rules/parameter-properties
39
+ */
16
40
  "@typescript-eslint/parameter-properties": ["error", {
17
41
  allow: [
18
42
  "private readonly",
@@ -1,7 +1,7 @@
1
1
  const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
2
2
  let eslint_config = require("eslint/config");
3
3
  let _stylistic_eslint_plugin = require("@stylistic/eslint-plugin");
4
- _stylistic_eslint_plugin = require_runtime.__toESM(_stylistic_eslint_plugin);
4
+ _stylistic_eslint_plugin = require_runtime.__toESM(_stylistic_eslint_plugin, 1);
5
5
  //#region src/configs/flavour-stylistic.ts
6
6
  /**
7
7
  * ESLint configuration for optional stylistic rules.
@@ -15,9 +15,33 @@ const config = (0, eslint_config.defineConfig)([{
15
15
  files: ["**/*.{ts,tsx,js,jsx}"],
16
16
  plugins: { "@stylistic": _stylistic_eslint_plugin.default },
17
17
  rules: {
18
+ /**
19
+ * Enforce block comments to use starred-block style (multiline).
20
+ * Prevents inline block comments like: /** foo *​/
21
+ *
22
+ * @see https://eslint.style/rules/default/multiline-comment-style
23
+ */
18
24
  "@stylistic/multiline-comment-style": ["error", "starred-block"],
25
+ /**
26
+ * Enforce consistent spacing after // or /* delimiters.
27
+ *
28
+ * @see https://eslint.style/rules/default/spaced-comment
29
+ */
19
30
  "@stylistic/spaced-comment": ["error", "always"],
31
+ /**
32
+ * Enforce line comments to be placed above the code line.
33
+ *
34
+ * @see https://eslint.style/rules/default/line-comment-position
35
+ */
20
36
  "@stylistic/line-comment-position": ["error", "above"],
37
+ /**
38
+ * Require blank lines between specific statement types.
39
+ * - After block-like statements (if, for, while, try, switch).
40
+ * - Before return statements.
41
+ * - After directives ("use strict", etc.).
42
+ *
43
+ * @see https://eslint.style/rules/default/padding-line-between-statements
44
+ */
21
45
  "@stylistic/padding-line-between-statements": [
22
46
  "error",
23
47
  {
@@ -36,7 +60,20 @@ const config = (0, eslint_config.defineConfig)([{
36
60
  next: "*"
37
61
  }
38
62
  ],
63
+ /**
64
+ * Disallow padding inside blocks.
65
+ * No empty lines right after { or before }.
66
+ *
67
+ * @see https://eslint.style/rules/default/padded-blocks
68
+ */
39
69
  "@stylistic/padded-blocks": ["error", "never"],
70
+ /**
71
+ * Require blank lines between class members.
72
+ * Except after single-line members and TypeScript overloads
73
+ * to keep compact field declarations readable.
74
+ *
75
+ * @see https://eslint.style/rules/default/lines-between-class-members
76
+ */
40
77
  "@stylistic/lines-between-class-members": [
41
78
  "error",
42
79
  "always",
@@ -45,6 +82,13 @@ const config = (0, eslint_config.defineConfig)([{
45
82
  exceptAfterOverload: true
46
83
  }
47
84
  ],
85
+ /**
86
+ * Limit consecutive empty lines.
87
+ * Prettier already collapses multiple blank lines within code,
88
+ * but this additionally prevents blank lines at the start of files.
89
+ *
90
+ * @see https://eslint.style/rules/default/no-multiple-empty-lines
91
+ */
48
92
  "@stylistic/no-multiple-empty-lines": ["error", {
49
93
  max: 1,
50
94
  maxBOF: 0,
@@ -1,5 +1,3 @@
1
- import * as eslint_config0 from "eslint/config";
2
-
3
1
  //#region src/configs/flavour-stylistic.d.ts
4
2
  /**
5
3
  * ESLint configuration for optional stylistic rules.
@@ -9,6 +7,6 @@ import * as eslint_config0 from "eslint/config";
9
7
  * NOTE: This configuration is meant to be used in conjunction with
10
8
  * the base TypeScript ESLint configuration.
11
9
  */
12
- declare const config: eslint_config0.Config[];
10
+ declare const config: import("eslint/config").Config[];
13
11
  //#endregion
14
12
  export { config };
@@ -1,5 +1,3 @@
1
- import * as eslint_config0 from "eslint/config";
2
-
3
1
  //#region src/configs/flavour-stylistic.d.ts
4
2
  /**
5
3
  * ESLint configuration for optional stylistic rules.
@@ -9,6 +7,6 @@ import * as eslint_config0 from "eslint/config";
9
7
  * NOTE: This configuration is meant to be used in conjunction with
10
8
  * the base TypeScript ESLint configuration.
11
9
  */
12
- declare const config: eslint_config0.Config[];
10
+ declare const config: import("eslint/config").Config[];
13
11
  //#endregion
14
12
  export { config };
@@ -13,9 +13,33 @@ const config = defineConfig([{
13
13
  files: ["**/*.{ts,tsx,js,jsx}"],
14
14
  plugins: { "@stylistic": stylistic },
15
15
  rules: {
16
+ /**
17
+ * Enforce block comments to use starred-block style (multiline).
18
+ * Prevents inline block comments like: /** foo *​/
19
+ *
20
+ * @see https://eslint.style/rules/default/multiline-comment-style
21
+ */
16
22
  "@stylistic/multiline-comment-style": ["error", "starred-block"],
23
+ /**
24
+ * Enforce consistent spacing after // or /* delimiters.
25
+ *
26
+ * @see https://eslint.style/rules/default/spaced-comment
27
+ */
17
28
  "@stylistic/spaced-comment": ["error", "always"],
29
+ /**
30
+ * Enforce line comments to be placed above the code line.
31
+ *
32
+ * @see https://eslint.style/rules/default/line-comment-position
33
+ */
18
34
  "@stylistic/line-comment-position": ["error", "above"],
35
+ /**
36
+ * Require blank lines between specific statement types.
37
+ * - After block-like statements (if, for, while, try, switch).
38
+ * - Before return statements.
39
+ * - After directives ("use strict", etc.).
40
+ *
41
+ * @see https://eslint.style/rules/default/padding-line-between-statements
42
+ */
19
43
  "@stylistic/padding-line-between-statements": [
20
44
  "error",
21
45
  {
@@ -34,7 +58,20 @@ const config = defineConfig([{
34
58
  next: "*"
35
59
  }
36
60
  ],
61
+ /**
62
+ * Disallow padding inside blocks.
63
+ * No empty lines right after { or before }.
64
+ *
65
+ * @see https://eslint.style/rules/default/padded-blocks
66
+ */
37
67
  "@stylistic/padded-blocks": ["error", "never"],
68
+ /**
69
+ * Require blank lines between class members.
70
+ * Except after single-line members and TypeScript overloads
71
+ * to keep compact field declarations readable.
72
+ *
73
+ * @see https://eslint.style/rules/default/lines-between-class-members
74
+ */
38
75
  "@stylistic/lines-between-class-members": [
39
76
  "error",
40
77
  "always",
@@ -43,6 +80,13 @@ const config = defineConfig([{
43
80
  exceptAfterOverload: true
44
81
  }
45
82
  ],
83
+ /**
84
+ * Limit consecutive empty lines.
85
+ * Prettier already collapses multiple blank lines within code,
86
+ * but this additionally prevents blank lines at the start of files.
87
+ *
88
+ * @see https://eslint.style/rules/default/no-multiple-empty-lines
89
+ */
46
90
  "@stylistic/no-multiple-empty-lines": ["error", {
47
91
  max: 1,
48
92
  maxBOF: 0,
@@ -1,7 +1,7 @@
1
1
  const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
2
2
  let eslint_config = require("eslint/config");
3
3
  let _vitest_eslint_plugin = require("@vitest/eslint-plugin");
4
- _vitest_eslint_plugin = require_runtime.__toESM(_vitest_eslint_plugin);
4
+ _vitest_eslint_plugin = require_runtime.__toESM(_vitest_eslint_plugin, 1);
5
5
  //#region src/configs/flavour-vitest.ts
6
6
  /**
7
7
  * ESLint configuration tailored for Vitest test files.
@@ -23,34 +23,203 @@ const config = (0, eslint_config.defineConfig)([{
23
23
  languageOptions: { globals: { ..._vitest_eslint_plugin.default.environments.env.globals } },
24
24
  settings: { vitest: { typecheck: true } },
25
25
  rules: {
26
+ /**
27
+ * Enable Vitest recommended rules.
28
+ */
26
29
  ..._vitest_eslint_plugin.default.configs.recommended.rules,
30
+ /**
31
+ * Enforce a maximum number of parameters in function definitions.
32
+ * Increased to 5 for test setup functions that receive fixtures and mocks.
33
+ *
34
+ * @see https://eslint.org/docs/latest/rules/max-params
35
+ */
27
36
  "max-params": ["error", 5],
37
+ /**
38
+ * Enforce a maximum depth that callbacks can be nested.
39
+ * Increased to 5 for describe/it/beforeEach nesting patterns.
40
+ *
41
+ * @see https://eslint.org/docs/latest/rules/max-nested-callbacks
42
+ */
28
43
  "max-nested-callbacks": ["error", 5],
44
+ /**
45
+ * Enforce a maximum cyclomatic complexity allowed in a program.
46
+ * Increased to 30 and downgraded to warn for complex test scenarios.
47
+ *
48
+ * @see https://eslint.org/docs/latest/rules/complexity
49
+ */
29
50
  complexity: ["warn", 30],
51
+ /**
52
+ * Enforce a maximum number of lines per function.
53
+ * Disabled for test cases with comprehensive setup and assertions.
54
+ *
55
+ * @see https://eslint.org/docs/latest/rules/max-lines-per-function
56
+ */
30
57
  "max-lines-per-function": "off",
58
+ /**
59
+ * Enforce a maximum number of statements allowed in function blocks.
60
+ * Disabled for tests with multiple setup and assertion statements.
61
+ *
62
+ * @see https://eslint.org/docs/latest/rules/max-statements
63
+ */
31
64
  "max-statements": "off",
65
+ /**
66
+ * Enforce a maximum number of lines per file.
67
+ * Disabled for comprehensive test suites.
68
+ *
69
+ * @see https://eslint.org/docs/latest/rules/max-lines
70
+ */
32
71
  "max-lines": "off",
72
+ /**
73
+ * Disallow assigning a value with type any to variables and properties.
74
+ * Disabled for mock objects and test utilities.
75
+ *
76
+ * @see https://typescript-eslint.io/rules/no-unsafe-assignment
77
+ */
33
78
  "@typescript-eslint/no-unsafe-assignment": "off",
79
+ /**
80
+ * Disallow member access on a value with type any.
81
+ * Disabled for mock objects.
82
+ *
83
+ * @see https://typescript-eslint.io/rules/no-unsafe-member-access
84
+ */
34
85
  "@typescript-eslint/no-unsafe-member-access": "off",
86
+ /**
87
+ * Disallow calling a value with type any.
88
+ * Disabled for test utilities like vi.fn().
89
+ *
90
+ * @see https://typescript-eslint.io/rules/no-unsafe-call
91
+ */
35
92
  "@typescript-eslint/no-unsafe-call": "off",
93
+ /**
94
+ * Disallow returning a value with type any from a function.
95
+ * Disabled for test helper functions.
96
+ *
97
+ * @see https://typescript-eslint.io/rules/no-unsafe-return
98
+ */
36
99
  "@typescript-eslint/no-unsafe-return": "off",
100
+ /**
101
+ * Disallow passing a value with type any to a function parameter.
102
+ * Disabled for test mock parameters.
103
+ *
104
+ * @see https://typescript-eslint.io/rules/no-unsafe-argument
105
+ */
37
106
  "@typescript-eslint/no-unsafe-argument": "off",
107
+ /**
108
+ * Require unbound methods to be called with correct this context.
109
+ * Disabled for Vitest expectations like expect(obj.method).toBeCalled().
110
+ *
111
+ * @see https://typescript-eslint.io/rules/unbound-method
112
+ */
38
113
  "@typescript-eslint/unbound-method": "off",
114
+ /**
115
+ * Disallow magic numbers.
116
+ * Disabled for test assertions with literal values.
117
+ *
118
+ * @see https://typescript-eslint.io/rules/no-magic-numbers
119
+ */
39
120
  "@typescript-eslint/no-magic-numbers": "off",
121
+ /**
122
+ * Require Promise-like statements to be handled appropriately.
123
+ * Downgraded to warn for test utilities.
124
+ *
125
+ * @see https://typescript-eslint.io/rules/no-floating-promises
126
+ */
40
127
  "@typescript-eslint/no-floating-promises": "warn",
128
+ /**
129
+ * Disallow non-null assertions using the ! postfix operator.
130
+ * Disabled for tests where values are known to exist.
131
+ *
132
+ * @see https://typescript-eslint.io/rules/no-non-null-assertion
133
+ */
41
134
  "@typescript-eslint/no-non-null-assertion": "off",
135
+ /**
136
+ * Disallow empty functions.
137
+ * Disabled for test stubs and spies.
138
+ *
139
+ * @see https://eslint.org/docs/latest/rules/no-empty-function
140
+ */
42
141
  "no-empty-function": "off",
142
+ /**
143
+ * Disallow empty functions.
144
+ * Disabled for test stubs and spies.
145
+ *
146
+ * @see https://typescript-eslint.io/rules/no-empty-function
147
+ */
43
148
  "@typescript-eslint/no-empty-function": "off",
149
+ /**
150
+ * Disallow magic numbers.
151
+ * Disabled for test assertions.
152
+ *
153
+ * @see https://eslint.org/docs/latest/rules/no-magic-numbers
154
+ */
44
155
  "no-magic-numbers": "off",
156
+ /**
157
+ * Disallow the use of console.
158
+ * Disabled for test debugging.
159
+ *
160
+ * @see https://eslint.org/docs/latest/rules/no-console
161
+ */
45
162
  "no-console": "off",
163
+ /**
164
+ * Allow importing devDependencies in test files.
165
+ * Already covered by the base rule's allowlist; kept here as an explicit
166
+ * override for consumers that overlay this config on different file globs.
167
+ *
168
+ * @see https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-extraneous-dependencies.md
169
+ */
46
170
  "import/no-extraneous-dependencies": "off",
171
+ /**
172
+ * Disallow focused tests.
173
+ * Prevents .only from being committed.
174
+ *
175
+ * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-focused-tests.md
176
+ */
47
177
  "vitest/no-focused-tests": "error",
178
+ /**
179
+ * Disallow disabled tests.
180
+ * Warns about .skip usage.
181
+ *
182
+ * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-disabled-tests.md
183
+ */
48
184
  "vitest/no-disabled-tests": "warn",
185
+ /**
186
+ * Enforce lowercase test names.
187
+ * Consistent test naming convention.
188
+ *
189
+ * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-lowercase-title.md
190
+ */
49
191
  "vitest/prefer-lowercase-title": "warn",
192
+ /**
193
+ * Enforce a maximum depth for nested describe calls.
194
+ *
195
+ * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/max-nested-describe.md
196
+ */
50
197
  "vitest/max-nested-describe": ["error", { max: 5 }],
198
+ /**
199
+ * Disallow conditional logic in tests.
200
+ * Tests should be deterministic.
201
+ *
202
+ * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-in-test.md
203
+ */
51
204
  "vitest/no-conditional-in-test": "error",
205
+ /**
206
+ * Disallow conditional expects.
207
+ * Expectations should not be inside conditionals.
208
+ *
209
+ * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-expect.md
210
+ */
52
211
  "vitest/no-conditional-expect": "error",
212
+ /**
213
+ * Enforce consistent hook ordering.
214
+ *
215
+ * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-hooks-in-order.md
216
+ */
53
217
  "vitest/prefer-hooks-in-order": "warn",
218
+ /**
219
+ * Prefer vi.spyOn over manual mocks.
220
+ *
221
+ * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-spy-on.md
222
+ */
54
223
  "vitest/prefer-spy-on": "warn"
55
224
  }
56
225
  }]);
@@ -1,5 +1,3 @@
1
- import * as eslint_config0 from "eslint/config";
2
-
3
1
  //#region src/configs/flavour-vitest.d.ts
4
2
  /**
5
3
  * ESLint configuration tailored for Vitest test files.
@@ -9,6 +7,6 @@ import * as eslint_config0 from "eslint/config";
9
7
  * NOTE: This configuration is meant to be used in conjunction with
10
8
  * the base TypeScript ESLint configuration.
11
9
  */
12
- declare const config: eslint_config0.Config[];
10
+ declare const config: import("eslint/config").Config[];
13
11
  //#endregion
14
12
  export { config };
@@ -1,5 +1,3 @@
1
- import * as eslint_config0 from "eslint/config";
2
-
3
1
  //#region src/configs/flavour-vitest.d.ts
4
2
  /**
5
3
  * ESLint configuration tailored for Vitest test files.
@@ -9,6 +7,6 @@ import * as eslint_config0 from "eslint/config";
9
7
  * NOTE: This configuration is meant to be used in conjunction with
10
8
  * the base TypeScript ESLint configuration.
11
9
  */
12
- declare const config: eslint_config0.Config[];
10
+ declare const config: import("eslint/config").Config[];
13
11
  //#endregion
14
12
  export { config };