-
Notifications
You must be signed in to change notification settings - Fork 93
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
Replace Pre-Commit Hook with GitHub Actions #65
Conversation
change names
Feature/gh actions
Gosh I half expected they would run here on this PR. They ran when I merged my feature/ branch to my fork master branch here |
@@ -0,0 +1 @@ | |||
**/luxon/** |
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.
ignoring luxon from eslint as it is technically a "lib"
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
|
||
name: PR Gate - Format All |
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 job validates formatting of all files matching the same glob pattern used in the pre-commit hook. Maybe a little aggressive, definitely verbose.
Options to improve by adding a .prettierrc and/or .prettierignore to make it more readable for the mere mortals. And that would allow us to simplify the prettier command to just... prettier --check .
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
|
||
name: PR Gate - Lint LWC |
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 job lints js files inside lwc folders using the **/lwc/**/*.js
glob pattern
@@ -1,17 +1,17 @@ | |||
{ |
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 prettierrc wasn't pretty, lol
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.
Lol oops, I only ran it recursively within my aura
and lwc
folders
"prettier:validate": "prettier --check '**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}'", | ||
"prettier:fix": "prettier --write '**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}'", | ||
"reinstall": "npm ci" | ||
}, |
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.
White space changes when this file was pretty-fied make it hard to read. Note the husky and lint-staged blocks are removed. Also note that the scripts block has been updated.
Feel free to merge this when you finish it up (I defer to your judgement here, I have no experience with GH Actions). My understanding is that this will remove some minor friction during local commits (deprecate husky / lint-staged) and catch everything during a PR. Based on that, I don't think there is a going to be a significant impact on the workflow but please chime in if I'm misunderstanding. Any gotchas/considerations please document them here, otherwise we can use #66 to test this out! |
There are some settings on the repository that synergize with GH Actions. Setup a Rule for Master that Requires GH Actions before enabling the Merge Button on a PR. (optionally repo admins can ignore this rule)
I'll merge this in now, but I'll cut out a chore branch on this repo to confirm it's working and showcase the feature on a PR - (if it doesn't start spinning jobs right away for #66 that is) |
This PR replaces the Pre-Commit Hook for linting and formatting with GitHub Actions.
husky and lint-staged have been uninstalled, but the pattern matching has been reused for prettier.
eslint was failing on aura js files, so currently only linting lwc js files.