-
Notifications
You must be signed in to change notification settings - Fork 58
/
eslint.config.js
137 lines (126 loc) · 3.47 KB
/
eslint.config.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
const progress = require('eslint-plugin-progress');
const noOnlyTests = require('eslint-plugin-no-only-tests');
const globals = require('globals');
const tsParser = require('@typescript-eslint/parser');
const js = require('@eslint/js');
const { FlatCompat } = require('@eslint/eslintrc');
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});
module.exports = [
{
ignores: [
'!**/.*',
'!.circleci/test-batch.js',
'.yarn',
'**/coverage',
'**/dist',
'utils/*/utils',
'**/typechain-types',
'**/contracts/routers',
'**/contracts/generated',
'**/test/generated',
'**/artifacts',
'**/subgraph/**/deployments',
'**/subgraph/build',
'**/subgraph/.bin',
'**/storage.dump.json',
'**/storage.new.dump.json',
'markets/legacy-market/contracts/InitialModuleBundle.sol',
'markets/perps-market/contracts/modules/CoreModule.sol',
'markets/spot-market/contracts/modules/CoreModule.sol',
'protocol/governance/contracts/modules/core/InitialModuleBundle.sol',
'protocol/oracle-manager/contracts/modules/CoreModule.sol',
'protocol/synthetix/contracts/modules/common/OwnerModule.sol',
'protocol/synthetix/contracts/modules/common/UpgradeModule.sol',
'protocol/synthetix/contracts/modules/InitialModuleBundle.sol',
'utils/core-modules/contracts/interfaces/IOwnerModule.sol',
'utils/core-modules/contracts/modules/CoreModule.sol',
],
},
...compat.extends('eslint:recommended'),
{
plugins: {
progress,
'no-only-tests': noOnlyTests,
},
languageOptions: {
globals: {
...globals.node,
hre: 'writable',
Proxy: 'readonly',
Promise: 'readonly',
},
ecmaVersion: 12,
sourceType: 'commonjs',
},
rules: {
'progress/enable': 0,
indent: 'off',
'no-only-tests/no-only-tests': 'error',
'linebreak-style': 'off',
quotes: 'off',
semi: 'off',
'no-inner-declarations': 'off',
'max-len': 'off',
},
},
...compat.extends('plugin:@typescript-eslint/recommended').map((config) => ({
...config,
files: ['**/*.ts'],
})),
{
files: ['**/*.ts'],
languageOptions: {
parser: tsParser,
ecmaVersion: 5,
sourceType: 'script',
parserOptions: {
project: ['./tsconfig.eslint.json'],
},
},
rules: {
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-var-requires': 0,
'@typescript-eslint/no-non-null-assertion': 0,
'@typescript-eslint/no-empty-function': 0,
},
},
{
files: [
'./utils/*/test/**/*.{j,t}s',
'./markets/*/test/**/*.{j,t}s',
'./protocol/*/test/**/*.{j,t}s',
'**/*.test.{j,t}s',
'utils/sample-project/test/bootstrap.js',
],
languageOptions: {
globals: {
...globals.mocha,
},
},
},
{
files: [
'protocol/synthetix/subgraph/**/*',
'markets/spot-market/subgraph/**/*',
'markets/perps-market/subgraph/**/*',
],
languageOptions: {
globals: {
i32: true,
i64: true,
assert: true,
},
},
rules: {
'prefer-const': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-array-constructor': 'off',
},
},
];