-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
95 lines (93 loc) · 2.78 KB
/
.eslintrc.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
const { resolve } = require('node:path');
const project = resolve(process.cwd(), 'tsconfig.json');
/** @type {import("eslint").Linter.Config} */
module.exports = {
extends: [
'eslint:recommended',
'prettier',
'plugin:prettier/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
],
plugins: ['@typescript-eslint', 'simple-import-sort', 'prettier'],
globals: {
React: true,
JSX: true,
},
env: {
node: true,
},
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
},
settings: {
'import/resolver': {
typescript: {
project,
},
},
},
ignorePatterns: [
// Ignore dotfiles
'.*.js',
'node_modules/',
'dist/',
],
rules: {
complexity: ['error', 10],
'prefer-object-spread': 'error',
'prefer-const': ['error', { destructuring: 'all' }],
'func-names': ['error', 'as-needed'],
'no-new-object': 'error',
'no-eq-null': 'error',
eqeqeq: 'error',
'arrow-body-style': ['warn', 'as-needed'],
curly: ['error', 'all'],
'prefer-arrow-callback': ['error', { allowNamedFunctions: true }],
'prefer-spread': 'error',
'no-duplicate-imports': 'error',
'guard-for-in': 'error',
'no-useless-call': 'error',
'no-useless-return': 'error',
'no-useless-concat': 'error',
'no-eval': 'error',
'no-floating-decimal': 'error',
'default-case': 'error',
'default-case-last': 'error',
'max-statements-per-line': 'error',
'max-params': ['warn', { max: 6 }],
'prettier/prettier': 'error',
'simple-import-sort/imports': [
'error',
{
groups: [['^\\u0000', '^@?\\w', '^[^.]', '^\\.']],
},
],
'simple-import-sort/exports': 'error',
'@typescript-eslint/no-misused-promises': 'off',
'@typescript-eslint/no-shadow': 'error',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-dupe-class-members': 'error',
'@typescript-eslint/no-meaningless-void-operator': 'error',
'@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error',
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'@typescript-eslint/no-useless-empty-export': 'error',
'@typescript-eslint/no-throw-literal': [
'error',
{
// This should ideally be `false`, but it makes rethrowing errors inconvenient. There should be a separate `allowRethrowingUnknown` option.
allowThrowingUnknown: true,
allowThrowingAny: false,
},
],
},
overrides: [
{
files: ['*.test.ts', '*.spec.ts'],
plugins: ['jest'],
},
],
};