-
Notifications
You must be signed in to change notification settings - Fork 302
/
.eslintrc.js
131 lines (120 loc) · 4.16 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
module.exports = {
root: true,
env: {
node: true,
},
extends: [
'eslint:recommended',
'plugin:tailwindcss/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:vue/vue3-recommended',
'plugin:prettier-vue/recommended',
'./.eslintrc-auto-import.json',
],
plugins: ['simple-import-sort', 'tailwindcss'],
parserOptions: {
ecmaVersion: 2020,
parser: '@typescript-eslint/parser',
},
rules: {
'no-console': 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'tailwindcss/no-custom-classname': 'off',
// Require passing prop names in camelCase
'vue/attribute-hyphenation': ['error', 'never'],
// Inserting html is a potential XSS risk. Consider disabling this rule case-by-case basis
'vue/no-v-html': 'off',
// Our component names are already written in PascalCase.
// And for consistency, it's now required too.
'vue/component-name-in-template-casing': ['error', 'PascalCase'],
// Vue recommends multi word component names, so they don't get mixed with
// regular html elements, but many component's names are already single
// word, so had to turn this off.
'vue/multi-word-component-names': 'off',
// Event names are written in kebab-case, as it's in plugin:vue/vue3-recommended.
// This just turns the autofix option on.
'vue/v-on-event-hyphenation': [
'error',
'always',
{
autofix: true,
},
],
// Typescript forces to check optional props for "undefined" values anyway, so this rule is not needed
'vue/require-default-prop': 'off',
'no-restricted-imports': [
'error',
{
patterns: [
{
// Avoid imports using 'ethers/lib/*' because they lead to compilation issues in vite rollup builds
group: ['ethers/lib/*'],
message:
"Please import from '@ethersproject/*' instead to avoid vite rollup build issues",
},
{
group: ['*/lib/balancer.sdk'],
importNames: ['balancer'],
message:
'Please import from src/dependencies to make this dependency more testable',
},
{
group: ['@balancer-labs/sdk'],
importNames: ['PoolsFallbackRepository'],
message:
'Please import from src/dependencies to make this dependency more testable',
},
{
group: ['@/lib/utils/balancer/contract'],
importNames: ['Multicaller'],
message:
'Please import from src/dependencies to make this dependency more testable',
},
{
group: ['@/services/web3/transactions/concerns/contract.concern'],
importNames: ['ContractConcern'],
message:
'Please import from src/dependencies to make this dependency more testable',
},
// {
// group: ['@/services/multicalls/multicaller'],
// importNames: ['Multicaller'],
// message:
// 'Please import from src/dependencies to make this dependency more testable',
// },
{
group: ['@ethersproject/providers'],
importNames: ['Web3Provider'],
message:
'Please import from src/dependencies to make this dependency more testable',
},
{
group: ['@balancer-labs/sdk'],
importNames: ['Network'],
message:
'Please import Network from @/lib/config to avoid adding SDK to bundle',
},
],
},
],
// 'no-empty-function': ['error', { allow: ['arrowFunctions'] }],
},
overrides: [
{
files: ['**/__tests__/*.{j,t}s?(x)', '**/tests/**/*.spec.{j,t}s?(x)'],
env: {
jest: true,
},
},
{
files: ['src/services/api/graphql/generated/**/*.ts'],
rules: {
'@typescript-eslint/no-unused-vars': 'off',
},
},
],
};