- Notifications
You must be signed in to change notification settings - Fork 134
Enforce google style guide through eslint #48
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
base: master
Are you sure you want to change the base?
Enforce google style guide through eslint #48
Conversation
thatfiredev left a comment
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.
Looks good overall, I just have a few suggestions.
| @IvanBila thanks for sending this request! In general I am fine with the idea, but it seems to have introduced a lot of issues around comments+whitespace which I think are a regression from the old style. |
| console.log(userRecord.customClaims.admin); | ||
| }); | ||
| admin | ||
| .auth() |
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.
Is there any setting for this chaining? The thing is that when embedded in the docs, it can look better to use less vertical space when possible.
Generally I like to break a chain when:
- There's a callback
- The chain can't fit on one line
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 main thing I don't like is the breaking of the first item.
I would much prefer:
admin.auth() .foo() .bar() To:
admin .auth() .foo() .bar() The issue is that things look weird when your first variable is short:
db // <-- Look like db is just floating in space .whatever() .foo() 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.
So I found this rule
I can make it
"newline-per-chained-call": [ "error", { "ignoreChainWithDepth": 4 } ]by using "ignoreChainWithDepth": 4 it will allow:
admin.auth().createCustomToken(uid) .then(function(customToken) { // Send token back to client }) .catch(function(error) { console.log('Error creating custom token:', error); }); // [END customlet me know if you agree with this change so I can either push the changes or find a better way to tackle it.
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.
Sorry about my slow response here! I just did some quick experiments and that setting sounds good to me. Thanks for finding it.
| Hi @samtstern any update here? |
| @IvanBila wow sorry I totally let this slip! LGTM want to resolve merge conflicts and then we can merge? If you don't want to handle the merge I'm happy to do it for you |
| Now |
Summary
I added the
--fixoption to eslint in thelint script, it automatically fixes problems whenever possible I also added:test.shMoreover, I disabled the following rules
max-len,require-jsdoc,valid-jsdocbecause the code is being written in the context of documentation(This can also be reverted, what do you think @samtstern?)