-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.js
54 lines (52 loc) · 1.69 KB
/
eslint.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import pluginJs from '@eslint/js'
import tseslint from '@typescript-eslint/eslint-plugin'
import tsParser from '@typescript-eslint/parser'
import prettier from 'eslint-config-prettier'
import globals from 'globals'
export default [
{
files: ['**/*.{ts,tsx}'],
languageOptions: {
globals: { ...globals.browser, ...globals.node },
parser: tsParser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: './tsconfig.json',
},
},
plugins: {
'@typescript-eslint': tseslint,
},
rules: {
...pluginJs.configs.recommended.rules,
...tseslint.configs.recommended.rules,
// Custom rules
'no-debugger': 'warn',
eqeqeq: ['error', 'always'], // Require === and !==
curly: ['error', 'all'], // Require curly braces for all control statements
'no-implicit-coercion': 'error', // Disallow shorthand type conversions
'no-var': 'error', // Disallow var
'prefer-const': 'error', // Prefer const
// TypeScript rules
'@typescript-eslint/no-unused-vars': [
'warn',
{ argsIgnorePattern: '^_' },
], // Warn on unused variables, except for variables starting with _
'@typescript-eslint/no-explicit-any': 'warn', // Disallow explicit any
'@typescript-eslint/ban-ts-comment': 'warn', // Disallow @ts-ignore comments
'@typescript-eslint/consistent-type-imports': 'error', // Require consistent import of types
},
ignores: [
'node_modules',
'dist',
'build',
'.pnp.*',
'.yarn',
'.vscode',
'.wrangler',
'*.md',
],
},
prettier, // Prettier Config, disable all rules that conflict with Prettier
]