forked from zama-ai/fhevm-mocks
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
107 lines (104 loc) · 2.47 KB
/
eslint.config.js
File metadata and controls
107 lines (104 loc) · 2.47 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import { FlatCompat } from "@eslint/eslintrc";
import eslint from "@eslint/js";
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import tsParser from "@typescript-eslint/parser";
import globals from "globals";
import path from "node:path";
import { fileURLToPath } from "node:url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: eslint.configs.recommended,
allConfig: eslint.configs.all,
});
const config = [
// 0
{
ignores: ["src/_types/*", "src/_cjs/*", "src/_esm/*", "coverage/*"],
},
// 1
...compat.extends("eslint:recommended", "prettier"),
// 2
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
...globals.mocha,
artifacts: "readonly",
contract: "readonly",
web3: "readonly",
extendEnvironment: "readonly",
expect: "readonly",
},
},
},
// 3
...compat
.extends(
"eslint:recommended",
"plugin:@typescript-eslint/strict",
"plugin:@typescript-eslint/strict-type-checked",
"prettier",
)
.map((config) => ({
...config,
files: ["**/*.ts"],
ignores: ["./dist/**/*.js", "./typechain-types/*"],
rules: {
"@typescript-eslint/no-floating-promises": "error",
},
})),
// 4
{
files: ["**/*.ts"],
ignores: [
"./dist/**/*.js",
"src/_types/**/*.js",
"src/_esm/**/*.js",
"src/_cjs/**/*.js",
"./tmp/*",
"./coverage/*",
],
plugins: {
"@typescript-eslint": typescriptEslint,
},
languageOptions: {
parser: tsParser,
parserOptions: {
project: "./tsconfig.json",
tsconfigRootDir: __dirname,
},
ecmaVersion: "latest",
sourceType: "module",
},
rules: {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
vars: "all",
args: "after-used",
ignoreRestSiblings: true,
varsIgnorePattern: "^_",
argsIgnorePattern: "^_",
},
],
},
},
// 5 - Forbid "Buffer"
{
files: ["./src/**/*.{js,ts,tsx}"],
rules: {
"no-restricted-globals": [
"error",
{
name: "Buffer",
message: "Avoid using Buffer in internal/libs. Use a custom abstraction if needed.",
},
],
},
},
];
export default config;