-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
147 lines (139 loc) · 3.5 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
const { defineConfig } = require('eslint-define-config')
module.exports = defineConfig({
env: {
browser: true,
es6: true,
node: true
},
globals: {
jest: 'readonly'
},
plugins: ['@typescript-eslint', 'prettier'],
extends: [
'eslint:recommended',
'plugin:import/recommended',
'plugin:@typescript-eslint/recommended',
'prettier'
],
settings: {
'import/resolver': {
node: { extensions: ['.js', '.mjs', '.ts', '.d.ts', '.tsx'] }
}
},
overrides: [
{
files: ['**/__tests__/**'],
rules: {
'no-console': 'off'
}
},
{
files: ['*.d.ts'],
rules: {
'import/no-duplicates': 'off'
}
},
{
files: ['*.js'],
rules: {
'@typescript-eslint/no-var-requires': 'off'
}
},
{
files: ['**/*.md/*.js', '**/*.md/*.ts'],
rules: {
'no-console': 'off',
'import/no-unresolved': 'off',
'@typescript-eslint/no-unused-vars': 'off'
}
}
],
rules: {
camelcase: ['error', { properties: 'never' }],
'no-console': ['warn', { allow: ['error'] }],
'no-debugger': 'warn',
'no-constant-condition': ['error', { checkLoops: false }],
'no-restricted-syntax': ['error', 'LabeledStatement', 'WithStatement'],
'no-return-await': 'error',
'no-var': 'error',
'no-empty': ['error', { allowEmptyCatch: true }],
'prefer-const': [
'warn',
{ destructuring: 'all', ignoreReadBeforeAssign: true }
],
'prefer-arrow-callback': [
'error',
{ allowNamedFunctions: false, allowUnboundThis: true }
],
'object-shorthand': [
'error',
'always',
{ ignoreConstructors: false, avoidQuotes: true }
],
'prefer-rest-params': 'error',
'prefer-spread': 'error',
'prefer-template': 'error',
'no-redeclare': 'off',
'@typescript-eslint/no-redeclare': 'error',
// best-practice
'array-callback-return': 'error',
'block-scoped-var': 'error',
'no-alert': 'warn',
'no-case-declarations': 'error',
'no-multi-str': 'error',
'no-with': 'error',
'no-void': 'error',
'sort-imports': [
'warn',
{
ignoreCase: false,
ignoreDeclarationSort: true,
ignoreMemberSort: false,
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
allowSeparatedGroups: false
}
],
// stylistic-issues
'prefer-exponentiation-operator': 'error',
// ts
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
'@typescript-eslint/consistent-type-imports': [
'error',
{ disallowTypeAnnotations: false }
],
// prettier
'prettier/prettier': 'error',
'import/first': 'error',
'import/no-duplicates': 'error',
'import/order': [
'error',
{
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
'object',
'type'
],
pathGroups: [
{
pattern: '@color-utils/**',
group: 'internal'
}
],
pathGroupsExcludedImportTypes: ['type']
}
],
'import/no-unresolved': 'off',
'import/namespace': 'off',
'import/default': 'off',
'import/no-named-as-default': 'off',
'import/no-named-as-default-member': 'off'
}
})