-
Notifications
You must be signed in to change notification settings - Fork 391
Expand file tree
/
Copy patheslint.config.js
More file actions
54 lines (52 loc) · 1.92 KB
/
Copy patheslint.config.js
File metadata and controls
54 lines (52 loc) · 1.92 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
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import eslintPrettier from 'eslint-plugin-prettier/recommended';
import eslintUnicorn from 'eslint-plugin-unicorn';
export default tseslint.config(
{ ignores: ['dist', '**/*.{mjs,js}', '*.ts'] },
{ plugins: { unicorn: eslintUnicorn } },
{ languageOptions: { parserOptions: { projectService: true } } },
eslint.configs.recommended,
tseslint.configs.strict,
tseslint.configs.stylistic,
{
rules: {
// Override no-unused-vars to allow unused variables that start with an underscore
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
// Disable the base rule 'no-unused-vars' to avoid conflicts with TypeScript's rule
'no-unused-vars': 'off',
// Only allow Error objects to be thrown
'no-throw-literal': 'error',
// Disable @typescript-eslint/prefer-for-of we have too much for now
'@typescript-eslint/prefer-for-of': 'off',
// Prefer to use Array<T> over T[]
'@typescript-eslint/array-type': ['error', { default: 'generic' }],
// Use interfaces for object type definitions
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
// Don't require curly braces for simple if statements
curly: ['error', 'multi-line'],
// Enforce strict equality checks
eqeqeq: 'error',
// Consistent use of undefined
'unicorn/no-null': 'error',
'@typescript-eslint/no-restricted-types': [
'error',
{
types: {
null: {
message: 'Use undefined instead of null',
fixWith: 'undefined',
},
},
},
],
'@typescript-eslint/no-inferrable-types': 'error',
'no-useless-return': 'error',
'@typescript-eslint/no-redundant-type-constituents': 'error',
},
},
eslintPrettier,
);