Skip to content

Commit c29aab1

Browse files
add lint-staged + husky + clsx
1 parent 309c1b7 commit c29aab1

File tree

8 files changed

+316
-11
lines changed

8 files changed

+316
-11
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
out
33
*.css
4+
.*.js

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"jest": true
2121
},
2222
"rules": {
23+
"react/require-default-props": "off",
2324
"import/prefer-default-export": "off",
2425
"react/prop-types": "off",
2526
"import/no-cycle": "off",

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ yarn-error.log*
2626

2727
# Environment Variables
2828
.env
29+
30+
# Typescript
31+
tsconfig.tsbuildinfo

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx lint-staged

.husky/pre-push

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npm run test

.lintstagedrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
'*.{js,jsx,ts,tsx}': 'npm run format',
3+
'*.{ts,tsx}': "bash -c 'npm run typecheck'", // running this via bash https://github.com/okonet/lint-staged/issues/825#issuecomment-727185296
4+
}

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
"test": "NODE_ENV=test jest",
1212
"lint": "eslint './{src,pages}/**/*' --ext .js,.jsx,.tsx,.ts",
1313
"format": "eslint './{src,pages}/**/*' --ext .js,.jsx,.tsx,.ts --fix",
14-
"analyze": "cross-env BUNDLE_ANALYZE=both next build",
15-
"export": "cross-env NODE_ENV=production next export",
16-
"production": "npm-run-all analyze export",
17-
"production:clean": "rimraf out/"
14+
"typecheck": "tsc --noEmit",
15+
"clean": "rimraf out/",
16+
"prepare": "husky install"
1817
},
1918
"dependencies": {
19+
"clsx": "^1.1.1",
2020
"next": "^12.1.6",
2121
"react": "^18.1.0",
2222
"react-dom": "^18.1.0"
@@ -46,8 +46,10 @@
4646
"eslint-plugin-prettier": "^4.0.0",
4747
"eslint-plugin-react": "^7.30.0",
4848
"eslint-plugin-sonarjs": "^0.13.0",
49+
"husky": "^8.0.1",
4950
"jest": "^28.1.1",
5051
"jest-environment-jsdom": "^28.1.1",
52+
"lint-staged": "^13.0.1",
5153
"npm-run-all": "^4.1.5",
5254
"postcss": "^8.4.14",
5355
"postcss-import": "^14.1.0",

yarn.lock

Lines changed: 293 additions & 7 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)