Skip to content

Commit 72a8ddd

Browse files
authored
Runs linting and prettier on staged files (#882)
* Runs linting and prettier on staged files * update scripts to be more consistent with main repo * run lint scripts in parallel * move lint-staged to script and ignore vscode files
1 parent 279cf9e commit 72a8ddd

File tree

5 files changed

+372
-8
lines changed

5 files changed

+372
-8
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ yarn-error.log*
3434
# jetbrains stuff
3535
.idea
3636

37+
# VSCode
38+
.vscode
39+
3740
# From https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
3841
.pnp.*
3942
.yarn/*

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
yarn lint-staged

lint-staged.config.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const config = {
2+
"*": "prettier --ignore-unknown --write",
3+
"*.{js,jsx,ts,tsx}": "eslint --fix",
4+
"**/*.ts?(x)": () => "tsc -p tsconfig.json --noEmit",
5+
}
6+
7+
export default config

package.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@
99
"dev": "next dev",
1010
"build": "next build",
1111
"start": "next start",
12-
"lint": "next lint && tsc --noEmit",
12+
"lint": "yarn typecheck && yarn lint-js",
13+
"lint-js": "next lint",
14+
"fix": "yarn lint --fix",
15+
"format": "prettier --write --log-level warn --ignore-unknown .",
1316
"update-sponsors": "node --experimental-fetch patreon.mjs",
1417
"update-roadmap": "node linear.mjs",
15-
"extract": "formatjs extract '{components,pages,data}/**/*.{js,jsx,ts,tsx}' --out-file 'locales/en.json' --format 'locales/locale_format.js'"
18+
"extract": "formatjs extract '{components,pages,data}/**/*.{js,jsx,ts,tsx}' --out-file 'locales/en.json' --format 'locales/locale_format.js'",
19+
"typecheck": "tsc --noEmit && echo 'No type errors'"
1620
},
1721
"dependencies": {
1822
"@headlessui/react": "^2.1.2",
@@ -44,6 +48,8 @@
4448
"eslint": "^8.57.0",
4549
"eslint-config-next": "^15.0.0",
4650
"eslint-config-prettier": "^10.0.0",
51+
"husky": "^9.1.7",
52+
"lint-staged": "^15.5.0",
4753
"postcss": "^8.4.40",
4854
"prettier": "^3.3.3",
4955
"prettier-plugin-tailwindcss": "^0.6.5",
@@ -52,4 +58,4 @@
5258
"typescript": "^5.5.4"
5359
},
5460
"packageManager": "[email protected]"
55-
}
61+
}

0 commit comments

Comments
 (0)