org-formation / org-formation-reference

A reference architecture which aims to provide some best practices for any AWS Organization starting out using org-formation.
91 stars 23 forks source link

Run linters on every commit #38

Open zaro0508 opened 3 years ago

zaro0508 commented 3 years ago

It would be nice to setup something like pre-commit so that we can setup multiple linters to validate files on every commit. It looks like there's lint-staged for the node environment. here's an example, https://juliangaramendy.dev/blog/prettier-pre-commit-hook

OlafConijn commented 3 years ago

we run cfn-lint as part of checks on PR.

copy over the scripts from here: https://github.com/org-formation/org-formation-reference/blob/master/package.json

and

"hooks": {
    "pre-commit": "npm run print-tasks && npm run cfn-lint"
  }

not sure whether the cli should ship with husky configs (tool/integration method is not a cli choice), but this way it should be easy to integrate. maybe we can add this to the https://github.com/org-formation/org-formation-reference

zaro0508 commented 3 years ago

hmm, running linters manually or in CI is not the same as running on every local commit (git commit hook). I find the hook workflow to be better and much more convenient. Also i think would be in package.json devDependencies so shouldn't ship with the cli, correct?