-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sage-monorepo): configure pre-commit hooks to format and lint fi…
…les (#2801)
- Loading branch information
1 parent
3291185
commit 5c6b163
Showing
8 changed files
with
237 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
# Run formatters and linters against staged git files | ||
pnpm dlx lint-staged --relative | ||
|
||
nx affected --uncommitted --target=format | ||
nx affected --uncommitted --target=lint | ||
# nx affected --uncommitted --target=lint | ||
|
||
# Re-index the staged files after they have been formatted | ||
# git diff --name-only --cached | xargs -l git add |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,2 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
# yarn nx affected --target=test | ||
# yarn nx affected --target=integration-test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// lint-staged.config.js | ||
|
||
module.exports = { | ||
// Format JavaScript, TypeScript, and JSX/TSX files first, then lint | ||
'**/*.{js,jsx,ts,tsx}': (filenames) => [ | ||
// Format files with Prettier first | ||
`prettier --write ${filenames.join(' ')}`, | ||
// Then run ESLint on the formatted files | ||
`nx affected --target=lint --files=${filenames.join(',')}`, | ||
], | ||
|
||
// Format JSON, Markdown, and YAML files | ||
'**/*.{json,md,yaml,yml}': (filenames) => [`nx format:write --files=${filenames.join(',')}`], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.