-
Notifications
You must be signed in to change notification settings - Fork 2
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
Adding pre-commit hook for linting #453
base: main
Are you sure you want to change the base?
Conversation
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.
Seems fine to me, in principle, since people have to opt into it by symlinking the git hook script.
Personally I like the pre-commit framework which has a lot of wrapping logic to this stuff which makes it faster and easier to deal with. So I'll probably keep https://jiraent.cms.gov/browse/FFS-2488 open to track that work.
exit 1 | ||
fi | ||
|
||
# Stage the files that were auto-corrected by RuboCop | ||
git add app/**/*.rb |
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 unexpected to me, and I'd guess will cause people to inadvertently commit files. Also, this script should really make sure it's running in the right directory, ideally by doing something like:
cd "$(git rev-parse --show-toplevel)"
at the top of the script. (This will cd to the top-level of the git repo.)
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.
Good catch
document.addEventListener("turbo:frame-render", () => { | ||
initialLoad = true; | ||
}); | ||
document.addEventListener('turbo:frame-render', () => { |
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.
Hmm, can we just standardize on double-quotes in JS for consistency with Ruby? Is there a technical reason to use single quotes?
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.
No technical reason. By convention I'm used to single quotes and only using double quotes for strings that require interpolation. It's simply a practice that I've used for years now.
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.
I think string interpolation in JS uses tildes, right?
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.
JS uses backticks. In other languages that differs (PHP for example uses double quotes)- it's just convention that I'm used to, but not married to. I don't mind setting "singleQuote": false
. Double quotes do allow us to avoid escaping apostrophes though.
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.
I kind of wish that was broken out a little more. There are a few things going on:
- first run of lint rules against JS files which makes a lot of changes
- introduction of linter tooling (prettier)
- introduction of pre-commit hook
i would first get it to lint as part of the CI pipeline over this pre-commit thing. Oh it already does, duh! Eh, I'd definitely split the pre-commit thing out so we can have some more discussion on it because the linted-up javascript is valuable.
Ticket
Resolves FFS-2488.
Changes
lint
command e.g.npm run lint
standard
library in favor ofrubocop
for lintingContext for reviewers
Acceptance testing
:alert: Deploy block! @ffs-eng I just merged PR [#123] and will be doing acceptance testing in demo - please don't deploy until I'm finished!
)