forked from zxcvbn-ts/zxcvbn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
126 lines (123 loc) · 2.59 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
const prettierConfig = require('./prettier')
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
extends: [
'airbnb-base',
'plugin:compat/recommended',
'prettier',
'plugin:jest/recommended',
'plugin:@typescript-eslint/eslint-recommended',
],
plugins: ['import', 'prettier', 'jest', '@typescript-eslint'],
settings: {
'import/resolver': {
alias: {
map: [
['~', './'],
['@', './src'],
],
extensions: ['.js', '.ts', '.d.ts'],
},
},
},
rules: {
'arrow-body-style': 'off',
'prettier/prettier': ['error', prettierConfig],
'import/no-extraneous-dependencies': 'off',
'semi': ['error', 'never'],
'no-console': ['error', { allow: ['info', 'warn', 'error'] }],
'max-lines-per-function': [
'error',
{
max: 100,
skipComments: true,
skipBlankLines: true,
},
],
'max-nested-callbacks': ['warn', { max: 3 }],
'max-statements': [
'warn',
{
max: 14,
},
{
ignoreTopLevelFunctions: false,
},
],
'complexity': [
'warn',
{
max: 8,
},
],
'max-depth': [
'warn',
{
max: 4,
},
],
'max-params': [
'warn',
{
max: 3,
},
],
'import/extensions': [
'error',
'always',
{
js: 'never',
ts: 'never',
},
],
// Disabling eslint rule and enabling typescript specific to support TS features
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
},
],
'no-useless-constructor': 'off',
'@typescript-eslint/no-useless-constructor': 'error',
'no-empty-function': 'off',
'@typescript-eslint/no-empty-function': 'error',
'class-methods-use-this': 0,
'prefer-destructuring': [
'error',
{
array: false,
object: true,
},
],
'@typescript-eslint/ban-types': 'error',
},
overrides: [
{
files: ['*.spec.ts', '*.config.ts', '*.config.js', '**/test/**/*.ts'],
rules: {
'max-lines-per-function': 'off',
'max-statements': 'off',
'max-nested-callbacks': 'off',
'complexity': 'off',
'max-params': 'off',
},
},
{
files: [
'./data-scripts/**/*.ts',
'*.spec.ts',
'*.config.ts',
'*.config.js',
'**/test/**/*.ts',
],
rules: {
'import/no-relative-packages': 'off',
},
},
],
env: {
browser: true,
},
}