Skip to content

Conversation

@IvanBila
Copy link
Contributor

Summary

I added the --fix option to eslint in the lint script, it automatically fixes problems whenever possible I also added:

  • The bash shebang to test.sh
  • The Google style guide to eslint (taken from the contributing.md)
  • Editor config

Moreover, I disabled the following rules max-len, require-jsdoc, valid-jsdoc because the code is being written in the context of documentation(This can also be reverted, what do you think @samtstern?)

Copy link
Member

@thatfiredev thatfiredev left a 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.

@samtstern
Copy link
Contributor

@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()
Copy link
Contributor

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
Copy link
Contributor

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() 
Copy link
Contributor Author

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 custom

let me know if you agree with this change so I can either push the changes or find a better way to tackle it.

Copy link
Contributor

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.

@IvanBila
Copy link
Contributor Author

IvanBila commented Nov 5, 2019

Hi @samtstern any update here?

@samtstern
Copy link
Contributor

@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

@samtstern
Copy link
Contributor

Now eslint is very angry:

> snippets-node@1.0.0 lint /home/travis/build/firebase/snippets-node > find . -type f -name "*.js" -not -path "*node_modules*" | xargs eslint /home/travis/build/firebase/snippets-node/functions/firestore-export/index.js 10:1 error Expected indentation of 2 spaces but found 44 indent 11:1 error Expected indentation of 2 spaces but found 44 indent 12:1 error Expected indentation of 4 spaces but found 2 indent 12:23 error Trailing spaces not allowed no-trailing-spaces 15:1 error Expected indentation of 4 spaces but found 2 indent 16:1 error Expected indentation of 6 spaces but found 4 indent 17:1 error Expected indentation of 6 spaces but found 4 indent 18:1 error Expected indentation of 6 spaces but found 4 indent 19:1 error Expected indentation of 6 spaces but found 4 indent 20:1 error Expected indentation of 6 spaces but found 4 indent 21:1 error Expected indentation of 6 spaces but found 4 indent 21:22 error Missing trailing comma comma-dangle 23:1 error Expected indentation of 6 spaces but found 2 indent 23:9 error Expected parentheses around arrow function argument arrow-parens 24:1 error Expected indentation of 8 spaces but found 4 indent 25:1 error Expected indentation of 8 spaces but found 4 indent 26:1 error Expected indentation of 8 spaces but found 4 indent 27:1 error Expected indentation of 6 spaces but found 2 indent 28:1 error Expected indentation of 6 spaces but found 2 indent 28:10 error Expected parentheses around arrow function argument arrow-parens 29:1 error Expected indentation of 8 spaces but found 4 indent 30:1 error Expected indentation of 8 spaces but found 4 indent 31:1 error Expected indentation of 6 spaces but found 2 indent 32:1 error Expected indentation of 2 spaces but found 0 indent /home/travis/build/firebase/snippets-node/firestore/main/index.js 715:11 error Expected parentheses around arrow function argument arrow-parens 716:19 error Expected parentheses around arrow function argument arrow-parens /home/travis/build/firebase/snippets-node/firestore/solution-scheduled-backups/app.js 19:5 error Inconsistently quoted property 'Authorization' found quote-props 22:9 error There should be no space after '{' object-curly-spacing 22:27 error There should be no space before '}' object-curly-spacing 43:9 error There should be no space after '{' object-curly-spacing 43:23 error There should be no space before '}' object-curly-spacing 52:50 error There should be no space after '{' object-curly-spacing 52:60 error There should be no space before '}' object-curly-spacing /home/travis/build/firebase/snippets-node/firestore/solution-sharded-timestamp/shardedTimestamps.js 23:30 error Multiple spaces found before '// add the new...' no-multi-spaces 27:25 error Missing trailing comma comma-dangle 32:1 error Expected indentation of 8 spaces but found 10 indent 32:50 error Missing trailing comma comma-dangle 35:30 error Multiple spaces found before '// add the new...' no-multi-spaces 39:28 error Missing trailing comma comma-dangle 44:1 error Expected indentation of 8 spaces but found 10 indent 44:50 error Missing trailing comma comma-dangle 47:30 error Multiple spaces found before '// add the new...' no-multi-spaces 51:26 error Missing trailing comma comma-dangle 56:1 error Expected indentation of 8 spaces but found 10 indent 56:50 error Missing trailing comma comma-dangle 57:6 error Missing trailing comma comma-dangle 75:33 error Expected parentheses around arrow function argument arrow-parens 76:1 error Expected indentation of 4 spaces but found 8 indent 77:1 error Expected indentation of 6 spaces but found 12 indent 77:39 error Multiple spaces found before '// new shard c...' no-multi-spaces 78:1 error Expected indentation of 6 spaces but found 12 indent 79:1 error Expected indentation of 6 spaces but found 12 indent 80:1 error Expected indentation of 6 spaces but found 12 indent 81:1 error Expected indentation of 6 spaces but found 12 indent 82:1 error Expected indentation of 2 spaces but found 6 indent 83:1 error Expected indentation of 2 spaces but found 6 indent 84:1 error Expected indentation of 2 spaces but found 6 indent 85:1 error Expected indentation of 4 spaces but found 6 indent 86:1 error Expected indentation of 6 spaces but found 8 indent 87:1 error Expected indentation of 6 spaces but found 8 indent 88:1 error Expected indentation of 6 spaces but found 8 indent 89:1 error Expected indentation of 8 spaces but found 10 indent 90:1 error Expected indentation of 10 spaces but found 12 indent 91:1 error Expected indentation of 10 spaces but found 12 indent 92:1 error Expected indentation of 8 spaces but found 10 indent 93:1 error Expected indentation of 6 spaces but found 8 indent 94:1 error Expected indentation of 6 spaces but found 8 indent 95:1 error Expected indentation of 6 spaces but found 8 indent 96:1 error Expected indentation of 6 spaces but found 8 indent 97:1 error Expected indentation of 6 spaces but found 8 indent 98:1 error Expected indentation of 8 spaces but found 10 indent 99:1 error Expected indentation of 8 spaces but found 10 indent 100:1 error Expected indentation of 8 spaces but found 10 indent 101:1 error Expected indentation of 8 spaces but found 10 indent 102:1 error Expected indentation of 10 spaces but found 12 indent 103:1 error Expected indentation of 8 spaces but found 10 indent 104:1 error Expected indentation of 10 spaces but found 12 indent 105:1 error Expected indentation of 8 spaces but found 10 indent 106:1 error Expected indentation of 6 spaces but found 8 indent 107:1 error Expected indentation of 6 spaces but found 8 indent 108:1 error Expected indentation of 4 spaces but found 6 indent 127:1 error Expected indentation of 2 spaces but found 4 indent 128:1 error Expected indentation of 4 spaces but found 6 indent 129:1 error Expected indentation of 6 spaces but found 10 indent 130:1 error Expected indentation of 8 spaces but found 14 indent 131:1 error Expected indentation of 10 spaces but found 16 indent 132:1 error Expected indentation of 10 spaces but found 16 indent 133:1 error Expected indentation of 12 spaces but found 18 indent 134:1 31merror Expected indentation of 10 spaces but found 16 indent 135:1 error Expected indentation of 8 spaces but found 14 indent 136:1 error Expected indentation of 6 spaces but found 10 indent 137:1 error Expected indentation of 4 spaces but found 6 indent 138:1 error Expected indentation of 6 spaces but found 10 indent 139:1 error Expected indentation of 8 spaces but found 14 indent 140:1 error Expected indentation of 10 spaces but found 16 indent 141:1 error Expected indentation of 10 spaces but found 16 indent 142:1 error Expected indentation of 12 spaces but found 18 indent 143:1 error Expected indentation of 10 spaces but found 16 indent 144:1 error Expected indentation of 8 spaces but found 14 indent 145:1 error Expected indentation of 6 spaces but found 10 indent 146:1 error Expected indentation of 4 spaces but found 6 indent 147:1 error Expected indentation of 6 spaces but found 10 indent 148:1 error Expected indentation of 8 spaces but found 14 indent 149:1 error Expected indentation of 10 spaces but found 16 indent 150:1 error Expected indentation of 10 spaces but found 16 indent 151:1 error Expected indentation of 12 spaces but found 18 indent 152:1 error Expected indentation of 10 spaces but found 16 indent 153:1 error Expected indentation of 8 spaces but found 14 indent 154:1 error Expected indentation of 6 spaces but found 10 indent 155:1 error Expected indentation of 4 spaces but found 6 indent 156:1 error Expected indentation of 2 spaces but found 4 indent /home/travis/build/firebase/snippets-node/firestore/solution-sharded-timestamp/nonShardedTimestamps.js 15:25 error Missing trailing comma comma-dangle 20:1 error Expected indentation of 8 spaces but found 10 indent 20:50 error Missing trailing comma comma-dangle 26:28 error Missing trailing comma comma-dangle 31:1 error Expected indentation of 8 spaces but found 10 indent 31:50 error Missing trailing comma comma-dangle 37:26 error Missing trailing comma comma-dangle 42:1 error Expected indentation of 8 spaces but found 10 indent 42:50 error Missing trailing comma comma-dangle 43:6 error Missing trailing comma comma-dangle 60:1 error Expected indentation of 4 spaces but found 6 indent 61:1 error Expected indentation of 4 spaces but found 6 indent 62:1 error Expected indentation of 4 spaces but found 6 indent 63:1 error Expected indentation of 4 spaces but found 6 indent 82:1 error Expected indentation of 2 spaces but found 4 indent 83:1 error Expected indentation of 4 spaces but found 6 indent 84:1 error Expected indentation of 6 spaces but found 10 indent 85:1 error Expected indentation of 8 spaces but found 14 indent 86:1 error Expected indentation of 10 spaces but found 16 indent 87:1 error Expected indentation of 10 spaces but found 16 indent 88:1 error Expected indentation of 12 spaces but found 18 indent 89:1 error Expected indentation of 10 spaces but found 16 indent 90:1 error Expected indentation of 8 spaces but found 14 indent 91:1 error Expected indentation of 6 spaces but found 10 indent 92:1 error Expected indentation of 4 spaces but found 6 indent 93:1 error Expected indentation of 6 spaces but found 10 indent 94:1 error Expected indentation of 8 spaces but found 14 indent 95:1 error Expected indentation of 10 spaces but found 16 indent 96:1 error Expected indentation of 10 spaces but found 16 indent 97:1 error Expected indentation of 12 spaces but found 18 indent 98:1 error Expected indentation of 10 spaces but found 16 indent 99:1 error Expected indentation of 8 spaces but found 14 indent 100:1 error Expected indentation of 6 spaces but found 10 indent 101:1 error Expected indentation of 4 spaces but found 6 indent 102:1 error Expected indentation of 6 spaces but found 10 indent 103:1 error Expected indentation of 8 spaces but found 14 indent 104:1 error Expected indentation of 10 spaces but found 16 indent 105:1 error Expected indentation of 10 spaces but found 16 indent 106:1 error Expected indentation of 12 spaces but found 18 indent 107:1 error Expected indentation of 10 spaces but found 16 indent 108:1 error Expected indentation of 8 spaces but found 14 indent 109:1 error Expected indentation of 6 spaces but found 10 indent 110:1 error Expected indentation of 4 spaces but found 6 indent 111:1 error Expected indentation of 2 spaces but found 4 indent 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants