-
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?
Changes from all commits
57d6d2f
6be3e92
7a2dbc3
3aca24e
27f0024
4e7722c
f8c77ba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"semi": false, | ||
"singleQuote": true, | ||
"trailingComma": "es5", | ||
"printWidth": 100, | ||
"tabWidth": 2 | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
// Entry point for the build script in your package.json | ||
import "@hotwired/turbo-rails" | ||
import "./controllers" | ||
import '@hotwired/turbo-rails' | ||
import './controllers' | ||
|
||
import "@uswds/uswds" | ||
import '@uswds/uswds' | ||
|
||
// make sure USWDS components are wired to their behavior after a Turbo navigation | ||
import components from "@uswds/uswds/src/js/components" | ||
let initialLoad = true; | ||
import components from '@uswds/uswds/src/js/components' | ||
let initialLoad = true | ||
|
||
document.addEventListener("turbo:load", () => { | ||
document.addEventListener('turbo:load', () => { | ||
if (initialLoad) { | ||
// initial domready is handled by `import "uswds"` code | ||
initialLoad = false | ||
|
@@ -20,8 +20,8 @@ document.addEventListener("turbo:load", () => { | |
const behavior = components[key] | ||
behavior.on(target) | ||
}) | ||
}); | ||
}) | ||
|
||
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 commentThe 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 commentThe 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 commentThe 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 commentThe 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 |
||
initialLoad = true | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { Application } from "@hotwired/stimulus" | ||
import { Application } from '@hotwired/stimulus' | ||
|
||
const application = Application.start() | ||
|
||
// Configure Stimulus development experience | ||
application.debug = false | ||
window.Stimulus = application | ||
window.Stimulus = application | ||
|
||
export { application } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,31 @@ | ||
import { Controller } from "@hotwired/stimulus" | ||
import { Controller } from '@hotwired/stimulus' | ||
import * as ActionCable from '@rails/actioncable' | ||
|
||
export default class extends Controller { | ||
static targets = ["form", "userAccountId"]; | ||
static targets = ['form', 'userAccountId'] | ||
|
||
cable = ActionCable.createConsumer(); | ||
cable = ActionCable.createConsumer() | ||
|
||
connect() { | ||
this.cable.subscriptions.create({ channel: 'PaystubsChannel', account_id: this.userAccountIdTarget.value }, { | ||
connected: () => { | ||
console.log("Connected to the channel:", this); | ||
}, | ||
disconnected: () => { | ||
console.log("Disconnected"); | ||
}, | ||
received: (data) => { | ||
if (data.event === 'cbv.status_update') { | ||
if (data.has_fully_synced) { | ||
const accountId = data.account_id; | ||
this.userAccountIdTarget.value = accountId; | ||
this.formTarget.submit(); | ||
this.cable.subscriptions.create( | ||
{ channel: 'PaystubsChannel', account_id: this.userAccountIdTarget.value }, | ||
{ | ||
connected: () => { | ||
console.log('Connected to the channel:', this) | ||
}, | ||
disconnected: () => { | ||
console.log('Disconnected') | ||
}, | ||
received: (data) => { | ||
if (data.event === 'cbv.status_update') { | ||
if (data.has_fully_synced) { | ||
const accountId = data.account_id | ||
this.userAccountIdTarget.value = accountId | ||
this.formTarget.submit() | ||
} | ||
} | ||
} | ||
}, | ||
} | ||
}); | ||
) | ||
} | ||
} |
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:
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