Commit 1626cb48 authored by Liam Horne's avatar Liam Horne

build: ensure lint only staged files on commit

parent b7738bf5
#!/bin/sh #!/bin/sh
. "$(dirname "$0")/_/husky.sh" . "$(dirname "$0")/_/husky.sh"
yarn lint:check yarn lerna run --stream pre-commit --since HEAD --exclude-dependents
src/**/*.ts:
- eslint --fix
test/**/*.ts:
- eslint --fix
exec/*.js:
- eslint --fix
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
"lint": "yarn lint:fix && yarn lint:check", "lint": "yarn lint:fix && yarn lint:check",
"lint:fix": "prettier --config .prettierrc.json --write \"hardhat.config.ts\" \"{src,exec,test}/**/*.ts\"", "lint:fix": "prettier --config .prettierrc.json --write \"hardhat.config.ts\" \"{src,exec,test}/**/*.ts\"",
"lint:check": "eslint -c .eslintrc.js --ext .ts --format stylish .", "lint:check": "eslint -c .eslintrc.js --ext .ts --format stylish .",
"test": "hardhat test --show-stack-traces" "test": "hardhat test --show-stack-traces",
"pre-commit": "lint-staged"
}, },
"keywords": [ "keywords": [
"optimism", "optimism",
...@@ -73,6 +74,7 @@ ...@@ -73,6 +74,7 @@
"hardhat": "^2.2.1", "hardhat": "^2.2.1",
"mocha": "^6.1.4", "mocha": "^6.1.4",
"prettier": "^2.2.1", "prettier": "^2.2.1",
"lint-staged": "11.0.0",
"rimraf": "^2.6.3", "rimraf": "^2.6.3",
"sinon": "^9.2.4", "sinon": "^9.2.4",
"sinon-chai": "^3.5.0", "sinon-chai": "^3.5.0",
......
src/**/*.ts:
- eslint --fix
test/**/*.ts:
- eslint --fix
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
"lint": "yarn lint:fix && yarn lint:check", "lint": "yarn lint:fix && yarn lint:check",
"lint:fix": "prettier --config .prettierrc.json --write '{src,test}/**/*.ts'", "lint:fix": "prettier --config .prettierrc.json --write '{src,test}/**/*.ts'",
"lint:check": "eslint -c .eslintrc.js --ext .ts --format stylish .", "lint:check": "eslint -c .eslintrc.js --ext .ts --format stylish .",
"test": "ts-mocha test/*.spec.ts" "test": "ts-mocha test/*.spec.ts",
"pre-commit": "lint-staged"
}, },
"devDependencies": { "devDependencies": {
"@types/chai": "^4.2.18", "@types/chai": "^4.2.18",
......
src/**/*.ts:
- eslint --fix
test/**/*.ts:
- eslint --fix
deploy/*.ts:
- eslint --fix
...@@ -47,7 +47,8 @@ ...@@ -47,7 +47,8 @@
"postpublish": "rimraf OVM iOVM libraries mockOVM", "postpublish": "rimraf OVM iOVM libraries mockOVM",
"prepack": "yarn prepublishOnly", "prepack": "yarn prepublishOnly",
"postpack": "yarn postpublish", "postpack": "yarn postpublish",
"generate-markdown": "node \"./scripts/generate-markdown.js\"" "generate-markdown": "node \"./scripts/generate-markdown.js\"",
"pre-commit": "lint-staged"
}, },
"dependencies": { "dependencies": {
"@eth-optimism/core-utils": "^0.4.6", "@eth-optimism/core-utils": "^0.4.6",
...@@ -102,6 +103,7 @@ ...@@ -102,6 +103,7 @@
"mkdirp": "^1.0.4", "mkdirp": "^1.0.4",
"mocha": "^8.3.0", "mocha": "^8.3.0",
"prettier": "^2.2.1", "prettier": "^2.2.1",
"lint-staged": "11.0.0",
"random-bytes-seed": "^1.0.3", "random-bytes-seed": "^1.0.3",
"rlp": "^2.2.6", "rlp": "^2.2.6",
"solidity-coverage": "^0.7.16", "solidity-coverage": "^0.7.16",
......
src/**/*.ts:
- eslint --fix
test/**/*.ts:
- eslint --fix
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
"lint": "yarn lint:fix && yarn lint:check", "lint": "yarn lint:fix && yarn lint:check",
"lint:fix": "prettier --config .prettierrc.json --write '{src,test}/**/*.ts'", "lint:fix": "prettier --config .prettierrc.json --write '{src,test}/**/*.ts'",
"lint:check": "eslint -c .eslintrc.js --ext .ts --format stylish .", "lint:check": "eslint -c .eslintrc.js --ext .ts --format stylish .",
"test": "ts-mocha test/**/*.spec.ts" "test": "ts-mocha test/**/*.spec.ts",
"pre-commit": "lint-staged"
}, },
"devDependencies": { "devDependencies": {
"@types/chai": "^4.2.17", "@types/chai": "^4.2.17",
...@@ -36,6 +37,7 @@ ...@@ -36,6 +37,7 @@
"eslint-plugin-unicorn": "^32.0.1", "eslint-plugin-unicorn": "^32.0.1",
"mocha": "^8.3.0", "mocha": "^8.3.0",
"prettier": "^2.2.1", "prettier": "^2.2.1",
"lint-staged": "11.0.0",
"ts-mocha": "^8.0.0", "ts-mocha": "^8.0.0",
"typescript": "^4.2.3" "typescript": "^4.2.3"
}, },
......
src/**/*.ts:
- eslint --fix
test/**/*.ts:
- eslint --fix
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
"start": "ts-node ./src/services/run.ts", "start": "ts-node ./src/services/run.ts",
"start:local": "ts-node ./src/services/run.ts | pino-pretty", "start:local": "ts-node ./src/services/run.ts | pino-pretty",
"test": "hardhat --config test/config/hardhat.config.ts test", "test": "hardhat --config test/config/hardhat.config.ts test",
"build": "tsc -p tsconfig.build.json" "build": "tsc -p tsconfig.build.json",
"pre-commit": "lint-staged"
}, },
"dependencies": { "dependencies": {
"@eth-optimism/common-ts": "^0.1.4", "@eth-optimism/common-ts": "^0.1.4",
...@@ -69,6 +70,7 @@ ...@@ -69,6 +70,7 @@
"mocha": "^8.3.2", "mocha": "^8.3.2",
"pino-pretty": "^4.7.1", "pino-pretty": "^4.7.1",
"prettier": "^2.2.1", "prettier": "^2.2.1",
"lint-staged": "11.0.0",
"prom-client": "^13.1.0", "prom-client": "^13.1.0",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"ts-node": "^9.1.1", "ts-node": "^9.1.1",
......
src/**/*.ts:
- eslint --fix
...@@ -13,7 +13,8 @@ ...@@ -13,7 +13,8 @@
"build": "tsc -p tsconfig.build.json", "build": "tsc -p tsconfig.build.json",
"lint": "yarn run lint:fix && yarn run lint:check", "lint": "yarn run lint:fix && yarn run lint:check",
"lint:fix": "prettier --config .prettierrc.json --write \"{src,test}/**/*.ts\"", "lint:fix": "prettier --config .prettierrc.json --write \"{src,test}/**/*.ts\"",
"lint:check": "eslint -c .eslintrc.js --ext .ts --format stylish ." "lint:check": "eslint -c .eslintrc.js --ext .ts --format stylish .",
"pre-commit": "lint-staged"
}, },
"dependencies": { "dependencies": {
"node-fetch": "^2.6.1" "node-fetch": "^2.6.1"
...@@ -35,6 +36,7 @@ ...@@ -35,6 +36,7 @@
"eslint-plugin-prefer-arrow": "^1.2.3", "eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-react": "^7.24.0", "eslint-plugin-react": "^7.24.0",
"eslint-plugin-unicorn": "^32.0.1", "eslint-plugin-unicorn": "^32.0.1",
"prettier": "^2.2.1" "prettier": "^2.2.1",
"lint-staged": "11.0.0"
} }
} }
src/**/*.ts:
- eslint --fix
test/**/*.ts:
- eslint --fix
exec/*.js:
- eslint --fix
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
"lint": "yarn lint:fix && yarn lint:check", "lint": "yarn lint:fix && yarn lint:check",
"lint:fix": "prettier --config .prettierrc.json --write \"{src,exec,test}/**/*.ts\"", "lint:fix": "prettier --config .prettierrc.json --write \"{src,exec,test}/**/*.ts\"",
"lint:check": "eslint -c .eslintrc.js --ext .ts --format stylish .", "lint:check": "eslint -c .eslintrc.js --ext .ts --format stylish .",
"test": "hardhat test --show-stack-traces" "test": "hardhat test --show-stack-traces",
"pre-commit": "lint-staged"
}, },
"keywords": [ "keywords": [
"optimism", "optimism",
...@@ -62,6 +63,7 @@ ...@@ -62,6 +63,7 @@
"lodash": "^4.17.21", "lodash": "^4.17.21",
"mocha": "^8.4.0", "mocha": "^8.4.0",
"eslint": "^7.27.0", "eslint": "^7.27.0",
"prettier": "^2.2.1" "prettier": "^2.2.1",
"lint-staged": "11.0.0"
} }
} }
src/**/*.ts:
- eslint --fix
test/**/*.ts:
- eslint --fix
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
"lint": "yarn lint:fix && yarn lint:check", "lint": "yarn lint:fix && yarn lint:check",
"lint:fix": "prettier --config ./.prettierrc.json --write \"hardhat.config.ts\" \"{src,test}/**/*.ts\"", "lint:fix": "prettier --config ./.prettierrc.json --write \"hardhat.config.ts\" \"{src,test}/**/*.ts\"",
"lint:check": "eslint -c .eslintrc.js --ext .ts --format stylish .", "lint:check": "eslint -c .eslintrc.js --ext .ts --format stylish .",
"clean": "rimraf ./artifacts ./cache ./dist ./tsconfig.build.tsbuildinfo" "clean": "rimraf ./artifacts ./cache ./dist ./tsconfig.build.tsbuildinfo",
"pre-commit": "lint-staged"
}, },
"peerDependencies": { "peerDependencies": {
"@ethersproject/abi": "^5", "@ethersproject/abi": "^5",
...@@ -56,6 +57,7 @@ ...@@ -56,6 +57,7 @@
"ethers": "^5.0.31", "ethers": "^5.0.31",
"hardhat": "^2.4.0", "hardhat": "^2.4.0",
"lodash": "^4.17.20", "lodash": "^4.17.20",
"prettier": "^2.2.1" "prettier": "^2.2.1",
"lint-staged": "11.0.0"
} }
} }
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
"private": true, "private": true,
"devDependencies": { "devDependencies": {
"@types/prettier": "2.2.1", "@types/prettier": "2.2.1",
"prettier": "^2.2.1" "prettier": "^2.2.1",
"lint-staged": "11.0.0"
}, },
"scripts": { "scripts": {
"lint": "yarn lint:fix && yarn lint:check", "lint": "yarn lint:fix && yarn lint:check",
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment