Skip to content

Commit

Permalink
migrate eslint config
Browse files Browse the repository at this point in the history
  • Loading branch information
lingcoder committed Jul 18, 2024
1 parent f7dbb75 commit 28c9a96
Show file tree
Hide file tree
Showing 6 changed files with 296 additions and 203 deletions.
9 changes: 0 additions & 9 deletions .eslintignore

This file was deleted.

60 changes: 0 additions & 60 deletions .eslintrc

This file was deleted.

104 changes: 104 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
import mocha from "eslint-plugin-mocha";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [{
ignores: [
"**/node_modules",
"**/.eslintrc*",
"**/artifacts",
"**/cache",
"**/constants",
"**/coverage",
"lib/murky",
"lib/openzeppelin-contracts",
"typechain-types/*",
],
}, ...compat.extends("standard"), {
plugins: {
mocha,
},

languageOptions: {
globals: {
...globals.browser,
...globals.node,
...globals.mocha,
...globals.jest,
artifacts: false,
contract: false,
assert: false,
web3: false,
usePlugin: false,
extendEnvironment: false,
},

parser: tsParser,
ecmaVersion: 2020,
sourceType: "commonjs",
},

rules: {
strict: ["error", "global"],
"array-bracket-spacing": ["off"],

camelcase: ["error", {
properties: "always",
}],

"comma-dangle": ["error", "always-multiline"],

"comma-spacing": ["error", {
before: false,
after: true,
}],

"dot-notation": ["error", {
allowKeywords: true,
allowPattern: "",
}],

"eol-last": ["error", "always"],
eqeqeq: ["error", "smart"],
"generator-star-spacing": ["error", "before"],
indent: ["error", 2],
"linebreak-style": ["error", "unix"],
"max-len": ["error", 120, 2],
"no-debugger": "off",
"no-dupe-args": "error",
"no-dupe-keys": "error",
"no-mixed-spaces-and-tabs": ["error", "smart-tabs"],

"no-redeclare": ["error", {
builtinGlobals: true,
}],

"no-trailing-spaces": ["error", {
skipBlankLines: false,
}],

"no-undef": "error",
"no-use-before-define": "off",
"no-var": "error",
"object-curly-spacing": ["error", "always"],
"prefer-const": "error",
quotes: "off",
semi: ["error", "always"],
"space-before-function-paren": "off",
"mocha/no-exclusive-tests": ["error"],
"promise/always-return": "off",
"promise/avoid-new": "off",
},
}];
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@types/chai": "^4.3.16",
"@types/fs-extra": "^11.0.4",
"@types/mocha": "^10.0.7",
"@types/node": "^20.14.10",
"@types/node": "^20.14.11",
"@typescript-eslint/eslint-plugin": "^7.16.1",
"@typescript-eslint/parser": "^7.16.1",
"eslint": "^8.57.0",
Expand All @@ -47,8 +47,11 @@
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-mocha": "^10.4.3",
"eslint-plugin-n": "^17.9.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-promise": "^6.4.0",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.7.0",
"globals": "^15.8.0",
"ethers": "^6.13.1",
"fs-extra": "^11.2.0",
"hardhat": "^2.22.6",
Expand Down
Loading

0 comments on commit 28c9a96

Please sign in to comment.