@adddog/eslint 0.0.6

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Sam Elie
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,414 @@
1
+ # @adddog/eslint
2
+
3
+ > Shared ESLint configuration for the monorepo, built on [@antfu/eslint-config](https://github.com/antfu/eslint-config)
4
+
5
+ ![Overview](https://raw.githubusercontent.com/samradical/readme-images/refs/heads/main/overview-fs8.png)
6
+
7
+ This package provides a TypeScript-focused ESLint configuration that emphasizes:
8
+
9
+ - **Type Safety**: Strict enforcement against `any` types
10
+ - **Code Quality**: Sensible defaults with flexibility for real-world patterns
11
+ - **Developer Experience**: 4-space indentation, double quotes, semicolons
12
+ - **Modern Patterns**: Support for declaration merging, hoisting, and functional programming
13
+
14
+ ## Installation
15
+
16
+ ### From npm
17
+
18
+ ```bash
19
+ npm install --save-dev @adddog/eslint
20
+ # or
21
+ pnpm add -D @adddog/eslint
22
+ # or
23
+ yarn add -D @adddog/eslint
24
+ ```
25
+
26
+ Then add to your `package.json`:
27
+
28
+ ```json
29
+ {
30
+ "devDependencies": {
31
+ "@adddog/eslint": "^0.0.1"
32
+ }
33
+ }
34
+ ```
35
+
36
+ ### From GitHub
37
+
38
+ Install directly from the GitHub repository:
39
+
40
+ ```bash
41
+ npm install --save-dev github:samelie/eslint
42
+ # or
43
+ pnpm add -D github:samelie/eslint
44
+ # or
45
+ yarn add -D github:samelie/eslint
46
+ ```
47
+
48
+ Or specify a specific tag/commit:
49
+
50
+ ```bash
51
+ npm install --save-dev github:samelie/eslint#v0.0.1
52
+ ```
53
+
54
+ ### In Monorepo (Workspace)
55
+
56
+ For internal monorepo use with workspace protocol:
57
+
58
+ ```json
59
+ {
60
+ "devDependencies": {
61
+ "@adddog/eslint": "workspace:*"
62
+ }
63
+ }
64
+ ```
65
+
66
+ ### Peer Dependencies
67
+
68
+ This package requires the following peer dependencies:
69
+
70
+ ```json
71
+ {
72
+ "eslint": "^9.37.0",
73
+ "typescript": "^5.9.3"
74
+ }
75
+ ```
76
+
77
+ Install them if not already present:
78
+
79
+ ```bash
80
+ pnpm add -D eslint typescript
81
+ ```
82
+
83
+ ## Usage
84
+
85
+ ### Basic Setup
86
+
87
+ Create an `eslint.config.mjs` in your package:
88
+
89
+ ```js
90
+ import radEslint from "@adddog/eslint";
91
+
92
+ export default radEslint();
93
+ ```
94
+
95
+ ### With Custom Ignores
96
+
97
+ ```js
98
+ import radEslint from "@adddog/eslint";
99
+
100
+ export default radEslint({
101
+ ignores: ["**/generated/**", "**/fixtures/**"]
102
+ });
103
+ ```
104
+
105
+ ### With Additional Rules
106
+
107
+ ```js
108
+ import radEslint from "@adddog/eslint";
109
+
110
+ export default radEslint(
111
+ {
112
+ // Base options
113
+ typescript: true,
114
+ },
115
+ // Additional config objects
116
+ {
117
+ rules: {
118
+ "no-console": "error",
119
+ },
120
+ }
121
+ );
122
+ ```
123
+
124
+ ## Configuration Philosophy
125
+
126
+ ### What's Different from antfu's Defaults?
127
+
128
+ #### Stylistic Preferences
129
+ - **Indentation**: 4 spaces (default: 2)
130
+ - **Quotes**: Double quotes (default: single)
131
+ - **Semicolons**: Required (default: none)
132
+ - **Arrow Parens**: As needed (default: varies)
133
+ - **Brace Style**: 1TBS with single-line exception
134
+
135
+ #### Type Safety (Stricter)
136
+ - `ts/no-explicit-any`: **error** (default: off) - No `any` allowed
137
+ - `ts/unified-signatures`: **error** (default: off) - Combine overloads
138
+
139
+ #### Flexibility (More Permissive)
140
+ - `antfu/curly`: **off** - Allow single-line if statements
141
+ - `antfu/top-level-function`: **off** - Allow arrow functions at top level
142
+ - `ts/consistent-type-definitions`: **off** - Allow both `type` and `interface`
143
+ - `ts/no-redeclare`: **off** - Allow declaration merging
144
+ - `ts/no-use-before-define`: **off** - Allow hoisting
145
+
146
+ ### Custom Plugins
147
+
148
+ 1. **@adddog/eslint-plugin-rules**
149
+ - `rad/no-incorrect-pkg-imports`: Enforces correct package imports
150
+
151
+ 2. **eslint-plugin-no-barrel-files**
152
+ - Prevents barrel file patterns (index re-exports)
153
+
154
+ ## Key Rules Reference
155
+
156
+ ### Enforced for Type Safety
157
+
158
+ ```ts
159
+ // ❌ Bad
160
+ const data: any = fetchData();
161
+
162
+ // ✅ Good
163
+ const data: unknown = fetchData();
164
+ const validated = DataSchema.parse(data);
165
+ ```
166
+
167
+ ### Unused Variables Pattern
168
+
169
+ Use underscore prefix for intentionally unused variables:
170
+
171
+ ```ts
172
+ // ✅ Good
173
+ const [_first, second] = array;
174
+ const { removed: _removed, ...rest } = object;
175
+
176
+ function handler(_unusedParam: string, used: number) {
177
+ return used * 2;
178
+ }
179
+
180
+ try {
181
+ // ...
182
+ } catch (_error) {
183
+ // Error intentionally ignored
184
+ }
185
+ ```
186
+
187
+ ### Declaration Merging Allowed
188
+
189
+ ```ts
190
+ // ✅ Allowed
191
+ interface User {
192
+ name: string;
193
+ }
194
+
195
+ namespace User {
196
+ export function create(name: string): User {
197
+ return { name };
198
+ }
199
+ }
200
+ ```
201
+
202
+ ### Flexible Function Styles
203
+
204
+ ```ts
205
+ // ✅ All allowed at top level
206
+ export function declarationStyle() {}
207
+
208
+ export const arrowStyle = () => {};
209
+
210
+ export const namedCallback = array.map(function process(item) {
211
+ // Named for better stack traces
212
+ return item * 2;
213
+ });
214
+ ```
215
+
216
+ ## Architecture Decisions
217
+
218
+ ### Why These Overrides?
219
+
220
+ **`ts/no-explicit-any`: error**
221
+ - Prevents type safety holes
222
+ - Forces explicit typing with `unknown`
223
+ - Aligns with TypeScript's strict mode philosophy
224
+
225
+ **`antfu/top-level-function`: off**
226
+ - Modern codebases often prefer const exports
227
+ - Tree-shaking works well with arrow functions
228
+ - Consistency with internal module patterns
229
+
230
+ **`ts/no-redeclare`: off**
231
+ - TypeScript's declaration merging is powerful
232
+ - Needed for namespace + interface patterns
233
+ - Type-safe when used correctly
234
+
235
+ **`ts/no-use-before-define`: off**
236
+ - Functions can be hoisted for better organization
237
+ - TypeScript catches actual usage errors
238
+ - Allows grouping related functions naturally
239
+
240
+ ### Disabled Stylistic Rules
241
+
242
+ These are turned off for pragmatic reasons:
243
+
244
+ - `antfu/consistent-list-newline`: Can be too strict with large objects
245
+ - `style/operator-linebreak`: Allows flexible multi-line expressions
246
+ - `accessor-pairs`: Getters without setters are valid patterns
247
+
248
+ ## Type-Aware Linting
249
+
250
+ To enable advanced type-aware rules (requires project setup):
251
+
252
+ ```js
253
+ import radEslint from "@adddog/eslint";
254
+
255
+ export default radEslint({
256
+ typescript: {
257
+ tsconfigPath: "./tsconfig.json",
258
+ },
259
+ });
260
+ ```
261
+
262
+ This enables rules like:
263
+ - `ts/await-thenable` - Only await promises
264
+ - `ts/no-floating-promises` - Require promise handling
265
+ - `ts/no-unnecessary-type-assertion` - Remove redundant assertions
266
+ - `ts/strict-boolean-expressions` - Strict conditionals
267
+
268
+ See the [config source](./src/eslint.config.ts) for a complete list of available type-aware rules.
269
+
270
+ ## Development
271
+
272
+ ### Scripts
273
+
274
+ | Script | Description |
275
+ |-------------|--------------------------------------|
276
+ | `build` | Build the package with unbuild |
277
+ | `lint` | Lint the package source |
278
+ | `lint:fix` | Auto-fix linting issues |
279
+ | `types` | Type-check the package |
280
+ | `knip` | Check for unused dependencies |
281
+
282
+ ### Testing Changes
283
+
284
+ After making changes to the config:
285
+
286
+ 1. **Build the package**:
287
+ ```bash
288
+ pnpm build
289
+ ```
290
+
291
+ 2. **Test in a consuming package**:
292
+ ```bash
293
+ cd ../../park-app # or any app
294
+ pnpm lint
295
+ ```
296
+
297
+ 3. **Verify no regressions**:
298
+ ```bash
299
+ pnpm lint # From monorepo root
300
+ ```
301
+
302
+ ### Publishing to npm
303
+
304
+ The package includes `prepublishOnly` hooks that automatically run linting, type-checking, and building before publishing:
305
+
306
+ 1. **Update version in package.json**:
307
+ ```bash
308
+ npm version patch # or minor, major
309
+ ```
310
+
311
+ 2. **Publish to npm**:
312
+ ```bash
313
+ npm publish
314
+ ```
315
+
316
+ The `prepublishOnly` script will automatically:
317
+ - Run `pnpm lint` - Ensure code quality
318
+ - Run `pnpm types` - Verify TypeScript types
319
+ - Run `pnpm build` - Build distribution files
320
+
321
+ If any step fails, the publish will be aborted.
322
+
323
+ ## Extending the Config
324
+
325
+ ### Adding New Rules
326
+
327
+ Edit `src/eslint.config.ts`:
328
+
329
+ ```ts
330
+ .override("antfu/typescript/rules", {
331
+ rules: {
332
+ // Add your rule here
333
+ "ts/explicit-function-return-type": ["error", {
334
+ allowExpressions: true,
335
+ }],
336
+ },
337
+ })
338
+ ```
339
+
340
+ ### Per-Package Overrides
341
+
342
+ In consuming packages, override specific rules:
343
+
344
+ ```js
345
+ import radEslint from "@adddog/eslint";
346
+
347
+ export default radEslint(
348
+ {},
349
+ {
350
+ files: ["**/*.test.ts"],
351
+ rules: {
352
+ "ts/no-explicit-any": "off", // Allow any in tests
353
+ },
354
+ }
355
+ );
356
+ ```
357
+
358
+ ## Resources
359
+
360
+ - [antfu/eslint-config](https://github.com/antfu/eslint-config) - Base configuration
361
+ - [ESLint Flat Config](https://eslint.org/docs/latest/use/configure/configuration-files-new) - Modern config format
362
+ - [@stylistic/eslint-plugin](https://eslint.style/) - Stylistic rules
363
+ - [typescript-eslint](https://typescript-eslint.io/) - TypeScript rules
364
+
365
+ ## FAQ
366
+
367
+ ### Why not use Prettier?
368
+
369
+ This config uses `@stylistic/eslint-plugin` for formatting, which:
370
+ - Integrates seamlessly with ESLint
371
+ - Allows gradual adoption of formatting rules
372
+ - Provides better TypeScript-specific formatting
373
+
374
+ ### Can I use this outside the monorepo?
375
+
376
+ Yes! This package can be installed from npm or directly from GitHub:
377
+
378
+ ```bash
379
+ # From npm (when published)
380
+ pnpm add -D @adddog/eslint
381
+
382
+ # From GitHub
383
+ pnpm add -D github:samelie/eslint
384
+ ```
385
+
386
+ See the [Installation](#installation) section for more details.
387
+
388
+ ### How do I disable a rule temporarily?
389
+
390
+ ```ts
391
+ // eslint-disable-next-line ts/no-explicit-any
392
+ const legacy: any = oldApi();
393
+ ```
394
+
395
+ Or for a whole file:
396
+
397
+ ```ts
398
+ /* eslint-disable ts/no-explicit-any */
399
+ // File with many legacy patterns
400
+ ```
401
+
402
+ ### Why are barrel files forbidden?
403
+
404
+ Barrel files (index re-exports) can:
405
+ - Harm tree-shaking
406
+ - Create circular dependencies
407
+ - Slow down builds
408
+ - Make imports ambiguous
409
+
410
+ Prefer direct imports: `import { foo } from "./foo"` instead of `import { foo } from "./index"`
411
+
412
+ ## License
413
+
414
+ See [LICENSE](./LICENSE) for details.
@@ -0,0 +1,252 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const radPlguins = require('@adddog/eslint-plugin-rules');
6
+ const antfu = require('@antfu/eslint-config');
7
+ const eslintPluginNoBarrelFiles = require('eslint-plugin-no-barrel-files');
8
+
9
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
10
+
11
+ const radPlguins__default = /*#__PURE__*/_interopDefaultCompat(radPlguins);
12
+ const antfu__default = /*#__PURE__*/_interopDefaultCompat(antfu);
13
+ const eslintPluginNoBarrelFiles__default = /*#__PURE__*/_interopDefaultCompat(eslintPluginNoBarrelFiles);
14
+
15
+ const ignores = ["**/build/**", "**/dist/**", "README.md", "package.json", "**/dev-dist/**", "**.js", "**.vscode/.settings.json", "**/node_modules/**", "*.html"];
16
+ function eslint_config(options, ...userConfigs) {
17
+ return antfu__default(
18
+ {
19
+ stylistic: {
20
+ indent: 4,
21
+ quotes: "double",
22
+ semi: true
23
+ },
24
+ formatters: { css: true, xml: false },
25
+ react: false,
26
+ jsx: false,
27
+ markdown: false,
28
+ // TypeScript and Vue are auto-detected, you can also explicitly enable them:
29
+ typescript: true,
30
+ ignores: [...ignores, ...options?.ignores || []],
31
+ // Disable jsonc and yaml support
32
+ jsonc: false,
33
+ yaml: false,
34
+ vue: false,
35
+ ...options
36
+ },
37
+ {
38
+ files: ["**/*.ts"],
39
+ plugins: {
40
+ "rad": radPlguins__default,
41
+ "no-barrel-files": eslintPluginNoBarrelFiles__default
42
+ },
43
+ rules: {
44
+ "rad/no-incorrect-pkg-imports": "error",
45
+ "no-barrel-files/no-barrel-files": "error"
46
+ }
47
+ },
48
+ // ========================================
49
+ // General overrides
50
+ // ========================================
51
+ {
52
+ rules: {
53
+ // ---- Core ESLint Rules ----
54
+ // max-len: Not part of antfu's config by default (would need separate plugin)
55
+ // Turned off to avoid line length restrictions
56
+ "max-len": "off",
57
+ // curly: Not enforced by default in antfu's config
58
+ // Turned off to allow single-line if statements without braces
59
+ "curly": "off",
60
+ // func-style: Not enforced by default
61
+ // Turned off to allow both function declarations and expressions
62
+ "func-style": "off",
63
+ // antfu/curly: Default "error" (enforces curly braces with specific style)
64
+ // Turned off to be less opinionated about brace style
65
+ "antfu/curly": "off",
66
+ // accessor-pairs: Default ["error", { enforceForClassMembers: true, setWithoutGet: true }]
67
+ // Turned off to allow getters without corresponding setters
68
+ "accessor-pairs": "off",
69
+ // antfu/if-newline: Default "error" (enforces newline after if statement)
70
+ // Turned off for more flexible if statement formatting
71
+ "antfu/if-newline": "off",
72
+ // antfu/consistent-list-newline: Default "error" (enforces consistent newlines in arrays/objects)
73
+ // Turned off to allow mixed single-line and multi-line arrays/objects
74
+ "antfu/consistent-list-newline": "off",
75
+ // ---- TypeScript Rules ----
76
+ // ts/consistent-type-definitions: Default ["error", "interface"]
77
+ // Turned off to allow both "interface" and "type" for type definitions
78
+ "ts/consistent-type-definitions": "off",
79
+ // ts/no-redeclare: Default ["error", { builtinGlobals: false }]
80
+ // Turned off to allow declaration merging (interfaces, namespaces)
81
+ "ts/no-redeclare": "off",
82
+ // ts/no-unused-expressions: Default ["error", { allowShortCircuit: true, allowTaggedTemplates: true, allowTernary: true }]
83
+ // Turned off to allow expressions like optional chaining that may not have side effects
84
+ "ts/no-unused-expressions": "off",
85
+ // ts/no-explicit-any: Default "off" in antfu's config
86
+ // Set to "error" to enforce strict typing and prevent use of "any"
87
+ "ts/no-explicit-any": "error",
88
+ // prefer-arrow-callback: Default ["error", { allowNamedFunctions: false, allowUnboundThis: true }]
89
+ // Modified to allow named function expressions in callbacks for better stack traces
90
+ "prefer-arrow-callback": [
91
+ "error",
92
+ {
93
+ allowNamedFunctions: true,
94
+ // Changed from false
95
+ allowUnboundThis: true
96
+ }
97
+ ]
98
+ }
99
+ },
100
+ ...userConfigs
101
+ ).override("antfu/unicorn/rules", {
102
+ rules: {
103
+ // unicorn/no-new-array: Default "error" (enforces array literals over new Array())
104
+ // Turned off to allow new Array(length) for creating arrays with specific length
105
+ "unicorn/no-new-array": "off"
106
+ // Other unicorn rules enabled by default in antfu's config (for reference):
107
+ // - unicorn/consistent-empty-array-spread: "error"
108
+ // - unicorn/error-message: "error" (require error messages)
109
+ // - unicorn/escape-case: "error" (enforce uppercase hex escapes)
110
+ // - unicorn/new-for-builtins: "error" (enforce new for builtins)
111
+ // - unicorn/no-instanceof-builtins: "error"
112
+ // - unicorn/no-new-buffer: "error" (use Buffer.from/Buffer.alloc)
113
+ // - unicorn/number-literal-case: "error" (enforce lowercase for number literals)
114
+ // - unicorn/prefer-dom-node-text-content: "error"
115
+ // - unicorn/prefer-includes: "error" (prefer includes over indexOf)
116
+ // - unicorn/prefer-node-protocol: "error" (enforce node: protocol)
117
+ // - unicorn/prefer-number-properties: "error" (prefer Number.isNaN over isNaN)
118
+ // - unicorn/prefer-string-starts-ends-with: "error"
119
+ // - unicorn/prefer-type-error: "error"
120
+ // - unicorn/throw-new-error: "error" (require new when throwing errors)
121
+ }
122
+ }).override("antfu/stylistic/rules", {
123
+ rules: {
124
+ // antfu/top-level-function: Default "error" (enforces function declarations at top level)
125
+ // Reference: https://github.com/antfu/eslint-config/blob/main/src/configs/stylistic.ts#L61
126
+ // Turned off to allow const/arrow functions at top level
127
+ "antfu/top-level-function": "off",
128
+ // style/arrow-parens: Default depends on stylistic config
129
+ // Set to "as-needed" to only require parens when necessary (multiple params, etc)
130
+ "style/arrow-parens": ["error", "as-needed"],
131
+ // style/operator-linebreak: Default enforces operators at end/beginning of line
132
+ // Turned off for flexible operator placement in multi-line expressions
133
+ "style/operator-linebreak": "off",
134
+ // style/array-element-newline: Default "off" in antfu's config
135
+ // Reference: https://eslint.style/rules/default/array-element-newline
136
+ // Kept off because it causes issues with large objects in arrays
137
+ "style/array-element-newline": "off",
138
+ // style/max-statements-per-line: Default { max: 1 }
139
+ // Increased to 2 to allow simple statements on same line (e.g., case statements)
140
+ "style/max-statements-per-line": ["error", {
141
+ max: 2
142
+ }],
143
+ // style/function-call-argument-newline: Default varies
144
+ // Set to "consistent" so all arguments are either inline or one-per-line
145
+ "style/function-call-argument-newline": ["error", "consistent"],
146
+ // style/brace-style: Default depends on stylistic preset
147
+ // Set to "1tbs" (one true brace style) with single-line exception
148
+ "style/brace-style": ["error", "1tbs", {
149
+ allowSingleLine: true
150
+ }]
151
+ // Other notable stylistic rules from antfu's config (using your custom config):
152
+ // - indent: 4 (default: 2)
153
+ // - quotes: "double" (default: "single")
154
+ // - semi: true (default: false)
155
+ // - style/generator-star-spacing: ["error", { after: true, before: false }]
156
+ // - style/yield-star-spacing: ["error", { after: true, before: false }]
157
+ // - antfu/consistent-chaining: "error" (enforces consistent chaining style)
158
+ }
159
+ }).override("antfu/typescript/rules", {
160
+ rules: {
161
+ // ts/no-use-before-define: Default ["error", { classes: false, functions: false, variables: true }]
162
+ // Turned off to allow hoisting and more flexible declaration order
163
+ "ts/no-use-before-define": "off",
164
+ // ts/no-unsafe-declaration-merging: Default not explicitly set (likely "error")
165
+ // Turned off to allow declaration merging patterns (e.g., interface + namespace)
166
+ "ts/no-unsafe-declaration-merging": "off",
167
+ // no-redeclare: Default ["error", { builtinGlobals: false }]
168
+ // Turned off in favor of TypeScript's own redeclaration checks
169
+ "no-redeclare": "off",
170
+ // ts/no-redeclare: Default ["error", { builtinGlobals: false }]
171
+ // Turned off to allow declaration merging (same as general overrides)
172
+ "ts/no-redeclare": "off",
173
+ // ts/no-explicit-any: Default "off" in antfu's config
174
+ // Set to "error" to enforce strict typing and prevent use of "any"
175
+ // This is a critical rule for type safety
176
+ "ts/no-explicit-any": "error",
177
+ // ts/unified-signatures: Default "off" in antfu's config
178
+ // Set to "error" to enforce combining overloaded signatures where possible
179
+ "ts/unified-signatures": "error",
180
+ // ts/no-unused-vars: Default "off" in antfu's typescript config (handled by unused-imports plugin)
181
+ // Reference: https://johnnyreilly.com/typescript-eslint-no-unused-vars
182
+ // Configured with strict underscore-prefix ignore pattern for intentionally unused variables
183
+ "ts/no-unused-vars": [
184
+ "error",
185
+ {
186
+ args: "all",
187
+ // Check all arguments (default: "after-used")
188
+ argsIgnorePattern: "^_",
189
+ // Allow _unused arguments
190
+ caughtErrors: "all",
191
+ // Check caught errors (default: "none")
192
+ caughtErrorsIgnorePattern: "^_",
193
+ // Allow _error in catch blocks
194
+ destructuredArrayIgnorePattern: "^_",
195
+ // Allow [_skip, value] patterns
196
+ varsIgnorePattern: "^_",
197
+ // Allow _unusedVar
198
+ ignoreRestSiblings: true
199
+ // Allow const { removed, ...rest } patterns
200
+ }
201
+ ]
202
+ // Other important TypeScript rules from antfu's config (for reference):
203
+ // - ts/ban-ts-comment: ["error", { "ts-expect-error": "allow-with-description" }]
204
+ // - ts/consistent-type-definitions: ["error", "interface"] (you override to "off")
205
+ // - ts/consistent-type-imports: ["error", { disallowTypeAnnotations: false, fixStyle: "separate-type-imports", prefer: "type-imports" }]
206
+ // - ts/method-signature-style: ["error", "property"] (prefer property syntax)
207
+ // - ts/no-dupe-class-members: "error"
208
+ // - ts/no-dynamic-delete: "off"
209
+ // - ts/no-empty-object-type: ["error", { allowInterfaces: "always" }]
210
+ // - ts/no-import-type-side-effects: "error"
211
+ // - ts/no-invalid-void-type: "off"
212
+ // - ts/no-non-null-assertion: "off"
213
+ // - ts/no-require-imports: "error"
214
+ // - ts/no-unused-expressions: ["error", { allowShortCircuit: true, allowTaggedTemplates: true, allowTernary: true }]
215
+ // - ts/no-useless-constructor: "off"
216
+ // - ts/no-wrapper-object-types: "error"
217
+ // - ts/triple-slash-reference: "off"
218
+ // ========================================
219
+ // Notable rules you might want to consider:
220
+ // ========================================
221
+ //
222
+ // Type-aware rules (require tsconfigPath):
223
+ // - ts/await-thenable: "error" - Only await thenables
224
+ // - ts/no-floating-promises: "error" - Promises must be handled
225
+ // - ts/no-misused-promises: "error" - Prevent common promise mistakes
226
+ // - ts/no-unnecessary-type-assertion: "error" - Remove redundant assertions
227
+ // - ts/no-unsafe-argument: "error" - Prevent any in function arguments
228
+ // - ts/no-unsafe-assignment: "error" - Prevent assigning any to typed variables
229
+ // - ts/no-unsafe-call: "error" - Prevent calling any as function
230
+ // - ts/no-unsafe-member-access: "error" - Prevent accessing properties of any
231
+ // - ts/no-unsafe-return: "error" - Prevent returning any from typed functions
232
+ // - ts/strict-boolean-expressions: "error" - Strict boolean checks in conditions
233
+ // - ts/switch-exhaustiveness-check: "error" - Ensure all cases handled in switch
234
+ //
235
+ // Naming conventions:
236
+ // - ts/naming-convention: Configure consistent naming patterns
237
+ //
238
+ // Import organization:
239
+ // - ts/consistent-type-imports: ["error", { prefer: "type-imports" }] (already enabled in antfu)
240
+ // - perfectionist/sort-imports: "error" (available in antfu's perfectionist config)
241
+ //
242
+ // Code quality:
243
+ // - complexity: ["error", 10] - Limit cyclomatic complexity
244
+ // - max-depth: ["error", 4] - Limit nesting depth
245
+ // - max-nested-callbacks: ["error", 3] - Limit callback nesting
246
+ }
247
+ });
248
+ }
249
+
250
+ exports.default = eslint_config;
251
+ exports.ignores = ignores;
252
+ //# sourceMappingURL=eslint.config.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eslint.config.cjs","sources":["../src/eslint.config.ts"],"sourcesContent":["/**\n * ESLint Configuration based on @antfu/eslint-config\n *\n * This configuration extends Anthony Fu's ESLint config with custom overrides for:\n * - Stylistic preferences (4-space indent, double quotes, semicolons)\n * - Type safety (strict any prevention)\n * - Flexible code organization (allow declaration merging, hoisting)\n * - Custom plugins (rad rules, no-barrel-files)\n *\n * Structure:\n * 1. Base config with stylistic preferences\n * 2. Custom plugin rules\n * 3. General rule overrides\n * 4. Unicorn plugin overrides\n * 5. Stylistic rule overrides\n * 6. TypeScript rule overrides\n *\n * Reference: https://github.com/antfu/eslint-config\n */\n\nimport radPlguins from \"@adddog/eslint-plugin-rules\";\nimport antfu from \"@antfu/eslint-config\";\n\nimport eslintPluginNoBarrelFiles from \"eslint-plugin-no-barrel-files\";\n\nexport const ignores = [\"**/build/**\", \"**/dist/**\", \"README.md\", \"package.json\", \"**/dev-dist/**\", \"**.js\", \"**.vscode/.settings.json\", \"**/node_modules/**\", \"*.html\"];\n\nexport default function (options?: Parameters<typeof antfu>[0] & { ignores?: string[] }, ...userConfigs: Parameters<typeof antfu>[1][]): ReturnType<typeof antfu> {\n return antfu(\n {\n stylistic: {\n indent: 4,\n quotes: \"double\",\n semi: true,\n },\n formatters: { css: true, xml: false },\n react: false,\n jsx: false,\n markdown: false,\n // TypeScript and Vue are auto-detected, you can also explicitly enable them:\n typescript: true,\n ignores: [...ignores, ...(options?.ignores || [])],\n // Disable jsonc and yaml support\n jsonc: false,\n yaml: false,\n vue: false,\n ...options,\n },\n {\n files: [\"**/*.ts\"],\n plugins: {\n \"rad\": radPlguins,\n \"no-barrel-files\": eslintPluginNoBarrelFiles,\n },\n rules: {\n \"rad/no-incorrect-pkg-imports\": \"error\",\n \"no-barrel-files/no-barrel-files\": \"error\",\n },\n },\n // ========================================\n // General overrides\n // ========================================\n {\n rules: {\n // ---- Core ESLint Rules ----\n\n // max-len: Not part of antfu's config by default (would need separate plugin)\n // Turned off to avoid line length restrictions\n \"max-len\": \"off\",\n\n // curly: Not enforced by default in antfu's config\n // Turned off to allow single-line if statements without braces\n \"curly\": \"off\",\n\n // func-style: Not enforced by default\n // Turned off to allow both function declarations and expressions\n \"func-style\": \"off\",\n\n // antfu/curly: Default \"error\" (enforces curly braces with specific style)\n // Turned off to be less opinionated about brace style\n \"antfu/curly\": \"off\",\n\n // accessor-pairs: Default [\"error\", { enforceForClassMembers: true, setWithoutGet: true }]\n // Turned off to allow getters without corresponding setters\n \"accessor-pairs\": \"off\",\n\n // antfu/if-newline: Default \"error\" (enforces newline after if statement)\n // Turned off for more flexible if statement formatting\n \"antfu/if-newline\": \"off\",\n\n // antfu/consistent-list-newline: Default \"error\" (enforces consistent newlines in arrays/objects)\n // Turned off to allow mixed single-line and multi-line arrays/objects\n \"antfu/consistent-list-newline\": \"off\",\n\n // ---- TypeScript Rules ----\n\n // ts/consistent-type-definitions: Default [\"error\", \"interface\"]\n // Turned off to allow both \"interface\" and \"type\" for type definitions\n \"ts/consistent-type-definitions\": \"off\",\n\n // ts/no-redeclare: Default [\"error\", { builtinGlobals: false }]\n // Turned off to allow declaration merging (interfaces, namespaces)\n \"ts/no-redeclare\": \"off\",\n\n // ts/no-unused-expressions: Default [\"error\", { allowShortCircuit: true, allowTaggedTemplates: true, allowTernary: true }]\n // Turned off to allow expressions like optional chaining that may not have side effects\n \"ts/no-unused-expressions\": \"off\",\n\n // ts/no-explicit-any: Default \"off\" in antfu's config\n // Set to \"error\" to enforce strict typing and prevent use of \"any\"\n \"ts/no-explicit-any\": \"error\",\n\n // prefer-arrow-callback: Default [\"error\", { allowNamedFunctions: false, allowUnboundThis: true }]\n // Modified to allow named function expressions in callbacks for better stack traces\n \"prefer-arrow-callback\": [\n \"error\",\n {\n allowNamedFunctions: true, // Changed from false\n allowUnboundThis: true,\n },\n ],\n },\n },\n ...userConfigs,\n )\n // ========================================\n // Unicorn plugin overrides\n // ========================================\n .override(\"antfu/unicorn/rules\", {\n rules: {\n // unicorn/no-new-array: Default \"error\" (enforces array literals over new Array())\n // Turned off to allow new Array(length) for creating arrays with specific length\n \"unicorn/no-new-array\": \"off\",\n\n // Other unicorn rules enabled by default in antfu's config (for reference):\n // - unicorn/consistent-empty-array-spread: \"error\"\n // - unicorn/error-message: \"error\" (require error messages)\n // - unicorn/escape-case: \"error\" (enforce uppercase hex escapes)\n // - unicorn/new-for-builtins: \"error\" (enforce new for builtins)\n // - unicorn/no-instanceof-builtins: \"error\"\n // - unicorn/no-new-buffer: \"error\" (use Buffer.from/Buffer.alloc)\n // - unicorn/number-literal-case: \"error\" (enforce lowercase for number literals)\n // - unicorn/prefer-dom-node-text-content: \"error\"\n // - unicorn/prefer-includes: \"error\" (prefer includes over indexOf)\n // - unicorn/prefer-node-protocol: \"error\" (enforce node: protocol)\n // - unicorn/prefer-number-properties: \"error\" (prefer Number.isNaN over isNaN)\n // - unicorn/prefer-string-starts-ends-with: \"error\"\n // - unicorn/prefer-type-error: \"error\"\n // - unicorn/throw-new-error: \"error\" (require new when throwing errors)\n },\n })\n // ========================================\n // Stylistic overrides\n // ========================================\n .override(\"antfu/stylistic/rules\", {\n rules: {\n // antfu/top-level-function: Default \"error\" (enforces function declarations at top level)\n // Reference: https://github.com/antfu/eslint-config/blob/main/src/configs/stylistic.ts#L61\n // Turned off to allow const/arrow functions at top level\n \"antfu/top-level-function\": \"off\",\n\n // style/arrow-parens: Default depends on stylistic config\n // Set to \"as-needed\" to only require parens when necessary (multiple params, etc)\n \"style/arrow-parens\": [\"error\", \"as-needed\"],\n\n // style/operator-linebreak: Default enforces operators at end/beginning of line\n // Turned off for flexible operator placement in multi-line expressions\n \"style/operator-linebreak\": \"off\",\n\n // style/array-element-newline: Default \"off\" in antfu's config\n // Reference: https://eslint.style/rules/default/array-element-newline\n // Kept off because it causes issues with large objects in arrays\n \"style/array-element-newline\": \"off\",\n\n // style/max-statements-per-line: Default { max: 1 }\n // Increased to 2 to allow simple statements on same line (e.g., case statements)\n \"style/max-statements-per-line\": [\"error\", {\n max: 2,\n }],\n\n // style/function-call-argument-newline: Default varies\n // Set to \"consistent\" so all arguments are either inline or one-per-line\n \"style/function-call-argument-newline\": [\"error\", \"consistent\"],\n\n // style/brace-style: Default depends on stylistic preset\n // Set to \"1tbs\" (one true brace style) with single-line exception\n \"style/brace-style\": [\"error\", \"1tbs\", {\n allowSingleLine: true,\n }],\n\n // Other notable stylistic rules from antfu's config (using your custom config):\n // - indent: 4 (default: 2)\n // - quotes: \"double\" (default: \"single\")\n // - semi: true (default: false)\n // - style/generator-star-spacing: [\"error\", { after: true, before: false }]\n // - style/yield-star-spacing: [\"error\", { after: true, before: false }]\n // - antfu/consistent-chaining: \"error\" (enforces consistent chaining style)\n },\n })\n // ========================================\n // TypeScript-specific overrides\n // ========================================\n // Rules are scoped to names\n // Reference: https://github.com/antfu/eslint-config/blob/93c9e772faf45295a4deb2633a4655954da74491/src/configs/typescript.ts#L110\n .override(\"antfu/typescript/rules\", {\n rules: {\n // ts/no-use-before-define: Default [\"error\", { classes: false, functions: false, variables: true }]\n // Turned off to allow hoisting and more flexible declaration order\n \"ts/no-use-before-define\": \"off\",\n\n // ts/no-unsafe-declaration-merging: Default not explicitly set (likely \"error\")\n // Turned off to allow declaration merging patterns (e.g., interface + namespace)\n \"ts/no-unsafe-declaration-merging\": \"off\",\n\n // no-redeclare: Default [\"error\", { builtinGlobals: false }]\n // Turned off in favor of TypeScript's own redeclaration checks\n \"no-redeclare\": \"off\",\n\n // ts/no-redeclare: Default [\"error\", { builtinGlobals: false }]\n // Turned off to allow declaration merging (same as general overrides)\n \"ts/no-redeclare\": \"off\",\n\n // ts/no-explicit-any: Default \"off\" in antfu's config\n // Set to \"error\" to enforce strict typing and prevent use of \"any\"\n // This is a critical rule for type safety\n \"ts/no-explicit-any\": \"error\",\n\n // ts/unified-signatures: Default \"off\" in antfu's config\n // Set to \"error\" to enforce combining overloaded signatures where possible\n \"ts/unified-signatures\": \"error\",\n\n // ts/no-unused-vars: Default \"off\" in antfu's typescript config (handled by unused-imports plugin)\n // Reference: https://johnnyreilly.com/typescript-eslint-no-unused-vars\n // Configured with strict underscore-prefix ignore pattern for intentionally unused variables\n \"ts/no-unused-vars\": [\n \"error\",\n {\n args: \"all\", // Check all arguments (default: \"after-used\")\n argsIgnorePattern: \"^_\", // Allow _unused arguments\n caughtErrors: \"all\", // Check caught errors (default: \"none\")\n caughtErrorsIgnorePattern: \"^_\", // Allow _error in catch blocks\n destructuredArrayIgnorePattern: \"^_\", // Allow [_skip, value] patterns\n varsIgnorePattern: \"^_\", // Allow _unusedVar\n ignoreRestSiblings: true, // Allow const { removed, ...rest } patterns\n },\n ],\n\n // Other important TypeScript rules from antfu's config (for reference):\n // - ts/ban-ts-comment: [\"error\", { \"ts-expect-error\": \"allow-with-description\" }]\n // - ts/consistent-type-definitions: [\"error\", \"interface\"] (you override to \"off\")\n // - ts/consistent-type-imports: [\"error\", { disallowTypeAnnotations: false, fixStyle: \"separate-type-imports\", prefer: \"type-imports\" }]\n // - ts/method-signature-style: [\"error\", \"property\"] (prefer property syntax)\n // - ts/no-dupe-class-members: \"error\"\n // - ts/no-dynamic-delete: \"off\"\n // - ts/no-empty-object-type: [\"error\", { allowInterfaces: \"always\" }]\n // - ts/no-import-type-side-effects: \"error\"\n // - ts/no-invalid-void-type: \"off\"\n // - ts/no-non-null-assertion: \"off\"\n // - ts/no-require-imports: \"error\"\n // - ts/no-unused-expressions: [\"error\", { allowShortCircuit: true, allowTaggedTemplates: true, allowTernary: true }]\n // - ts/no-useless-constructor: \"off\"\n // - ts/no-wrapper-object-types: \"error\"\n // - ts/triple-slash-reference: \"off\"\n\n // ========================================\n // Notable rules you might want to consider:\n // ========================================\n //\n // Type-aware rules (require tsconfigPath):\n // - ts/await-thenable: \"error\" - Only await thenables\n // - ts/no-floating-promises: \"error\" - Promises must be handled\n // - ts/no-misused-promises: \"error\" - Prevent common promise mistakes\n // - ts/no-unnecessary-type-assertion: \"error\" - Remove redundant assertions\n // - ts/no-unsafe-argument: \"error\" - Prevent any in function arguments\n // - ts/no-unsafe-assignment: \"error\" - Prevent assigning any to typed variables\n // - ts/no-unsafe-call: \"error\" - Prevent calling any as function\n // - ts/no-unsafe-member-access: \"error\" - Prevent accessing properties of any\n // - ts/no-unsafe-return: \"error\" - Prevent returning any from typed functions\n // - ts/strict-boolean-expressions: \"error\" - Strict boolean checks in conditions\n // - ts/switch-exhaustiveness-check: \"error\" - Ensure all cases handled in switch\n //\n // Naming conventions:\n // - ts/naming-convention: Configure consistent naming patterns\n //\n // Import organization:\n // - ts/consistent-type-imports: [\"error\", { prefer: \"type-imports\" }] (already enabled in antfu)\n // - perfectionist/sort-imports: \"error\" (available in antfu's perfectionist config)\n //\n // Code quality:\n // - complexity: [\"error\", 10] - Limit cyclomatic complexity\n // - max-depth: [\"error\", 4] - Limit nesting depth\n // - max-nested-callbacks: [\"error\", 3] - Limit callback nesting\n },\n });\n}\n"],"names":["antfu","radPlguins","eslintPluginNoBarrelFiles"],"mappings":";;;;;;;;;;;;;;AAyBO,MAAM,OAAA,GAAU,CAAC,aAAA,EAAe,YAAA,EAAc,WAAA,EAAa,gBAAgB,gBAAA,EAAkB,OAA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AAS,wBAAA,EAA0B;AAAA,IAChC,KAAA,EAAO;AAAA;AAAA;AAAA,MAGH,yBAAA,EAA2B,KAAA;AAAA;AAAA;AAAA,MAI3B,kCAAA,EAAoC,KAAA;AAAA;AAAA;AAAA,MAIpC,cAAA,EAAgB,KAAA;AAAA;AAAA;AAAA,MAIhB,iBAAA,EAAmB,KAAA;AAAA;AAAA;AAAA;AAAA,MAKnB,oBAAA,EAAsB,OAAA;AAAA;AAAA;AAAA,MAItB,uBAAA,EAAyB,OAAA;AAAA;AAAA;AAAA;AAAA,MAKzB,mBAAA,EAAqB;AAAA,QACjB,OAAA;AAAA,QACA;AAAA,UACI,IAAA,EAAM,KAAA;AAAA;AAAA,UACN,iBAAA,EAAmB,IAAA;AAAA;AAAA,UACnB,YAAA,EAAc,KAAA;AAAA;AAAA,UACd,yBAAA,EAA2B,IAAA;AAAA;AAAA,UAC3B,8BAAA,EAAgC,IAAA;AAAA;AAAA,UAChC,iBAAA,EAAmB,IAAA;AAAA;AAAA,UACnB,kBAAA,EAAoB;AAAA;AAAA;AACxB;AACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA+CJ,GACH,CAAA;AACT;;;;;"}
@@ -0,0 +1,30 @@
1
+ import antfu from '@antfu/eslint-config';
2
+
3
+ /**
4
+ * ESLint Configuration based on @antfu/eslint-config
5
+ *
6
+ * This configuration extends Anthony Fu's ESLint config with custom overrides for:
7
+ * - Stylistic preferences (4-space indent, double quotes, semicolons)
8
+ * - Type safety (strict any prevention)
9
+ * - Flexible code organization (allow declaration merging, hoisting)
10
+ * - Custom plugins (rad rules, no-barrel-files)
11
+ *
12
+ * Structure:
13
+ * 1. Base config with stylistic preferences
14
+ * 2. Custom plugin rules
15
+ * 3. General rule overrides
16
+ * 4. Unicorn plugin overrides
17
+ * 5. Stylistic rule overrides
18
+ * 6. TypeScript rule overrides
19
+ *
20
+ * Reference: https://github.com/antfu/eslint-config
21
+ */
22
+
23
+ declare const ignores: string[];
24
+ declare function export_default(options?: Parameters<typeof antfu>[0] & {
25
+ ignores?: string[];
26
+ }, ...userConfigs: Parameters<typeof antfu>[1][]): ReturnType<typeof antfu>;
27
+
28
+ // @ts-ignore
29
+ export = export_default;
30
+ export { ignores };
@@ -0,0 +1,28 @@
1
+ import antfu from '@antfu/eslint-config';
2
+
3
+ /**
4
+ * ESLint Configuration based on @antfu/eslint-config
5
+ *
6
+ * This configuration extends Anthony Fu's ESLint config with custom overrides for:
7
+ * - Stylistic preferences (4-space indent, double quotes, semicolons)
8
+ * - Type safety (strict any prevention)
9
+ * - Flexible code organization (allow declaration merging, hoisting)
10
+ * - Custom plugins (rad rules, no-barrel-files)
11
+ *
12
+ * Structure:
13
+ * 1. Base config with stylistic preferences
14
+ * 2. Custom plugin rules
15
+ * 3. General rule overrides
16
+ * 4. Unicorn plugin overrides
17
+ * 5. Stylistic rule overrides
18
+ * 6. TypeScript rule overrides
19
+ *
20
+ * Reference: https://github.com/antfu/eslint-config
21
+ */
22
+
23
+ declare const ignores: string[];
24
+ declare function export_default(options?: Parameters<typeof antfu>[0] & {
25
+ ignores?: string[];
26
+ }, ...userConfigs: Parameters<typeof antfu>[1][]): ReturnType<typeof antfu>;
27
+
28
+ export { export_default as default, ignores };
@@ -0,0 +1,30 @@
1
+ import antfu from '@antfu/eslint-config';
2
+
3
+ /**
4
+ * ESLint Configuration based on @antfu/eslint-config
5
+ *
6
+ * This configuration extends Anthony Fu's ESLint config with custom overrides for:
7
+ * - Stylistic preferences (4-space indent, double quotes, semicolons)
8
+ * - Type safety (strict any prevention)
9
+ * - Flexible code organization (allow declaration merging, hoisting)
10
+ * - Custom plugins (rad rules, no-barrel-files)
11
+ *
12
+ * Structure:
13
+ * 1. Base config with stylistic preferences
14
+ * 2. Custom plugin rules
15
+ * 3. General rule overrides
16
+ * 4. Unicorn plugin overrides
17
+ * 5. Stylistic rule overrides
18
+ * 6. TypeScript rule overrides
19
+ *
20
+ * Reference: https://github.com/antfu/eslint-config
21
+ */
22
+
23
+ declare const ignores: string[];
24
+ declare function export_default(options?: Parameters<typeof antfu>[0] & {
25
+ ignores?: string[];
26
+ }, ...userConfigs: Parameters<typeof antfu>[1][]): ReturnType<typeof antfu>;
27
+
28
+ // @ts-ignore
29
+ export = export_default;
30
+ export { ignores };
@@ -0,0 +1,241 @@
1
+ import radPlguins from '@adddog/eslint-plugin-rules';
2
+ import antfu from '@antfu/eslint-config';
3
+ import eslintPluginNoBarrelFiles from 'eslint-plugin-no-barrel-files';
4
+
5
+ const ignores = ["**/build/**", "**/dist/**", "README.md", "package.json", "**/dev-dist/**", "**.js", "**.vscode/.settings.json", "**/node_modules/**", "*.html"];
6
+ function eslint_config(options, ...userConfigs) {
7
+ return antfu(
8
+ {
9
+ stylistic: {
10
+ indent: 4,
11
+ quotes: "double",
12
+ semi: true
13
+ },
14
+ formatters: { css: true, xml: false },
15
+ react: false,
16
+ jsx: false,
17
+ markdown: false,
18
+ // TypeScript and Vue are auto-detected, you can also explicitly enable them:
19
+ typescript: true,
20
+ ignores: [...ignores, ...options?.ignores || []],
21
+ // Disable jsonc and yaml support
22
+ jsonc: false,
23
+ yaml: false,
24
+ vue: false,
25
+ ...options
26
+ },
27
+ {
28
+ files: ["**/*.ts"],
29
+ plugins: {
30
+ "rad": radPlguins,
31
+ "no-barrel-files": eslintPluginNoBarrelFiles
32
+ },
33
+ rules: {
34
+ "rad/no-incorrect-pkg-imports": "error",
35
+ "no-barrel-files/no-barrel-files": "error"
36
+ }
37
+ },
38
+ // ========================================
39
+ // General overrides
40
+ // ========================================
41
+ {
42
+ rules: {
43
+ // ---- Core ESLint Rules ----
44
+ // max-len: Not part of antfu's config by default (would need separate plugin)
45
+ // Turned off to avoid line length restrictions
46
+ "max-len": "off",
47
+ // curly: Not enforced by default in antfu's config
48
+ // Turned off to allow single-line if statements without braces
49
+ "curly": "off",
50
+ // func-style: Not enforced by default
51
+ // Turned off to allow both function declarations and expressions
52
+ "func-style": "off",
53
+ // antfu/curly: Default "error" (enforces curly braces with specific style)
54
+ // Turned off to be less opinionated about brace style
55
+ "antfu/curly": "off",
56
+ // accessor-pairs: Default ["error", { enforceForClassMembers: true, setWithoutGet: true }]
57
+ // Turned off to allow getters without corresponding setters
58
+ "accessor-pairs": "off",
59
+ // antfu/if-newline: Default "error" (enforces newline after if statement)
60
+ // Turned off for more flexible if statement formatting
61
+ "antfu/if-newline": "off",
62
+ // antfu/consistent-list-newline: Default "error" (enforces consistent newlines in arrays/objects)
63
+ // Turned off to allow mixed single-line and multi-line arrays/objects
64
+ "antfu/consistent-list-newline": "off",
65
+ // ---- TypeScript Rules ----
66
+ // ts/consistent-type-definitions: Default ["error", "interface"]
67
+ // Turned off to allow both "interface" and "type" for type definitions
68
+ "ts/consistent-type-definitions": "off",
69
+ // ts/no-redeclare: Default ["error", { builtinGlobals: false }]
70
+ // Turned off to allow declaration merging (interfaces, namespaces)
71
+ "ts/no-redeclare": "off",
72
+ // ts/no-unused-expressions: Default ["error", { allowShortCircuit: true, allowTaggedTemplates: true, allowTernary: true }]
73
+ // Turned off to allow expressions like optional chaining that may not have side effects
74
+ "ts/no-unused-expressions": "off",
75
+ // ts/no-explicit-any: Default "off" in antfu's config
76
+ // Set to "error" to enforce strict typing and prevent use of "any"
77
+ "ts/no-explicit-any": "error",
78
+ // prefer-arrow-callback: Default ["error", { allowNamedFunctions: false, allowUnboundThis: true }]
79
+ // Modified to allow named function expressions in callbacks for better stack traces
80
+ "prefer-arrow-callback": [
81
+ "error",
82
+ {
83
+ allowNamedFunctions: true,
84
+ // Changed from false
85
+ allowUnboundThis: true
86
+ }
87
+ ]
88
+ }
89
+ },
90
+ ...userConfigs
91
+ ).override("antfu/unicorn/rules", {
92
+ rules: {
93
+ // unicorn/no-new-array: Default "error" (enforces array literals over new Array())
94
+ // Turned off to allow new Array(length) for creating arrays with specific length
95
+ "unicorn/no-new-array": "off"
96
+ // Other unicorn rules enabled by default in antfu's config (for reference):
97
+ // - unicorn/consistent-empty-array-spread: "error"
98
+ // - unicorn/error-message: "error" (require error messages)
99
+ // - unicorn/escape-case: "error" (enforce uppercase hex escapes)
100
+ // - unicorn/new-for-builtins: "error" (enforce new for builtins)
101
+ // - unicorn/no-instanceof-builtins: "error"
102
+ // - unicorn/no-new-buffer: "error" (use Buffer.from/Buffer.alloc)
103
+ // - unicorn/number-literal-case: "error" (enforce lowercase for number literals)
104
+ // - unicorn/prefer-dom-node-text-content: "error"
105
+ // - unicorn/prefer-includes: "error" (prefer includes over indexOf)
106
+ // - unicorn/prefer-node-protocol: "error" (enforce node: protocol)
107
+ // - unicorn/prefer-number-properties: "error" (prefer Number.isNaN over isNaN)
108
+ // - unicorn/prefer-string-starts-ends-with: "error"
109
+ // - unicorn/prefer-type-error: "error"
110
+ // - unicorn/throw-new-error: "error" (require new when throwing errors)
111
+ }
112
+ }).override("antfu/stylistic/rules", {
113
+ rules: {
114
+ // antfu/top-level-function: Default "error" (enforces function declarations at top level)
115
+ // Reference: https://github.com/antfu/eslint-config/blob/main/src/configs/stylistic.ts#L61
116
+ // Turned off to allow const/arrow functions at top level
117
+ "antfu/top-level-function": "off",
118
+ // style/arrow-parens: Default depends on stylistic config
119
+ // Set to "as-needed" to only require parens when necessary (multiple params, etc)
120
+ "style/arrow-parens": ["error", "as-needed"],
121
+ // style/operator-linebreak: Default enforces operators at end/beginning of line
122
+ // Turned off for flexible operator placement in multi-line expressions
123
+ "style/operator-linebreak": "off",
124
+ // style/array-element-newline: Default "off" in antfu's config
125
+ // Reference: https://eslint.style/rules/default/array-element-newline
126
+ // Kept off because it causes issues with large objects in arrays
127
+ "style/array-element-newline": "off",
128
+ // style/max-statements-per-line: Default { max: 1 }
129
+ // Increased to 2 to allow simple statements on same line (e.g., case statements)
130
+ "style/max-statements-per-line": ["error", {
131
+ max: 2
132
+ }],
133
+ // style/function-call-argument-newline: Default varies
134
+ // Set to "consistent" so all arguments are either inline or one-per-line
135
+ "style/function-call-argument-newline": ["error", "consistent"],
136
+ // style/brace-style: Default depends on stylistic preset
137
+ // Set to "1tbs" (one true brace style) with single-line exception
138
+ "style/brace-style": ["error", "1tbs", {
139
+ allowSingleLine: true
140
+ }]
141
+ // Other notable stylistic rules from antfu's config (using your custom config):
142
+ // - indent: 4 (default: 2)
143
+ // - quotes: "double" (default: "single")
144
+ // - semi: true (default: false)
145
+ // - style/generator-star-spacing: ["error", { after: true, before: false }]
146
+ // - style/yield-star-spacing: ["error", { after: true, before: false }]
147
+ // - antfu/consistent-chaining: "error" (enforces consistent chaining style)
148
+ }
149
+ }).override("antfu/typescript/rules", {
150
+ rules: {
151
+ // ts/no-use-before-define: Default ["error", { classes: false, functions: false, variables: true }]
152
+ // Turned off to allow hoisting and more flexible declaration order
153
+ "ts/no-use-before-define": "off",
154
+ // ts/no-unsafe-declaration-merging: Default not explicitly set (likely "error")
155
+ // Turned off to allow declaration merging patterns (e.g., interface + namespace)
156
+ "ts/no-unsafe-declaration-merging": "off",
157
+ // no-redeclare: Default ["error", { builtinGlobals: false }]
158
+ // Turned off in favor of TypeScript's own redeclaration checks
159
+ "no-redeclare": "off",
160
+ // ts/no-redeclare: Default ["error", { builtinGlobals: false }]
161
+ // Turned off to allow declaration merging (same as general overrides)
162
+ "ts/no-redeclare": "off",
163
+ // ts/no-explicit-any: Default "off" in antfu's config
164
+ // Set to "error" to enforce strict typing and prevent use of "any"
165
+ // This is a critical rule for type safety
166
+ "ts/no-explicit-any": "error",
167
+ // ts/unified-signatures: Default "off" in antfu's config
168
+ // Set to "error" to enforce combining overloaded signatures where possible
169
+ "ts/unified-signatures": "error",
170
+ // ts/no-unused-vars: Default "off" in antfu's typescript config (handled by unused-imports plugin)
171
+ // Reference: https://johnnyreilly.com/typescript-eslint-no-unused-vars
172
+ // Configured with strict underscore-prefix ignore pattern for intentionally unused variables
173
+ "ts/no-unused-vars": [
174
+ "error",
175
+ {
176
+ args: "all",
177
+ // Check all arguments (default: "after-used")
178
+ argsIgnorePattern: "^_",
179
+ // Allow _unused arguments
180
+ caughtErrors: "all",
181
+ // Check caught errors (default: "none")
182
+ caughtErrorsIgnorePattern: "^_",
183
+ // Allow _error in catch blocks
184
+ destructuredArrayIgnorePattern: "^_",
185
+ // Allow [_skip, value] patterns
186
+ varsIgnorePattern: "^_",
187
+ // Allow _unusedVar
188
+ ignoreRestSiblings: true
189
+ // Allow const { removed, ...rest } patterns
190
+ }
191
+ ]
192
+ // Other important TypeScript rules from antfu's config (for reference):
193
+ // - ts/ban-ts-comment: ["error", { "ts-expect-error": "allow-with-description" }]
194
+ // - ts/consistent-type-definitions: ["error", "interface"] (you override to "off")
195
+ // - ts/consistent-type-imports: ["error", { disallowTypeAnnotations: false, fixStyle: "separate-type-imports", prefer: "type-imports" }]
196
+ // - ts/method-signature-style: ["error", "property"] (prefer property syntax)
197
+ // - ts/no-dupe-class-members: "error"
198
+ // - ts/no-dynamic-delete: "off"
199
+ // - ts/no-empty-object-type: ["error", { allowInterfaces: "always" }]
200
+ // - ts/no-import-type-side-effects: "error"
201
+ // - ts/no-invalid-void-type: "off"
202
+ // - ts/no-non-null-assertion: "off"
203
+ // - ts/no-require-imports: "error"
204
+ // - ts/no-unused-expressions: ["error", { allowShortCircuit: true, allowTaggedTemplates: true, allowTernary: true }]
205
+ // - ts/no-useless-constructor: "off"
206
+ // - ts/no-wrapper-object-types: "error"
207
+ // - ts/triple-slash-reference: "off"
208
+ // ========================================
209
+ // Notable rules you might want to consider:
210
+ // ========================================
211
+ //
212
+ // Type-aware rules (require tsconfigPath):
213
+ // - ts/await-thenable: "error" - Only await thenables
214
+ // - ts/no-floating-promises: "error" - Promises must be handled
215
+ // - ts/no-misused-promises: "error" - Prevent common promise mistakes
216
+ // - ts/no-unnecessary-type-assertion: "error" - Remove redundant assertions
217
+ // - ts/no-unsafe-argument: "error" - Prevent any in function arguments
218
+ // - ts/no-unsafe-assignment: "error" - Prevent assigning any to typed variables
219
+ // - ts/no-unsafe-call: "error" - Prevent calling any as function
220
+ // - ts/no-unsafe-member-access: "error" - Prevent accessing properties of any
221
+ // - ts/no-unsafe-return: "error" - Prevent returning any from typed functions
222
+ // - ts/strict-boolean-expressions: "error" - Strict boolean checks in conditions
223
+ // - ts/switch-exhaustiveness-check: "error" - Ensure all cases handled in switch
224
+ //
225
+ // Naming conventions:
226
+ // - ts/naming-convention: Configure consistent naming patterns
227
+ //
228
+ // Import organization:
229
+ // - ts/consistent-type-imports: ["error", { prefer: "type-imports" }] (already enabled in antfu)
230
+ // - perfectionist/sort-imports: "error" (available in antfu's perfectionist config)
231
+ //
232
+ // Code quality:
233
+ // - complexity: ["error", 10] - Limit cyclomatic complexity
234
+ // - max-depth: ["error", 4] - Limit nesting depth
235
+ // - max-nested-callbacks: ["error", 3] - Limit callback nesting
236
+ }
237
+ });
238
+ }
239
+
240
+ export { eslint_config as default, ignores };
241
+ //# sourceMappingURL=eslint.config.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eslint.config.mjs","sources":["../src/eslint.config.ts"],"sourcesContent":["/**\n * ESLint Configuration based on @antfu/eslint-config\n *\n * This configuration extends Anthony Fu's ESLint config with custom overrides for:\n * - Stylistic preferences (4-space indent, double quotes, semicolons)\n * - Type safety (strict any prevention)\n * - Flexible code organization (allow declaration merging, hoisting)\n * - Custom plugins (rad rules, no-barrel-files)\n *\n * Structure:\n * 1. Base config with stylistic preferences\n * 2. Custom plugin rules\n * 3. General rule overrides\n * 4. Unicorn plugin overrides\n * 5. Stylistic rule overrides\n * 6. TypeScript rule overrides\n *\n * Reference: https://github.com/antfu/eslint-config\n */\n\nimport radPlguins from \"@adddog/eslint-plugin-rules\";\nimport antfu from \"@antfu/eslint-config\";\n\nimport eslintPluginNoBarrelFiles from \"eslint-plugin-no-barrel-files\";\n\nexport const ignores = [\"**/build/**\", \"**/dist/**\", \"README.md\", \"package.json\", \"**/dev-dist/**\", \"**.js\", \"**.vscode/.settings.json\", \"**/node_modules/**\", \"*.html\"];\n\nexport default function (options?: Parameters<typeof antfu>[0] & { ignores?: string[] }, ...userConfigs: Parameters<typeof antfu>[1][]): ReturnType<typeof antfu> {\n return antfu(\n {\n stylistic: {\n indent: 4,\n quotes: \"double\",\n semi: true,\n },\n formatters: { css: true, xml: false },\n react: false,\n jsx: false,\n markdown: false,\n // TypeScript and Vue are auto-detected, you can also explicitly enable them:\n typescript: true,\n ignores: [...ignores, ...(options?.ignores || [])],\n // Disable jsonc and yaml support\n jsonc: false,\n yaml: false,\n vue: false,\n ...options,\n },\n {\n files: [\"**/*.ts\"],\n plugins: {\n \"rad\": radPlguins,\n \"no-barrel-files\": eslintPluginNoBarrelFiles,\n },\n rules: {\n \"rad/no-incorrect-pkg-imports\": \"error\",\n \"no-barrel-files/no-barrel-files\": \"error\",\n },\n },\n // ========================================\n // General overrides\n // ========================================\n {\n rules: {\n // ---- Core ESLint Rules ----\n\n // max-len: Not part of antfu's config by default (would need separate plugin)\n // Turned off to avoid line length restrictions\n \"max-len\": \"off\",\n\n // curly: Not enforced by default in antfu's config\n // Turned off to allow single-line if statements without braces\n \"curly\": \"off\",\n\n // func-style: Not enforced by default\n // Turned off to allow both function declarations and expressions\n \"func-style\": \"off\",\n\n // antfu/curly: Default \"error\" (enforces curly braces with specific style)\n // Turned off to be less opinionated about brace style\n \"antfu/curly\": \"off\",\n\n // accessor-pairs: Default [\"error\", { enforceForClassMembers: true, setWithoutGet: true }]\n // Turned off to allow getters without corresponding setters\n \"accessor-pairs\": \"off\",\n\n // antfu/if-newline: Default \"error\" (enforces newline after if statement)\n // Turned off for more flexible if statement formatting\n \"antfu/if-newline\": \"off\",\n\n // antfu/consistent-list-newline: Default \"error\" (enforces consistent newlines in arrays/objects)\n // Turned off to allow mixed single-line and multi-line arrays/objects\n \"antfu/consistent-list-newline\": \"off\",\n\n // ---- TypeScript Rules ----\n\n // ts/consistent-type-definitions: Default [\"error\", \"interface\"]\n // Turned off to allow both \"interface\" and \"type\" for type definitions\n \"ts/consistent-type-definitions\": \"off\",\n\n // ts/no-redeclare: Default [\"error\", { builtinGlobals: false }]\n // Turned off to allow declaration merging (interfaces, namespaces)\n \"ts/no-redeclare\": \"off\",\n\n // ts/no-unused-expressions: Default [\"error\", { allowShortCircuit: true, allowTaggedTemplates: true, allowTernary: true }]\n // Turned off to allow expressions like optional chaining that may not have side effects\n \"ts/no-unused-expressions\": \"off\",\n\n // ts/no-explicit-any: Default \"off\" in antfu's config\n // Set to \"error\" to enforce strict typing and prevent use of \"any\"\n \"ts/no-explicit-any\": \"error\",\n\n // prefer-arrow-callback: Default [\"error\", { allowNamedFunctions: false, allowUnboundThis: true }]\n // Modified to allow named function expressions in callbacks for better stack traces\n \"prefer-arrow-callback\": [\n \"error\",\n {\n allowNamedFunctions: true, // Changed from false\n allowUnboundThis: true,\n },\n ],\n },\n },\n ...userConfigs,\n )\n // ========================================\n // Unicorn plugin overrides\n // ========================================\n .override(\"antfu/unicorn/rules\", {\n rules: {\n // unicorn/no-new-array: Default \"error\" (enforces array literals over new Array())\n // Turned off to allow new Array(length) for creating arrays with specific length\n \"unicorn/no-new-array\": \"off\",\n\n // Other unicorn rules enabled by default in antfu's config (for reference):\n // - unicorn/consistent-empty-array-spread: \"error\"\n // - unicorn/error-message: \"error\" (require error messages)\n // - unicorn/escape-case: \"error\" (enforce uppercase hex escapes)\n // - unicorn/new-for-builtins: \"error\" (enforce new for builtins)\n // - unicorn/no-instanceof-builtins: \"error\"\n // - unicorn/no-new-buffer: \"error\" (use Buffer.from/Buffer.alloc)\n // - unicorn/number-literal-case: \"error\" (enforce lowercase for number literals)\n // - unicorn/prefer-dom-node-text-content: \"error\"\n // - unicorn/prefer-includes: \"error\" (prefer includes over indexOf)\n // - unicorn/prefer-node-protocol: \"error\" (enforce node: protocol)\n // - unicorn/prefer-number-properties: \"error\" (prefer Number.isNaN over isNaN)\n // - unicorn/prefer-string-starts-ends-with: \"error\"\n // - unicorn/prefer-type-error: \"error\"\n // - unicorn/throw-new-error: \"error\" (require new when throwing errors)\n },\n })\n // ========================================\n // Stylistic overrides\n // ========================================\n .override(\"antfu/stylistic/rules\", {\n rules: {\n // antfu/top-level-function: Default \"error\" (enforces function declarations at top level)\n // Reference: https://github.com/antfu/eslint-config/blob/main/src/configs/stylistic.ts#L61\n // Turned off to allow const/arrow functions at top level\n \"antfu/top-level-function\": \"off\",\n\n // style/arrow-parens: Default depends on stylistic config\n // Set to \"as-needed\" to only require parens when necessary (multiple params, etc)\n \"style/arrow-parens\": [\"error\", \"as-needed\"],\n\n // style/operator-linebreak: Default enforces operators at end/beginning of line\n // Turned off for flexible operator placement in multi-line expressions\n \"style/operator-linebreak\": \"off\",\n\n // style/array-element-newline: Default \"off\" in antfu's config\n // Reference: https://eslint.style/rules/default/array-element-newline\n // Kept off because it causes issues with large objects in arrays\n \"style/array-element-newline\": \"off\",\n\n // style/max-statements-per-line: Default { max: 1 }\n // Increased to 2 to allow simple statements on same line (e.g., case statements)\n \"style/max-statements-per-line\": [\"error\", {\n max: 2,\n }],\n\n // style/function-call-argument-newline: Default varies\n // Set to \"consistent\" so all arguments are either inline or one-per-line\n \"style/function-call-argument-newline\": [\"error\", \"consistent\"],\n\n // style/brace-style: Default depends on stylistic preset\n // Set to \"1tbs\" (one true brace style) with single-line exception\n \"style/brace-style\": [\"error\", \"1tbs\", {\n allowSingleLine: true,\n }],\n\n // Other notable stylistic rules from antfu's config (using your custom config):\n // - indent: 4 (default: 2)\n // - quotes: \"double\" (default: \"single\")\n // - semi: true (default: false)\n // - style/generator-star-spacing: [\"error\", { after: true, before: false }]\n // - style/yield-star-spacing: [\"error\", { after: true, before: false }]\n // - antfu/consistent-chaining: \"error\" (enforces consistent chaining style)\n },\n })\n // ========================================\n // TypeScript-specific overrides\n // ========================================\n // Rules are scoped to names\n // Reference: https://github.com/antfu/eslint-config/blob/93c9e772faf45295a4deb2633a4655954da74491/src/configs/typescript.ts#L110\n .override(\"antfu/typescript/rules\", {\n rules: {\n // ts/no-use-before-define: Default [\"error\", { classes: false, functions: false, variables: true }]\n // Turned off to allow hoisting and more flexible declaration order\n \"ts/no-use-before-define\": \"off\",\n\n // ts/no-unsafe-declaration-merging: Default not explicitly set (likely \"error\")\n // Turned off to allow declaration merging patterns (e.g., interface + namespace)\n \"ts/no-unsafe-declaration-merging\": \"off\",\n\n // no-redeclare: Default [\"error\", { builtinGlobals: false }]\n // Turned off in favor of TypeScript's own redeclaration checks\n \"no-redeclare\": \"off\",\n\n // ts/no-redeclare: Default [\"error\", { builtinGlobals: false }]\n // Turned off to allow declaration merging (same as general overrides)\n \"ts/no-redeclare\": \"off\",\n\n // ts/no-explicit-any: Default \"off\" in antfu's config\n // Set to \"error\" to enforce strict typing and prevent use of \"any\"\n // This is a critical rule for type safety\n \"ts/no-explicit-any\": \"error\",\n\n // ts/unified-signatures: Default \"off\" in antfu's config\n // Set to \"error\" to enforce combining overloaded signatures where possible\n \"ts/unified-signatures\": \"error\",\n\n // ts/no-unused-vars: Default \"off\" in antfu's typescript config (handled by unused-imports plugin)\n // Reference: https://johnnyreilly.com/typescript-eslint-no-unused-vars\n // Configured with strict underscore-prefix ignore pattern for intentionally unused variables\n \"ts/no-unused-vars\": [\n \"error\",\n {\n args: \"all\", // Check all arguments (default: \"after-used\")\n argsIgnorePattern: \"^_\", // Allow _unused arguments\n caughtErrors: \"all\", // Check caught errors (default: \"none\")\n caughtErrorsIgnorePattern: \"^_\", // Allow _error in catch blocks\n destructuredArrayIgnorePattern: \"^_\", // Allow [_skip, value] patterns\n varsIgnorePattern: \"^_\", // Allow _unusedVar\n ignoreRestSiblings: true, // Allow const { removed, ...rest } patterns\n },\n ],\n\n // Other important TypeScript rules from antfu's config (for reference):\n // - ts/ban-ts-comment: [\"error\", { \"ts-expect-error\": \"allow-with-description\" }]\n // - ts/consistent-type-definitions: [\"error\", \"interface\"] (you override to \"off\")\n // - ts/consistent-type-imports: [\"error\", { disallowTypeAnnotations: false, fixStyle: \"separate-type-imports\", prefer: \"type-imports\" }]\n // - ts/method-signature-style: [\"error\", \"property\"] (prefer property syntax)\n // - ts/no-dupe-class-members: \"error\"\n // - ts/no-dynamic-delete: \"off\"\n // - ts/no-empty-object-type: [\"error\", { allowInterfaces: \"always\" }]\n // - ts/no-import-type-side-effects: \"error\"\n // - ts/no-invalid-void-type: \"off\"\n // - ts/no-non-null-assertion: \"off\"\n // - ts/no-require-imports: \"error\"\n // - ts/no-unused-expressions: [\"error\", { allowShortCircuit: true, allowTaggedTemplates: true, allowTernary: true }]\n // - ts/no-useless-constructor: \"off\"\n // - ts/no-wrapper-object-types: \"error\"\n // - ts/triple-slash-reference: \"off\"\n\n // ========================================\n // Notable rules you might want to consider:\n // ========================================\n //\n // Type-aware rules (require tsconfigPath):\n // - ts/await-thenable: \"error\" - Only await thenables\n // - ts/no-floating-promises: \"error\" - Promises must be handled\n // - ts/no-misused-promises: \"error\" - Prevent common promise mistakes\n // - ts/no-unnecessary-type-assertion: \"error\" - Remove redundant assertions\n // - ts/no-unsafe-argument: \"error\" - Prevent any in function arguments\n // - ts/no-unsafe-assignment: \"error\" - Prevent assigning any to typed variables\n // - ts/no-unsafe-call: \"error\" - Prevent calling any as function\n // - ts/no-unsafe-member-access: \"error\" - Prevent accessing properties of any\n // - ts/no-unsafe-return: \"error\" - Prevent returning any from typed functions\n // - ts/strict-boolean-expressions: \"error\" - Strict boolean checks in conditions\n // - ts/switch-exhaustiveness-check: \"error\" - Ensure all cases handled in switch\n //\n // Naming conventions:\n // - ts/naming-convention: Configure consistent naming patterns\n //\n // Import organization:\n // - ts/consistent-type-imports: [\"error\", { prefer: \"type-imports\" }] (already enabled in antfu)\n // - perfectionist/sort-imports: \"error\" (available in antfu's perfectionist config)\n //\n // Code quality:\n // - complexity: [\"error\", 10] - Limit cyclomatic complexity\n // - max-depth: [\"error\", 4] - Limit nesting depth\n // - max-nested-callbacks: [\"error\", 3] - Limit callback nesting\n },\n });\n}\n"],"names":[],"mappings":";;;;AAyBO,MAAM,OAAA,GAAU,CAAC,aAAA,EAAe,YAAA,EAAc,WAAA,EAAa,gBAAgB,gBAAA,EAAkB,OAAA,EAAS,0BAAA,EAA4B,oBAAA,EAAsB,QAAQ;AAEvK,sBAAA,CAAyB,YAAmE,WAAA,EAAsE;AAC9J,EAAA,OAAO,KAAA;AAAA,IACH;AAAA,MACI,SAAA,EAAW;AAAA,QACP,MAAA,EAAQ,CAAA;AAAA,QACR,MAAA,EAAQ,QAAA;AAAA,QACR,IAAA,EAAM;AAAA,OACV;AAAA,MACA,UAAA,EAAY,EAAE,GAAA,EAAK,IAAA,EAAM,KAAK,KAAA,EAAM;AAAA,MACpC,KAAA,EAAO,KAAA;AAAA,MACP,GAAA,EAAK,KAAA;AAAA,MACL,QAAA,EAAU,KAAA;AAAA;AAAA,MAEV,UAAA,EAAY,IAAA;AAAA,MACZ,OAAA,EAAS,CAAC,GAAG,OAAA,EAAS,GAAI,OAAA,EAAS,OAAA,IAAW,EAAG,CAAA;AAAA;AAAA,MAEjD,KAAA,EAAO,KAAA;AAAA,MACP,IAAA,EAAM,KAAA;AAAA,MACN,GAAA,EAAK,KAAA;AAAA,MACL,GAAG;AAAA,KACP;AAAA,IACA;AAAA,MACI,KAAA,EAAO,CAAC,SAAS,CAAA;AAAA,MACjB,OAAA,EAAS;AAAA,QACL,KAAA,EAAO,UAAA;AAAA,QACP,iBAAA,EAAmB;AAAA,OACvB;AAAA,MACA,KAAA,EAAO;AAAA,QACH,8BAAA,EAAgC,OAAA;AAAA,QAChC,iCAAA,EAAmC;AAAA;AACvC,KACJ;AAAA;AAAA;AAAA;AAAA,IAIA;AAAA,MACI,KAAA,EAAO;AAAA;AAAA;AAAA;AAAA,QAKH,SAAA,EAAW,KAAA;AAAA;AAAA;AAAA,QAIX,OAAA,EAAS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 "version": "0.0.6",
4
+ "type": "module",
5
+ "homepage": "https://github.com/samelie/eslint#readme",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/samelie/eslint.git"
9
+ },
10
+ "bugs": {
11
+ "url": "https://github.com/samelie/eslint/issues"
12
+ },
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/eslint.config.d.ts",
16
+ "import": "./dist/eslint.config.mjs",
17
+ "require": "./dist/eslint.config.cjs"
18
+ }
19
+ },
20
+ "main": "./dist/eslint.config.mjs",
21
+ "module": "./dist/eslint.config.mjs",
22
+ "types": "./dist/eslint.config.d.ts",
23
+ "files": [
24
+ "dist"
25
+ ],
26
+ "scripts": {
27
+ "build": "unbuild",
28
+ "lint": "eslint .",
29
+ "lint:fix": "eslint --fix .",
30
+ "types": "tsc -p tsconfig.typecheck.json",
31
+ "release": "bumpp --yes --no-push --release patch",
32
+ "prepublishOnly": "pnpm run lint && pnpm run types && pnpm run build",
33
+ "prepack": "pnpm run prepublishOnly",
34
+ "knip": "knip"
35
+ },
36
+ "dependencies": {
37
+ "@adddog/eslint-plugin-rules": "^0.0.10",
38
+ "eslint-plugin-no-barrel-files": "^1.2.2",
39
+ "@antfu/eslint-config": "^5.4.1"
40
+ },
41
+ "devDependencies": {
42
+ "@adddog/build-configs": "^0.0.1",
43
+ "@types/node": "^24.7.2",
44
+ "bumpp": "^10.3.1",
45
+ "eslint": "^9.37.0",
46
+ "eslint-flat-config-utils": "^2.1.4",
47
+ "eslint-plugin-format": "^1.0.2",
48
+ "package-json-type": "^1.0.3",
49
+ "package-up": "^5.0.0",
50
+ "typescript": "^5.9.3",
51
+ "unbuild": "^3.6.1"
52
+ },
53
+ "publishConfig": {
54
+ "access": "public",
55
+ "registry": "https://registry.npmjs.org/"
56
+ },
57
+ "engines": {
58
+ "node": ">= 22",
59
+ "pnpm": ">= 10",
60
+ "npm": ">= 11"
61
+ }
62
+ }