generator-chisel
generator-chisel copied to clipboard
Lint on commit only when relevant files changed
Is something like that possible? It's a bit annoying that lint CSS and lint JS run every time even when commit doesn't update any JS/CSS files. Not a high priority, though.
Overcommit (for ruby) is doing some magic and is linting only things that you changed but i think it may not be simple to implement. Definitely would be nice to have but I agree with low priority.
Or maybe... https://www.npmjs.com/package/gulp-git-changed
Also: https://www.npmjs.com/package/gulp-gitmodified
you might want to check out lint-staged: https://github.com/okonet/lint-staged & husky: https://github.com/typicode/husky
When used in combination you can setup lint-staged to run various linters for whatever file types you would like by utilizing a git pre-commit hook. Both of these packages make it very simple to do.
you will need to run npm i -D lint-staged husky first, then:
You could do something like this in the package.json
"scripts": {
"build": "gulp build",
"build-report": "gulp build && gulp report",
"dev": "gulp",
"lint:js": "gulp lint-js",
"lint:scss": "gulp lint-css",
"start": "gulp",
"watch": "gulp"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.js": ["npm run lint:js", "git add"],
"*.scss": ["npm run lint:scss", "git add"]
},
Thanks for the tip, @robertguss!