-
-
Notifications
You must be signed in to change notification settings - Fork 282
feat: add husky and lint-staged #1313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| pnpm exec lint-staged |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| module.exports = { | ||
| '*': 'prettier --write --ignore-unknown', | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| export default { | ||
| '*.{ts,js,json,md}': 'prettier --write', | ||
| 'src/**/*.ts': ['prettier --write', 'eslint --fix'], | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| export default { | ||
| '*.{ts,js,json,md}': 'prettier --write', | ||
| 'src/**/*.ts': ['prettier --write', () => 'tsc -p tsconfig.json --noEmit'], | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| export default { | ||
| '*.{ts,js,json,md}': 'prettier --write', | ||
| 'src/**/*.ts': ['prettier --write', 'eslint --fix'], | ||
| }; |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| export default { | ||
| '*.{ts,js,cjs,json,md}': 'prettier --write', | ||
| 'src/**/*.{css,mdx}': 'prettier --write', | ||
| 'src/**/*.{ts,tsx}': ['prettier --write', 'eslint --fix'], | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we need to add MDX here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you. I added mdx for prettier, eslint is not configured for mdx yet. |
||
| }; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The arrow function returning a string will not execute the TypeScript compiler. The function should return a command that lint-staged can execute, or use a string directly like 'tsc -p tsconfig.json --noEmit'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like we should check the entire project to determine whether a file has the correct types. Therefore, we don't need to provide a path to a specific file, as lint-staged does. This is recommended by the creators of lint-staged.
https://github.com/lint-staged/lint-staged?tab=readme-ov-file#example-run-tsc-on-changes-to-typescript-files-but-do-not-pass-any-filename-arguments