Skip to content

Commit 9307438

Browse files
authored
Merge pull request #37 from AsenaJs/eslint-config
Eslint config
2 parents 1b8bcf0 + 8ba69a0 commit 9307438

File tree

85 files changed

+484
-1099
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+484
-1099
lines changed

.eslintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.eslintrc.js

Lines changed: 0 additions & 38 deletions
This file was deleted.

.prettierignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Dependencies
2+
node_modules/
3+
.changeset/
4+
.claude/
5+
.cursor/
6+
.github/
7+
.idea/
8+
9+
# Build output
10+
dist/
11+
12+
# Logs
13+
*.log
14+
15+
# Coverage
16+
coverage/
17+
18+
# Lock files
19+
bun.lockb
20+
package-lock.json
21+
yarn.lock
22+
pnpm-lock.yaml
23+
24+
*.md

bun.lock

Lines changed: 57 additions & 341 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

eslint.config.cjs

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
// @ts-check
2+
const eslint = require('@eslint/js');
3+
const tseslint = require('typescript-eslint');
4+
const eslintConfigPrettier = require('eslint-config-prettier');
5+
6+
module.exports = tseslint.config(
7+
// ESLint recommended rules
8+
eslint.configs.recommended,
9+
10+
// TypeScript ESLint recommended rules
11+
...tseslint.configs.recommendedTypeChecked,
12+
...tseslint.configs.stylisticTypeChecked,
13+
14+
// Prettier config to disable conflicting rules
15+
eslintConfigPrettier,
16+
17+
// Global ignores
18+
{
19+
ignores: [
20+
'dist/**',
21+
'node_modules/**',
22+
'*.js',
23+
'*.mjs',
24+
'test/**',
25+
'test/**/**',
26+
'**/*.test.ts',
27+
'**/*.spec.ts',
28+
'eslint.config.cjs', // Ignore config file itself
29+
'*.md',
30+
],
31+
},
32+
33+
// Base configuration
34+
{
35+
languageOptions: {
36+
parserOptions: {
37+
projectService: {
38+
allowDefaultProject: ['*.js', '*.mjs', '*.cjs'],
39+
},
40+
tsconfigRootDir: __dirname,
41+
},
42+
},
43+
},
44+
45+
// Custom rules
46+
{
47+
rules: {
48+
// TypeScript rules
49+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
50+
'@typescript-eslint/method-signature-style': 'off',
51+
52+
// Relax some strict TypeScript rules for decorator metadata
53+
'@typescript-eslint/no-unsafe-assignment': 'off',
54+
'@typescript-eslint/no-unsafe-member-access': 'off',
55+
'@typescript-eslint/no-unsafe-call': 'off',
56+
'@typescript-eslint/no-unsafe-return': 'off',
57+
'@typescript-eslint/no-unsafe-argument': 'off',
58+
'@typescript-eslint/no-explicit-any': 'warn',
59+
'@typescript-eslint/no-unsafe-function-type': 'off',
60+
61+
// Allow empty interfaces (common in TypeScript patterns)
62+
'@typescript-eslint/no-empty-interface': 'off',
63+
64+
// Allow require() in specific cases (Bun compatibility)
65+
'@typescript-eslint/no-require-imports': 'off',
66+
67+
// Disable rules that require strictNullChecks (tsconfig has strict: false)
68+
'@typescript-eslint/prefer-nullish-coalescing': 'off',
69+
70+
// Allow any in union types (common in adapter interfaces)
71+
'@typescript-eslint/no-redundant-type-constituents': 'off',
72+
73+
// Allow index signatures (common in dynamic interfaces)
74+
'@typescript-eslint/consistent-indexed-object-style': 'off',
75+
76+
// Allow async functions without await (common in interface implementations)
77+
'@typescript-eslint/require-await': 'off',
78+
79+
// Allow flexible generic constructors
80+
'@typescript-eslint/consistent-generic-constructors': 'off',
81+
},
82+
},
83+
);

lib/adapter/AsenaAdapter.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import type { GlobalMiddlewareRouteConfig } from '../server/config';
1313
* @template VS - Type for the validator schema
1414
*/
1515
export abstract class AsenaAdapter<C extends AsenaContext<any, any>, VS> {
16-
1716
/**
1817
* The name identifier of the adapter
1918
*/
@@ -115,5 +114,4 @@ export abstract class AsenaAdapter<C extends AsenaContext<any, any>, VS> {
115114
* @returns A promise that resolves when the options are set, or void.
116115
*/
117116
public abstract serveOptions(options: () => Promise<AsenaServeOptions> | AsenaServeOptions): Promise<void> | void;
118-
119117
}

lib/adapter/AsenaWebsocketAdapter.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import type { ServerLogger } from '../logger';
1010
* @template A - Type of the Adapter object
1111
*/
1212
export abstract class AsenaWebsocketAdapter {
13-
1413
public readonly name: string;
1514

1615
/**
@@ -103,5 +102,4 @@ export abstract class AsenaWebsocketAdapter {
103102
public set logger(value: ServerLogger) {
104103
this._logger = value;
105104
}
106-
107105
}

lib/adapter/types/ApiParams.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ export interface ApiParams<C extends AsenaContext<any, any> = any, SH = unknown>
4848
export type ControllerHandler<C extends AsenaContext<any, any> = any> = (
4949
c: C,
5050
...args: any[]
51-
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
5251
) => void | Promise<void> | Promise<Response> | Response;
5352

5453
/**

lib/adapter/types/AsenaHandler.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@ import type { AsenaContext } from '../AsenaContext';
22

33
export type AsenaHandler<C extends AsenaContext<any, any> = any> = (
44
context: C,
5-
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
65
) => Promise<void | Response> | (Response | void);

lib/ioc/CircularDependencyDetector.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,17 @@
33
* Provides detailed information about the circular dependency chain
44
*/
55
export class CircularDependencyError extends Error {
6-
76
public constructor(message: string) {
87
super(message);
98
this.name = 'CircularDependencyError';
109
}
11-
1210
}
1311

1412
/**
1513
* @description Detector for circular dependencies in the IoC container
1614
* Tracks the resolution stack and detects cycles during dependency injection
1715
*/
1816
export class CircularDependencyDetector {
19-
2017
private resolutionStack: Set<string> = new Set();
2118

2219
/**
@@ -76,5 +73,4 @@ export class CircularDependencyDetector {
7673
public isEmpty(): boolean {
7774
return this.resolutionStack.size === 0;
7875
}
79-
8076
}

0 commit comments

Comments
 (0)