I’m guessing lots of you already knew this but we only discovered it yesterday and it was one of those “where have you been all my life” moments. So, I thought I’d share.
Git hooks are a bit annoying at best and I’ve never found a good way to share them amongst the team. We wanted to ensure no unlinted code made it into the repo and came across this solution using lint-staged: which only lints those files you’re trying to commit and husky : which basically is git hooks from your package.json.
So just
meteor npm install --save-dev husky lint-staged
And then in package.json add (maybe you don’t want the --fix)
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.js": [
"eslint --fix",
"git add"
]
}
And you’re off, no more unlinted code