intuit / oauth-jsclient

Intuit's NodeJS OAuth client provides a set of methods to make it easier to work with OAuth2.0 and Open ID
https://developer.intuit.com/
Apache License 2.0
121 stars 156 forks source link

Fix ESLint Issues #32

Closed abisalehalliprasan closed 4 years ago

abisalehalliprasan commented 5 years ago

Fix the ES Lint Issues : https://github.com/intuit/oauth-jsclient/blob/master/package.json#L7

mcrosby114 commented 4 years ago

It looks like there are 197 problems across all your files. How would you like to fix these lint errors? I could put eslint-disable in each file, and that would suppress the warnings. Or would you prefer all the code itself be changed to work with eslint?

/Users/mcrosby2/Documents/oauth-jsclient/src/access-token/Token.js
   50:31  warning  Unexpected unnamed function                     func-names
   58:32  warning  Unexpected unnamed function                     func-names
   66:29  warning  Unexpected unnamed function                     func-names
   73:1   error    Line 73 exceeds the maximum line length of 100  max-len
   75:28  warning  Unexpected unnamed function                     func-names
   93:28  warning  Unexpected unnamed function                     func-names
  109:30  warning  Unexpected unnamed function                     func-names
  125:1   error    Unexpected dangling '_' in '_checkExpiry'       no-underscore-dangle
  125:32  warning  Unexpected unnamed function                     func-names
  134:38  warning  Unexpected unnamed function                     func-names
  135:10  error    Unexpected dangling '_' in '_checkExpiry'       no-underscore-dangle
  142:39  warning  Unexpected unnamed function                     func-names
  143:10  error    Unexpected dangling '_' in '_checkExpiry'       no-underscore-dangle

/Users/mcrosby2/Documents/oauth-jsclient/src/OAuthClient.js
   55:28  error    Do not access Object.prototype method 'hasOwnProperty' from target object                                                                                              no-prototype-builtins
   55:72  error    Expected '===' and instead saw '=='                                                                                                                                    eqeqeq
   57:20  error    A constructor name should not start with a lowercase letter                                                                                                            new-cap
   99:53  error    Unexpected string concatenation of literals                                                                                                                            no-useless-concat
  107:38  warning  Unexpected unnamed function                                                                                                                                            func-names
  131:37  warning  Unexpected unnamed function                                                                                                                                            func-names
  150:25  error    Unexpected dangling '_' in '_urlencodedContentType'                                                                                                                    no-underscore-dangle
  151:17  error    Unexpected dangling '_' in '_jsonContentType'                                                                                                                          no-underscore-dangle
  159:31  error    Unexpected mix of '&&' and '||'                                                                                                                                        no-mixed-operators
  159:57  error    Unexpected mix of '&&' and '||'                                                                                                                                        no-mixed-operators
  175:33  warning  Unexpected unnamed function                                                                                                                                            func-names
  193:25  error    Unexpected dangling '_' in '_urlencodedContentType'                                                                                                                    no-underscore-dangle
  194:17  error    Unexpected dangling '_' in '_jsonContentType'                                                                                                                          no-underscore-dangle
  202:31  error    Unexpected mix of '&&' and '||'                                                                                                                                        no-mixed-operators
  202:57  error    Unexpected mix of '&&' and '||'                                                                                                                                        no-mixed-operators
  214:1   error    Line 214 exceeds the maximum line length of 100                                                                                                                        max-len
  218:43  warning  Unexpected unnamed function                                                                                                                                            func-names
  218:53  error    Identifier 'refresh_token' is not in camel case                                                                                                                        camelcase
  224:10  error    Identifier 'refresh_token' is not in camel case                                                                                                                        camelcase
  229:26  error    Identifier 'refresh_token' is not in camel case                                                                                                                        camelcase
  237:25  error    Unexpected dangling '_' in '_urlencodedContentType'                                                                                                                    no-underscore-dangle
  238:17  error    Unexpected dangling '_' in '_jsonContentType'                                                                                                                          no-underscore-dangle
  248:31  error    Unexpected mix of '&&' and '||'                                                                                                                                        no-mixed-operators
  248:57  error    Unexpected mix of '&&' and '||'                                                                                                                                        no-mixed-operators
  264:32  warning  Unexpected unnamed function                                                                                                                                            func-names
  270:1   error    Line 270 exceeds the maximum line length of 100                                                                                                                        max-len
  278:17  error    Unexpected dangling '_' in '_jsonContentType'                                                                                                                          no-underscore-dangle
  279:25  error    Unexpected dangling '_' in '_jsonContentType'                                                                                                                          no-underscore-dangle
  300:37  warning  Unexpected unnamed function                                                                                                                                            func-names
  305:29  error    Expected '===' and instead saw '=='                                                                                                                                    eqeqeq
  309:17  error    Unexpected dangling '_' in '_jsonContentType'                                                                                                                          no-underscore-dangle
  330:37  warning  Unexpected unnamed function                                                                                                                                            func-names
  339:17  error    Unexpected dangling '_' in '_jsonContentType'                                                                                                                          no-underscore-dangle
  359:33  warning  Unexpected unnamed function                                                                                                                                            func-names
  363:48  error    Expected '===' and instead saw '=='                                                                                                                                    eqeqeq
  381:17  error    Unexpected dangling '_' in '_jsonContentType'                                                                                                                          no-underscore-dangle
  389:31  error    Unexpected mix of '&&' and '||'                                                                                                                                        no-mixed-operators
  389:57  error    Unexpected mix of '&&' and '||'                                                                                                                                        no-mixed-operators
  404:44  warning  Unexpected unnamed function                                                                                                                                            func-names
  416:1   error    Line 416 exceeds the maximum line length of 100                                                                                                                        max-len
  422:3   error    for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array  no-restricted-syntax
  425:7   error    Unexpected use of continue statement                                                                                                                                   no-continue
  428:31  error    Unexpected string concatenation of literals                                                                                                                            no-useless-concat
  430:31  error    Unexpected string concatenation of literals                                                                                                                            no-useless-concat
  442:41  warning  Unexpected unnamed function                                                                                                                                            func-names
  443:34  error    Expected to return a value at the end of arrow function                                                                                                                consistent-return
  446:11  error    Identifier 'id_token' is not in camel case                                                                                                                             camelcase
  451:11  error    Identifier 'token_parts' is not in camel case                                                                                                                          camelcase
  452:11  error    Identifier 'id_token_header' is not in camel case                                                                                                                      camelcase
  453:11  error    Identifier 'id_token_payload' is not in camel case                                                                                                                     camelcase
  455:11  error    Identifier 'id_token_signature' is not in camel case                                                                                                                   camelcase
  455:11  error    'id_token_signature' is assigned a value but never used                                                                                                                no-unused-vars
  458:30  error    Expected '!==' and instead saw '!='                                                                                                                                    eqeqeq
  461:30  error    Expected '!==' and instead saw '!='                                                                                                                                    eqeqeq
  471:17  error    Unexpected dangling '_' in '_jsonContentType'                                                                                                                          no-underscore-dangle
  477:19  error    Expected to return a value at the end of arrow function                                                                                                                consistent-return
  493:43  warning  Unexpected unnamed function                                                                                                                                            func-names
  493:53  error    Identifier 'id_token' is not in camel case                                                                                                                             camelcase
  497:25  error    Expected '!==' and instead saw '!='                                                                                                                                    eqeqeq
  501:54  error    Expected '===' and instead saw '=='                                                                                                                                    eqeqeq
  517:38  warning  Unexpected unnamed function                                                                                                                                            func-names
  518:18  error    Unexpected require()                                                                                                                                                   global-require
  528:41  warning  Unexpected unnamed function                                                                                                                                            func-names
  548:39  warning  Unexpected unnamed function                                                                                                                                            func-names
  559:38  warning  Unexpected unnamed function                                                                                                                                            func-names
  568:49  warning  Unexpected unnamed function                                                                                                                                            func-names
  578:37  warning  Unexpected unnamed function                                                                                                                                            func-names
  579:42  error    Expected '===' and instead saw '=='                                                                                                                                    eqeqeq
  603:44  warning  Unexpected unnamed function                                                                                                                                            func-names
  611:34  warning  Unexpected unnamed function                                                                                                                                            func-names
  621:34  warning  Unexpected unnamed function                                                                                                                                            func-names
  631:36  warning  Unexpected unnamed function                                                                                                                                            func-names
  633:41  error    'btoa' is not defined                                                                                                                                                  no-undef
  633:56  error    new Buffer() is deprecated. Use Buffer.from(), Buffer.alloc(), or Buffer.allocUnsafe() instead                                                                         no-buffer-constructor
  636:29  warning  Unexpected unnamed function                                                                                                                                            func-names

/Users/mcrosby2/Documents/oauth-jsclient/src/response/AuthResponse.js
   45:42  warning  Unexpected unnamed function                          func-names
   55:35  warning  Unexpected unnamed function                          func-names
   63:31  warning  Unexpected unnamed function                          func-names
   71:33  warning  Unexpected unnamed function                          func-names
   79:34  warning  Unexpected unnamed function                          func-names
   87:32  warning  Unexpected unnamed function                          func-names
   88:49  error    Expected '===' and instead saw '=='                  eqeqeq
   96:34  warning  Unexpected unnamed function                          func-names
  108:41  warning  Unexpected unnamed function                          func-names
  116:40  warning  Unexpected unnamed function                          func-names
  123:41  warning  Unexpected unnamed function                          func-names
  124:28  error    Unexpected dangling '_' in '_contentType'            no-underscore-dangle
  130:33  warning  Unexpected unnamed function                          func-names
  135:1   error    Unexpected dangling '_' in '_contentType'            no-underscore-dangle
  136:1   error    Unexpected dangling '_' in '_jsonContentType'        no-underscore-dangle
  137:1   error    Unexpected dangling '_' in '_urlencodedContentType'  no-underscore-dangle

/Users/mcrosby2/Documents/oauth-jsclient/test/AuthResponseTest.js
  28:1  error  'describe' is not defined           no-undef
  29:7  error  'scope' is defined but never used   no-unused-vars
  30:7  error  'result' is defined but never used  no-unused-vars
  32:3  error  'it' is not defined                 no-undef
  40:3  error  'it' is not defined                 no-undef
  46:3  error  'it' is not defined                 no-undef
  54:3  error  'it' is not defined                 no-undef
  60:3  error  'it' is not defined                 no-undef

/Users/mcrosby2/Documents/oauth-jsclient/test/OAuthClientTest.js
   29:1    error  'describe' is not defined                                              no-undef
   30:7    error  'scope' is assigned a value but never used                             no-unused-vars
   32:3    error  'it' is not defined                                                    no-undef
   44:3    error  'describe' is not defined                                              no-undef
   45:5    error  'it' is not defined                                                    no-undef
   51:5    error  'it' is not defined                                                    no-undef
   58:5    error  'it' is not defined                                                    no-undef
   66:3    error  'describe' is not defined                                              no-undef
   67:5    error  'before' is not defined                                                no-undef
   81:5    error  'it' is not defined                                                    no-undef
   85:1    error  Line 85 exceeds the maximum line length of 100                         max-len
   89:5    error  'it' is not defined                                                    no-undef
   99:3    error  'describe' is not defined                                              no-undef
  100:5    error  'before' is not defined                                                no-undef
  101:34   error  Unexpected require()                                                   global-require
  115:5    error  'it' is not defined                                                    no-undef
  117:1    error  Line 117 exceeds the maximum line length of 100                        max-len
  120:5    error  'it' is not defined                                                    no-undef
  128:5    error  'it' is not defined                                                    no-undef
  139:3    error  'describe' is not defined                                              no-undef
  140:5    error  'before' is not defined                                                no-undef
  154:5    error  'it' is not defined                                                    no-undef
  162:5    error  'it' is not defined                                                    no-undef
  170:5    error  'it' is not defined                                                    no-undef
  181:3    error  'describe' is not defined                                              no-undef
  182:5    error  'describe' is not defined                                              no-undef
  183:7    error  'before' is not defined                                                no-undef
  197:7    error  'it' is not defined                                                    no-undef
  199:1    error  Line 199 exceeds the maximum line length of 100                        max-len
  203:5    error  'describe' is not defined                                              no-undef
  204:7    error  'before' is not defined                                                no-undef
  218:7    error  'it' is not defined                                                    no-undef
  222:1    error  Line 222 exceeds the maximum line length of 100                        max-len
  229:3    error  'describe' is not defined                                              no-undef
  230:5    error  'describe' is not defined                                              no-undef
  231:7    error  'before' is not defined                                                no-undef
  244:7    error  'it' is not defined                                                    no-undef
  246:103  error  Unexpected string concatenation of literals                            no-useless-concat
  246:113  error  Unexpected string concatenation of literals                            no-useless-concat
  246:131  error  Unexpected string concatenation of literals                            no-useless-concat
  248:1    error  Line 248 exceeds the maximum line length of 100                        max-len
  253:5    error  'describe' is not defined                                              no-undef
  254:7    error  'before' is not defined                                                no-undef
  267:7    error  'it' is not defined                                                    no-undef
  270:95   error  Unexpected string concatenation of literals                            no-useless-concat
  270:105  error  Unexpected string concatenation of literals                            no-useless-concat
  270:123  error  Unexpected string concatenation of literals                            no-useless-concat
  272:1    error  Line 272 exceeds the maximum line length of 100                        max-len
  279:3    error  'describe' is not defined                                              no-undef
  280:5    error  'describe' is not defined                                              no-undef
  281:7    error  'before' is not defined                                                no-undef
  296:7    error  'it' is not defined                                                    no-undef
  307:3    error  'describe' is not defined                                              no-undef
  308:5    error  'it' is not defined                                                    no-undef
  310:7    error  Expected an assignment or function call and instead saw an expression  no-unused-expressions
  312:5    error  'it' is not defined                                                    no-undef
  315:7    error  Expected an assignment or function call and instead saw an expression  no-unused-expressions
  320:3    error  'describe' is not defined                                              no-undef
  321:5    error  'it' is not defined                                                    no-undef
  325:5    error  'it' is not defined                                                    no-undef
  328:7    error  Expected an assignment or function call and instead saw an expression  no-unused-expressions
  333:3    error  'describe' is not defined                                              no-undef
  334:5    error  'it' is not defined                                                    no-undef
  338:5    error  'it' is not defined                                                    no-undef
  341:7    error  Expected an assignment or function call and instead saw an expression  no-unused-expressions
  347:3    error  'describe' is not defined                                              no-undef
  348:5    error  'it' is not defined                                                    no-undef
  368:3    error  'describe' is not defined                                              no-undef
  369:5    error  'describe' is not defined                                              no-undef
  370:7    error  'before' is not defined                                                no-undef
  385:7    error  'it' is not defined                                                    no-undef

/Users/mcrosby2/Documents/oauth-jsclient/test/TokenTest.js
  16:1   error  'describe' is not defined                             no-undef
  17:3   error  'it' is not defined                                   no-undef
  29:3   error  'it' is not defined                                   no-undef
  30:11  error  'oauthClient' is already declared in the upper scope  no-shadow
  43:1   error  Line 43 exceeds the maximum line length of 100        max-len
  46:3   error  'it' is not defined                                   no-undef
  54:1   error  Line 54 exceeds the maximum line length of 100        max-len
  57:3   error  'it' is not defined                                   no-undef
  59:11  error  Identifier 'access_token' is not in camel case        camelcase
  65:3   error  'it' is not defined                                   no-undef
  67:11  error  Identifier 'refresh_token' is not in camel case       camelcase
  72:3   error  'it' is not defined                                   no-undef
  74:11  error  Identifier 'token_type' is not in camel case          camelcase
  79:3   error  'it' is not defined                                   no-undef

✖ 197 problems (155 errors, 42 warnings)
abisalehalliprasan commented 4 years ago

@mcrosby114 ,

I have looked at the warnings and errors. However, I am not confident if it would be backward-compatible once we change all the code to work with ESLint.

Any thoughts ?

hallzac2 commented 4 years ago

I'm willing to help work on this. The no-undef rules for functions like describe and it are fairly easy to solve without breaking any compatibility.

mcrosby114 commented 4 years ago

@hallzac2 yeah that's true. And I think for some of these like camelcase and underscores we could put some eslint-disable around them, wherever it would break backwards compatibility. Want to split up work on this, like tackle the no-undef errors, and I could tackle the formatting related ones?

hallzac2 commented 4 years ago

Yeah that sounds good to me! I've got https://github.com/intuit/oauth-jsclient/pull/35 out now to address the no-undef errors. Let me know if I can help on any of the other pieces!

abisalehalliprasan commented 4 years ago

Awesome. @hallzac2 and @mcrosby114 Do you guys need another New Issue created for this or we good to work on the same issue?

mcrosby114 commented 4 years ago

Same one works for me, thanks!