Skip to content

Commit

Permalink
chore: add linting configuration based on other repos
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyar committed Nov 14, 2022
1 parent 565bbf6 commit ce3cdf0
Show file tree
Hide file tree
Showing 8 changed files with 553 additions and 85 deletions.
4 changes: 4 additions & 0 deletions .eslint-tsconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"include": ["jest.config.js", ".eslintrc.js", "tests", "scenario", "deploy"]
}
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ node_modules
artifacts
cache
coverage
dist
# ignoring scenario dir because it contains deprecated saddle code and will be removed
scenario
typechain
24 changes: 19 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,32 @@ module.exports = {
},
plugins: ["@typescript-eslint"],
extends: [
"standard",
"plugin:prettier/recommended",
"plugin:node/recommended",
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 12,
project: ".eslint-tsconfig",
},
root: true,
rules: {
"node/no-unsupported-features/es-syntax": [
"@typescript-eslint/no-floating-promises": [
"error",
{ ignores: ["modules"] },
{
ignoreIIFE: true,
ignoreVoid: true,
},
],
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "_",
varsIgnorePattern: "_",
},
],
},
};
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
# Hack to get around failing "ethereumjs-abi The remote archive doesn't match the expected checksum" error
run: YARN_CHECKSUM_BEHAVIOR=update yarn

- name: Lint solidity
- name: Check linting of solidity and typescript
run: yarn lint

build:
Expand Down
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ artifacts
cache
coverage*
gasReporterOutput.json
dist
scenario
typechain
contracts/oracle
17 changes: 16 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
{}
arrowParens: avoid
bracketSpacing: true
endOfLine: auto
importOrder: ["<THIRD_PARTY_MODULES>", "^[./]"]
importOrderParserPlugins: ["typescript"]
importOrderSeparation: true
importOrderSortSpecifiers: true
printWidth: 120
singleQuote: false
tabWidth: 2
trailingComma: all

overrides:
- files: "*.sol"
options:
tabWidth: 4
12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@
"hardhat:test": "hardhat test",
"hardhat:compile": "hardhat compile",
"hardhat:coverage": "hardhat coverage",
"lint": "yarn lint:sol",
"lint": "yarn lint:sol && yarn lint:ts && yarn prettier:check",
"lint:sol": "solhint \"contracts/**/*.sol\"",
"lint:sol:fix": "prettier --write \"contracts/**/*.sol\"",
"lint:ts": "eslint --ext .js,.ts .",
"lint:ts:fix": "eslint --fix --ext .js,.ts .",
"prettier": "prettier --write \"**/*.{js,json,md,sol,ts,yaml,yml}\"",
"prettier:check": "prettier --check \"**/*.{js,json,md,sol,ts,yaml,yml}\"",
"build": "rm -rf dist && tsc --declaration && hardhat compile && cp -r ./{package.json,yarn.lock,artifacts,networks,contracts,deployments,copy_contracts.sh} dist/",
"publish:dist": "yarn build && yarn publish dist -f --access public",
"postinstall": "./copy_contracts.sh",
Expand All @@ -45,20 +49,20 @@
"@nomicfoundation/hardhat-toolbox": "^2.0.0",
"@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers",
"@nomiclabs/hardhat-etherscan": "^3.0.3",
"@trivago/prettier-plugin-sort-imports": "^3.4.0",
"@typechain/ethers-v5": "^7.2.0",
"@typechain/hardhat": "^2.3.1",
"@types/chai": "^4.3.1",
"@types/mocha": "^9.1.1",
"@types/node": "^12.20.50",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"@typescript-eslint/eslint-plugin": "^5.27.1",
"@typescript-eslint/parser": "^5.27.1",
"@venusprotocol/oracle": "^1.2.0",
"bignumber.js": "9.0.0",
"chai": "^4.3.6",
"dotenv": "^10.0.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.4.1",
Expand Down
Loading

0 comments on commit ce3cdf0

Please sign in to comment.