-
-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy patheslint.config.js
More file actions
68 lines (63 loc) · 2.16 KB
/
Copy patheslint.config.js
File metadata and controls
68 lines (63 loc) · 2.16 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import js from '@eslint/js';
import tseslint from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
import importPlugin from 'eslint-plugin-import';
export default [
{
files: ['src/**/*.ts'],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: 2022,
sourceType: 'module',
project: './tsconfig.json',
},
},
plugins: {
'@typescript-eslint': tseslint,
'import': importPlugin,
},
rules: {
...js.configs.recommended.rules,
...tseslint.configs.recommended.rules,
// Align with project's TypeScript strict mode
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/explicit-function-return-type': ['warn', {
allowExpressions: true,
allowTypedFunctionExpressions: true,
}],
// Align with code style guidelines
'prefer-const': 'error',
'no-var': 'error',
'semi': ['error', 'always'],
'quotes': ['error', 'single', { avoidEscape: true }],
'indent': ['error', 2, { SwitchCase: 1 }],
'import/order': ['error', {
'groups': ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
'newlines-between': 'always'
}],
'sort-imports': ['error', {
'ignoreDeclarationSort': true
}],
// 'no-undef' duplicates a check TypeScript already enforces, and its
// lexical-only analysis miscalls Node globals like URLSearchParams.
// Per typescript-eslint ("strongly recommend that you do not use the
// no-undef lint rule on TypeScript projects" -
// https://typescript-eslint.io/troubleshooting/faqs/eslint/) and
// ESLint's own 'Handled by TypeScript' note for the rule.
'no-undef': 'off',
// Keep it simple - disable overly strict rules
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
},
},
{
files: ['*.js', '*.mjs'],
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
},
rules: js.configs.recommended.rules,
},
];