Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run lint
npx lint-staged
11 changes: 11 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
// Lint & Prettify TS and JS files - only the staged files
"**/*.(ts|tsx|js|jsx)": (filenames) => [
`cross-env NODE_ENV=test npx eslint --fix --max-warnings=0 ${filenames.map((f) => `'${f.replace(/'/g, "'\\''")}'`).join(" ")}`,
`npx prettier --write ${filenames.map((f) => `'${f.replace(/'/g, "'\\''")}'`).join(" ")}`,
],

// Prettify only Markdown and JSON files
"**/*.(md|json)": (filenames) =>
`npx prettier --write ${filenames.map((f) => `'${f.replace(/'/g, "'\\''")}'`).join(" ")}`,
};
Comment on lines +1 to +11

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CodexRaunak I think this file is over-engineered because some lint-staged already:

  • Passes staged filenames automatically
  • Handles spaces safely

And I have question why you're using npx why not npm run lint which already point to eslint --fix

Loading