- 
                Notifications
    
You must be signed in to change notification settings  - Fork 33
 
🐶 Add husky configuration #622
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?
Conversation
          
 | 
    
          ✅ Deploy Preview for myst-theme ready!
 To edit notification comments on pull requests, go to your Netlify project configuration.  | 
    
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.
LGTM! it's opt in, so we can easily merge and iterate. One question - our built-in lint tasks have implementions (definitions) per-subpackage, I.e you can define a different lint rule in each package. Is there a way that we should be defining this to match?
| 
           This seems to only be the case for the  So, if you want, we can do prefix detection and run different commands for files coming from those directories.  | 
    
| "dependencies": {} | ||
| "lint-staged": { | ||
| "*.ts": "eslint --config ./.eslintrc.cjs --fix", | ||
| "*.{js,jsx,ts,tsx,md,html,css,json}": "prettier --write" | 
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.
How does this align with the separate turborepo powered linting (which uses the eslint config from each respective package dir) that we have in place in scripts already? can the lint-staged call the respective npm scripts above? (just wanting to avoid two different sets of linting config)
Also will opening the pattern here beyond ts, tsx, md especially to include js, css mean that we are running prettier on the contents of dist/ and other build output folders?
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.
This is the same question I ask above, although I'm not sure if my meaning came through as clearly as it does here.
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 lint-staged package lets us only lint files that were touched during the commit.
I am not sure how to use the existing scripts, since afaik they don't take file arguments.
This adds the (optional) ability to run a pre-commit hook to lint changes.
I find it quite helpful, in that it prevents me from having to go back and run eslint or prettier on my commits. We've had it for a while on the mystmd repo without complaints.