Skip to content

Commit

Permalink
chore: update eslint config
Browse files Browse the repository at this point in the history
  • Loading branch information
lingcoder committed Aug 8, 2024
1 parent 55e9465 commit dbfb97c
Show file tree
Hide file tree
Showing 5 changed files with 170 additions and 74 deletions.
9 changes: 0 additions & 9 deletions .eslintignore

This file was deleted.

60 changes: 0 additions & 60 deletions .eslintrc

This file was deleted.

106 changes: 106 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
// eslint-disable-next-line strict
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 [{
files: ["**/*.ts", "**/*.tsx"],
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": "off",
"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",
},
}];
14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"contract",
"solidity"
],
"type": "module",
"engines": {
"node": ">=20.0.0",
"pnpm": ">=9.5.0"
Expand All @@ -22,6 +23,8 @@
"devDependencies": {
"@commitlint/cli": "^19.4.0",
"@commitlint/config-conventional": "^19.2.2",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.8.0",
"@metamask/eth-sig-util": "^7.0.3",
"@nomicfoundation/hardhat-chai-matchers": "^2.0.7",
"@nomicfoundation/hardhat-ethers": "^3.0.6",
Expand Down Expand Up @@ -52,6 +55,7 @@
"eslint-plugin-promise": "^6.6.0",
"ethers": "^6.13.2",
"fs-extra": "^11.2.0",
"globals": "^15.9.0",
"hardhat": "^2.22.8",
"hardhat-abi-exporter": "^2.10.1",
"hardhat-contract-sizer": "^2.10.0",
Expand Down Expand Up @@ -86,11 +90,11 @@
"abi": "npx hardhat export-abi",
"coverage": "npx hardhat coverage",
"size": "npx hardhat size-contracts",
"lint": "pnpm lint:sol && pnpm lint:ts && pnpm format:check",
"lint:sol": "solhint --max-warnings 0 contracts/**/*.sol",
"lint:ts": "eslint --ext .js,.ts .",
"format:check": "prettier --check **/*.{js,ts,sol,json}",
"format:write": "prettier --write **/*.{js,ts,sol,json}"
"lint": "pnpm solhint && pnpm eslint && pnpm format:check",
"solhint": "solhint --max-warnings 0 contracts/**/*.sol",
"eslint": "eslint",
"format:check": "prettier --check **/*.{ts,sol}",
"format:write": "prettier --write **/*.{ts,sol}"
},
"dependencies": {
"cross-env": "^7.0.3",
Expand Down
55 changes: 55 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit dbfb97c

Please sign in to comment.