Skip to content

Commit 14bf482

Browse files
committed
chore: update eslint config
1 parent 55e9465 commit 14bf482

File tree

5 files changed

+473
-414
lines changed

5 files changed

+473
-414
lines changed

.eslintignore

-9
This file was deleted.

.eslintrc

-60
This file was deleted.

eslint.config.mjs

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
// eslint-disable-next-line strict
2+
import mocha from "eslint-plugin-mocha";
3+
import globals from "globals";
4+
import tsParser from "@typescript-eslint/parser";
5+
import path from "node:path";
6+
import {fileURLToPath} from "node:url";
7+
import js from "@eslint/js";
8+
import {FlatCompat} from "@eslint/eslintrc";
9+
10+
const __filename = fileURLToPath(import.meta.url);
11+
const __dirname = path.dirname(__filename);
12+
const compat = new FlatCompat({
13+
baseDirectory: __dirname,
14+
recommendedConfig: js.configs.recommended,
15+
allConfig: js.configs.all,
16+
});
17+
18+
export default [{
19+
files: ["**/*.ts", "**/*.tsx"],
20+
ignores: [
21+
"**/node_modules",
22+
"**/.eslintrc*",
23+
"**/artifacts",
24+
"**/cache",
25+
"**/constants",
26+
"**/coverage",
27+
"lib/murky",
28+
"lib/openzeppelin-contracts",
29+
"typechain-types/*",
30+
],
31+
}, ...compat.extends("standard"), {
32+
plugins: {
33+
mocha,
34+
},
35+
36+
languageOptions: {
37+
globals: {
38+
...globals.browser,
39+
...globals.node,
40+
...globals.mocha,
41+
...globals.jest,
42+
artifacts: false,
43+
contract: false,
44+
assert: false,
45+
web3: false,
46+
usePlugin: false,
47+
extendEnvironment: false,
48+
},
49+
50+
parser: tsParser,
51+
ecmaVersion: 2020,
52+
sourceType: "commonjs",
53+
},
54+
55+
rules: {
56+
strict: ["error", "global"],
57+
"array-bracket-spacing": ["off"],
58+
59+
camelcase: ["error", {
60+
properties: "always",
61+
}],
62+
63+
"comma-dangle": ["error", "always-multiline"],
64+
65+
"comma-spacing": ["error", {
66+
before: false,
67+
after: true,
68+
}],
69+
70+
"dot-notation": ["error", {
71+
allowKeywords: true,
72+
allowPattern: "",
73+
}],
74+
75+
"eol-last": ["error", "always"],
76+
eqeqeq: ["error", "smart"],
77+
"generator-star-spacing": ["error", "before"],
78+
indent: ["error", 2],
79+
"linebreak-style": ["error", "unix"],
80+
"max-len": ["error", 120, 2],
81+
"no-debugger": "off",
82+
"no-dupe-args": "error",
83+
"no-dupe-keys": "error",
84+
"no-mixed-spaces-and-tabs": ["error", "smart-tabs"],
85+
86+
"no-redeclare": ["error", {
87+
builtinGlobals: true,
88+
}],
89+
90+
"no-trailing-spaces": ["error", {
91+
skipBlankLines: false,
92+
}],
93+
94+
"no-undef": "error",
95+
"no-use-before-define": "off",
96+
"no-var": "error",
97+
"object-curly-spacing": "off",
98+
"prefer-const": "error",
99+
quotes: "off",
100+
semi: ["error", "always"],
101+
"space-before-function-paren": "off",
102+
"mocha/no-exclusive-tests": ["error"],
103+
"promise/always-return": "off",
104+
"promise/avoid-new": "off",
105+
},
106+
}];

package.json

+9-5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"contract",
1212
"solidity"
1313
],
14+
"type": "module",
1415
"engines": {
1516
"node": ">=20.0.0",
1617
"pnpm": ">=9.5.0"
@@ -22,6 +23,8 @@
2223
"devDependencies": {
2324
"@commitlint/cli": "^19.4.0",
2425
"@commitlint/config-conventional": "^19.2.2",
26+
"@eslint/eslintrc": "^3.1.0",
27+
"@eslint/js": "^9.8.0",
2528
"@metamask/eth-sig-util": "^7.0.3",
2629
"@nomicfoundation/hardhat-chai-matchers": "^2.0.7",
2730
"@nomicfoundation/hardhat-ethers": "^3.0.6",
@@ -52,6 +55,7 @@
5255
"eslint-plugin-promise": "^6.6.0",
5356
"ethers": "^6.13.2",
5457
"fs-extra": "^11.2.0",
58+
"globals": "^15.9.0",
5559
"hardhat": "^2.22.8",
5660
"hardhat-abi-exporter": "^2.10.1",
5761
"hardhat-contract-sizer": "^2.10.0",
@@ -86,11 +90,11 @@
8690
"abi": "npx hardhat export-abi",
8791
"coverage": "npx hardhat coverage",
8892
"size": "npx hardhat size-contracts",
89-
"lint": "pnpm lint:sol && pnpm lint:ts && pnpm format:check",
90-
"lint:sol": "solhint --max-warnings 0 contracts/**/*.sol",
91-
"lint:ts": "eslint --ext .js,.ts .",
92-
"format:check": "prettier --check **/*.{js,ts,sol,json}",
93-
"format:write": "prettier --write **/*.{js,ts,sol,json}"
93+
"lint": "pnpm solhint && pnpm eslint && pnpm format:check",
94+
"solhint": "solhint --max-warnings 0 contracts/**/*.sol",
95+
"eslint": "eslint",
96+
"format:check": "prettier --check **/*.{ts,sol}",
97+
"format:write": "prettier --write **/*.{ts,sol}"
9498
},
9599
"dependencies": {
96100
"cross-env": "^7.0.3",

0 commit comments

Comments
 (0)