-
Notifications
You must be signed in to change notification settings - Fork 110
Expand file tree
/
Copy path.eslintrc.js
More file actions
91 lines (91 loc) · 3.02 KB
/
Copy path.eslintrc.js
File metadata and controls
91 lines (91 loc) · 3.02 KB
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
module.exports = {
env: {
browser: false,
es2021: true,
mocha: true,
node: true,
},
plugins: ["n", "prettier", "@typescript-eslint", "mocha", "chai-expect"],
extends: [
"plugin:prettier/recommended",
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:n/recommended",
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 12,
project: "./tsconfig.eslint.json",
},
rules: {
"prettier/prettier": ["warn"],
indent: 0, // avoid conflict with prettier's indent system
"linebreak-style": ["error", "unix"],
quotes: ["error", "double", { avoidEscape: true }],
semi: ["error", "always"],
curly: ["error", "all"],
"spaced-comment": ["error", "always", { exceptions: ["-", "+"] }],
"no-console": 2,
camelcase: "off",
"@typescript-eslint/camelcase": "off",
"mocha/no-exclusive-tests": "error",
"@typescript-eslint/no-require-imports": "off",
"n/no-missing-import": "off", // TypeScript handles import resolution
"n/no-process-exit": "off",
"n/no-unsupported-features/es-syntax": ["error", { ignores: ["modules"] }],
"@typescript-eslint/no-explicit-any": "error",
// Disable warnings for { a, b, ...rest } variables, since this is typically used to remove variables.
"@typescript-eslint/no-unused-vars": [
"error",
{ ignoreRestSiblings: true, argsIgnorePattern: "^_", caughtErrorsIgnorePattern: "^_" },
],
"chai-expect/missing-assertion": 2,
"no-duplicate-imports": "error",
"@typescript-eslint/no-floating-promises": ["error"],
"@typescript-eslint/no-misused-promises": ["error"],
"@typescript-eslint/await-thenable": ["error"],
"@typescript-eslint/require-array-sort-compare": ["error"],
"@typescript-eslint/no-unnecessary-type-assertion": ["error"],
"@typescript-eslint/no-non-null-assertion": ["error"],
"@typescript-eslint/no-redundant-type-constituents": ["error"],
"no-restricted-imports": [
"error",
{
patterns: [
{ group: ["@ethersproject/bignumber"], message: "Use 'src/utils/BNUtils' instead" },
{ group: ["hardhat"], message: "Use 'src/utils or 'ethers'' instead" },
],
paths: [
{ name: "ethers", importNames: ["BigNumber"], message: "Use 'src/utils/BNUtils' instead" },
{ name: "ethers", importNames: ["Event"], message: "Use Log from 'src/interfaces/Common' instead" },
],
},
],
},
settings: {
node: {
tryExtensions: [".js", ".ts"],
},
},
overrides: [
{
files: ["scripts/*.ts", "tasks/*.ts", "src/scripts/*.ts"],
rules: {
"no-console": 0,
},
},
{
files: ["test/**/*.ts", "hardhat.config.ts", "tasks/*.ts"],
rules: {
"no-restricted-imports": "off",
},
},
{
files: ["test/**/*.ts"],
rules: {
"@typescript-eslint/no-unused-expressions": "off", // Chai assertions are "unused expressions"
},
},
],
};