Skip to content

Commit

Permalink
ci: only lint files that are staged before each commit (#33)
Browse files Browse the repository at this point in the history
* ci: added lint:staged script to root package.json.
* ci(cdk): added lint-staged.
* ci(webapp): added lint-staged.
* ci: run lint:staged before each commit.
  • Loading branch information
hwelsters authored Dec 20, 2023
1 parent da57a73 commit 85a194d
Show file tree
Hide file tree
Showing 7 changed files with 211 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh

. "$(dirname "$0")/_/husky.sh"
echo 'defaulting to commit-msg hook...'

yarn lint:staged
3 changes: 3 additions & 0 deletions apps/snakecode-cdk/.lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"*.ts": "eslint --fix"
}
2 changes: 2 additions & 0 deletions apps/snakecode-cdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"build": "tsc",
"lint": "eslint . --fix",
"lint:staged": "lint-staged",
"watch": "tsc -w",
"test": "jest",
"cdk": "cdk"
Expand All @@ -17,6 +18,7 @@
"aws-cdk": "2.90.0",
"eslint-config-snakecode-base": "1.0.0",
"jest": "^29.6.2",
"lint-staged": "^15.2.0",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"typescript": "~5.1.6"
Expand Down
4 changes: 4 additions & 0 deletions apps/snakecode-webapp/.lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"*.ts": "eslint --fix",
"*.tsx": "eslint --fix"
}
1 change: 1 addition & 0 deletions apps/snakecode-webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"eslint-plugin-tailwindcss": "^3.13.0",
"eslint-plugin-testing-library": "^6.0.1",
"eslint-plugin-unused-imports": "^3.0.0",
"lint-staged": "^15.2.0",
"prettier": "^3.0.3",
"prettier-plugin-tailwindcss": "^0.5.4",
"storybook": "7.4.0"
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
"build": "lerna run build --stream --include-dependencies",
"clean": "lerna run clean && rm -rf node_modules",
"lint": "lerna run lint",
"lint:staged": "lerna run lint:staged",
"postinstall": "husky install",
"release": "yarn run clean && yarn install && yarn run build"
},
"devDependencies": {
"nx": "^16.6.0",
"patch-package": "^8.0.0",
"husky": "^8.0.3",
"lerna": "^7.1.5",
"nx": "^16.6.0",
"patch-package": "^8.0.0",
"typescript": "^4.9.4"
},
"workspaces": {
Expand Down
Loading

0 comments on commit 85a194d

Please sign in to comment.