Skip to content

Commit 7c5e338

Browse files
committed
ci(lintstaged, husky): add husky and lintstaged
1 parent 2d2d423 commit 7c5e338

File tree

7 files changed

+85
-44
lines changed

7 files changed

+85
-44
lines changed

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx lint-staged --concurrent false --relative

apps/recnet/.eslintrc.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@
1111
"plugin:react/recommended",
1212
"plugin:@typescript-eslint/recommended"
1313
],
14-
"ignorePatterns": ["!**/*", ".next/**/*"],
14+
"ignorePatterns": [
15+
"!**/*",
16+
".next/**/*",
17+
"**/postcss.config.js",
18+
"**/tailwind.config.js"
19+
],
1520
"overrides": [
1621
{
1722
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],

apps/recnet/project.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
"$schema": "../../node_modules/nx/schemas/project-schema.json",
44
"sourceRoot": "apps/recnet",
55
"projectType": "application",
6-
"targets": {},
6+
"targets": {
7+
"typecheck": {
8+
"executor": "nx:run-commands",
9+
"options": {
10+
"commands": ["tsc -p tsconfig.json --noEmit"],
11+
"cwd": "apps/recnet",
12+
"forwardAllArgs": false
13+
}
14+
}
15+
},
716
"tags": []
817
}

apps/recnet/src/components/FollowButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function FollowButton(props: FollowButtonProps) {
2626
variant={isFollowing ? "outline" : "solid"}
2727
onClick={async () => {
2828
if (!me) {
29-
toast.error("You must be logged in to follow someone");
29+
toast.error("You must be logged in to follow someone.");
3030
return;
3131
}
3232
setIsLoading(true);

lint-staged.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
"{apps,libs,tools}/**/*.{ts,tsx}": (files) => {
3+
return `nx affected -t typecheck --files=${files.join(",")}`;
4+
},
5+
"{apps,libs,tools}/**/*.{js,ts,jsx,tsx,json}": [
6+
(files) => `nx affected:lint --files=${files.join(",")}`,
7+
(files) => `nx format:write --files=${files.join(",")}`,
8+
],
9+
};

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
"name": "@recnet/source",
33
"version": "0.0.0",
44
"license": "MIT",
5-
"scripts": {},
5+
"scripts": {
6+
"prepare": "npx husky init"
7+
},
68
"private": true,
79
"dependencies": {
810
"@hookform/resolvers": "^3.3.4",
@@ -14,8 +16,6 @@
1416
"firebase": "^10.7.2",
1517
"firebase-admin": "^12.0.0",
1618
"framer-motion": "^11.0.3",
17-
"husky": "^9.0.2",
18-
"lint-staged": "^15.2.0",
1919
"lodash.groupby": "^4.6.0",
2020
"lucide-react": "^0.316.0",
2121
"next": "14.1.0",
@@ -66,8 +66,10 @@
6666
"eslint-plugin-react": "^7.33.2",
6767
"eslint-plugin-react-hooks": "^4.6.0",
6868
"eslint-plugin-unused-imports": "^3.0.0",
69+
"husky": "^9.0.2",
6970
"jest": "^29.4.1",
7071
"jest-environment-jsdom": "^29.4.1",
72+
"lint-staged": "^15.2.0",
7173
"nx": "18.0.4",
7274
"postcss": "8.4.21",
7375
"prettier": "^3.2.4",

0 commit comments

Comments
 (0)