Skip to content

Commit 6fd5043

Browse files
committed
fix: add component-level eslint configs
1 parent 71dd4db commit 6fd5043

5 files changed

Lines changed: 67 additions & 23 deletions

File tree

.eslintrc.json

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

backend/eslint.config.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import js from '@eslint/js';
2+
import tseslint from 'typescript-eslint';
3+
4+
export default tseslint.config(
5+
{ ignores: ['dist', 'node_modules', '.wrangler', '.drizzle'] },
6+
{
7+
extends: [
8+
js.configs.recommended,
9+
...tseslint.configs.recommended
10+
],
11+
files: ['**/*.ts'],
12+
languageOptions: {
13+
ecmaVersion: 'latest',
14+
sourceType: 'module',
15+
},
16+
rules: {
17+
// Downgrades the 'any' error to a warning to unblock rapid iteration
18+
'@typescript-eslint/no-explicit-any': 'warn',
19+
20+
// Standard quality-of-life adjustments for Cloudflare Workers
21+
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
22+
'@typescript-eslint/explicit-function-return-type': 'off',
23+
},
24+
}
25+
);

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default tseslint.config(
55
eslint.configs.recommended,
66
...tseslint.configs.recommended,
77
{
8-
ignores: ['dist/', 'node_modules/', '.wrangler/', 'worker-configuration.d.ts', '**/*.mjs', '**/*.cjs'],
8+
ignores: ['dist/', 'node_modules/', '.wrangler/', 'worker-configuration.d.ts', '**/*.mjs', '**/*.cjs', 'frontend/'],
99
},
1010
{
1111
languageOptions: {

frontend/eslint.config.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ export default defineConfig([
1818
languageOptions: {
1919
ecmaVersion: 2020,
2020
globals: globals.browser,
21+
parserOptions: {
22+
project: [
23+
'./tsconfig.json',
24+
'./tsconfig.app.json',
25+
'./tsconfig.node.json'
26+
],
27+
tsconfigRootDir: import.meta.dirname,
28+
},
2129
},
2230
},
23-
])
31+
])

tests/eslint.config.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import js from '@eslint/js';
2+
import globals from 'globals';
3+
import tseslint from 'typescript-eslint';
4+
5+
export default tseslint.config(
6+
{ ignores: ['node_modules', '__snapshots__'] },
7+
{
8+
files: ['**/*.ts'],
9+
extends: [
10+
js.configs.recommended,
11+
...tseslint.configs.recommended
12+
],
13+
languageOptions: {
14+
ecmaVersion: 'latest',
15+
sourceType: 'module',
16+
globals: {
17+
...globals.node,
18+
},
19+
parserOptions: {
20+
// Point to the root tsconfig since tests doesn't have its own
21+
project: ['../tsconfig.json'],
22+
tsconfigRootDir: import.meta.dirname,
23+
},
24+
},
25+
rules: {
26+
// Completely disable the 'any' rule for tests to allow easy mocking
27+
'@typescript-eslint/no-explicit-any': 'off',
28+
29+
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
30+
},
31+
}
32+
);

0 commit comments

Comments
 (0)