Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

A few issues reported by ESLint #477

Closed
pdehaan opened this issue Jan 8, 2014 · 6 comments
Closed

A few issues reported by ESLint #477

pdehaan opened this issue Jan 8, 2014 · 6 comments
Labels

Comments

@pdehaan
Copy link
Contributor

pdehaan commented Jan 8, 2014

$ eslint **/*.js

  1. bin/key_server.js: line 82, col 12, Error - noncedb is already declared in the upper scope.
  2. bin/mail_helper.js: line 68, col 6, Error - mail is already declared in the upper scope.
  3. bin/signer.js: line 28, col 8, Error - Trailing comma.
  4. client/index.js: line 202, col 9, Warning - Spaced function application is not allowed.
  5. client/index.js: line 211, col 16, Warning - keys is defined but never used
  6. client/index.js: line 310, col 16, Warning - bundle is defined but never used
  7. config/config.js: line 38, col 6, Error - Identifier 'available_backends' is not in camel case.
  8. config/config.js: line 82, col 6, Error - Trailing comma.
  9. config/config.js: line 75, col 8, Error - Trailing comma.
  10. config/config.js: line 73, col 10, Error - Trailing comma.
  11. config/config.js: line 79, col 10, Error - Trailing comma.
  12. config/config.js: line 109, col 8, Error - Trailing comma.
  13. config/config.js: line 107, col 10, Error - Trailing comma.
  14. config/config.js: line 113, col 10, Error - Trailing comma.
  15. db/index.js: line 26, col 7, Error - Unexpected 'else' after 'return'.
  16. db/mysql.js: line 58, col 12, Error - Trailing comma.
  17. db/mysql.js: line 85, col 24, Error - mysql is already declared in the upper scope.
  18. db/mysql.js: line 737, col 12, Error - Trailing comma.
  19. routes/account.js: line 27, col 12, Error - Trailing comma.
  20. routes/account.js: line 412, col 8, Error - Trailing comma.
  21. routes/account.js: line 30, col 26, Warning - accountCreate is defined but never used
  22. routes/account.js: line 267, col 26, Warning - accountKeys is defined but never used
  23. routes/account.js: line 412, col 26, Warning - accountReset is defined but never used
  24. routes/account.js: line 450, col 26, Warning - accountDestroy is defined but never used
  25. routes/defaults.js: line 12, col 26, Warning - index is defined but never used
  26. routes/defaults.js: line 22, col 26, Warning - heartbeat is defined but never used
  27. routes/idp.js: line 7, col 8, Warning - HEX_STRING is defined but never used
  28. routes/idp.js: line 14, col 26, Warning - wellKnown is defined but never used
  29. routes/index.js: line 5, col 4, Error - 'crypto' is read only.
  30. routes/password.js: line 8, col 4, Error - 'crypto' is read only.
  31. routes/sign.js: line 34, col 26, Warning - certificateSign is defined but never used
  32. routes/util.js: line 14, col 26, Warning - getRandomBytes is defined but never used
  33. scripts/gen_keys.js: line 1, col 1, Error - Unexpected token ILLEGAL
  34. scripts/tap-coverage.js: line 1, col 1, Error - Unexpected token ILLEGAL
  35. server/server.js: line 16, col 6, Error - Trailing comma.
  36. server/server.js: line 207, col 34, Error - Infix operators must be spaced.
  37. server/server.js: line 22, col 26, Warning - nonceCheck is defined but never used
  38. test/test_server.js: line 28, col 20, Error - Empty block statement.
  39. tokens/index.js: line 5, col 4, Error - 'crypto' is read only.

39 problems

We can ignore the Error - Unexpected token ILLEGAL messages (33 & 34) since those seem to be due to the #!/usr/bin/env node (see eslint/eslint#494). This should be fixed in future ESLint versions.

And my local .eslintrc config file is:

{
    "env": {
        "browser": true,
        "node": true,
        "amd": true
    },

    "rules": {
        "no-alert": 2,
        "no-caller": 2,
        "no-bitwise": 0,
        "no-catch-shadow": 2,
        "no-console": 0,
        "no-comma-dangle": 2,
        "no-control-regex": 2,
        "no-debugger": 2,
        "no-div-regex": 2,
        "no-dupe-keys": 2,
        "no-else-return": 2,
        "no-empty": 2,
        "no-empty-class": 2,
        "no-eq-null": 2,
        "no-eval": 2,
        "no-ex-assign": 2,
        "no-func-assign": 2,
        "no-floating-decimal": 2,
        "no-implied-eval": 2,
        "no-with": 2,
        "no-fallthrough": 2,
        "no-global-strict": 2,
        "no-unreachable": 2,
        "no-undef": 2,
        "no-undef-init": 2,
        "no-unused-expressions": 1,
        "no-octal": 2,
        "no-octal-escape": 2,
        "no-obj-calls": 2,
        "no-multi-str": 2,
        "no-new-wrappers": 2,
        "no-new": 2,
        "no-new-func": 2,
        "no-native-reassign": 2,
        "no-plusplus": 0,
        "no-delete-var": 2,
        "no-return-assign": 2,
        "no-new-array": 2,
        "no-new-object": 2,
        "no-label-var": 2,
        "no-ternary": 0,
        "no-self-compare": 2,
        "no-sync": 0,
        "no-underscore-dangle": 0,
        "no-loop-func": 2,
        "no-empty-label": 2,
        "no-unused-vars": 1,
        "no-script-url": 2,
        "no-proto": 2,
        "no-iterator": 2,
        "no-mixed-requires": [0, false],
        "no-wrap-func": 2,
        "no-shadow": 2,
        "no-use-before-define": 0,
        "no-redeclare": 2,

        "brace-style": 0,
        "block-scoped-var": 0,
        "camelcase": 2,
        "complexity": [0, 11],
        "consistent-this": [0, "that"],
        "curly": 0,
        "dot-notation": 2,
        "eqeqeq": 2,
        "guard-for-in": 0,
        "max-depth": [0, 4],
        "max-len": [0, 80, 4],
        "max-params": [0, 3],
        "max-statements": [0, 10],
        "new-cap": 2,
        "new-parens": 2,
        "one-var": 0,
        "quotes": [0, "single"],
        "quote-props": 0,
        "radix": 0,
        "regex-spaces": 2,
        "semi": 0,
        "strict": 0,
        "unnecessary-strict": 0,
        "use-isnan": 2,
        "wrap-iife": 2,
        "wrap-regex": 0
    }
}
@chilts
Copy link
Contributor

chilts commented Jan 14, 2014

Are we going to be running eslint regularly? If so, we should add it as a devDependency so we're all running the same version. Does that sound ok?

@pdehaan
Copy link
Contributor Author

pdehaan commented Jan 14, 2014

@chilts I don't think we're planning on switching to ESLint, it was just something I was checking out and ran against the various repos.
We're already using JSHint to run code validation, and in the process of adding JSCS (via a Grunt task) to add code style linter, for consistency.

@chilts
Copy link
Contributor

chilts commented Jan 14, 2014

Cool, no problem. Think I'll go read up a bit about jscs! :)

@pdehaan
Copy link
Contributor Author

pdehaan commented Jan 14, 2014

https://github.com/mdevils/node-jscs
https://github.com/gustavohenke/grunt-jscs-checker (Grunt plugin)

initial .jscs.json file: https://github.com/pdehaan/picl-idp/blob/c7e7cd52d043ab103aecb0bd839db92d8c6c3f76/.jscs.json

ESLint is pretty nice too, if you haven't checked it out yet. A lot of overlap w/ JSHint, but a bit friendlier to customize warnings vs errors. There was also word of ESLint integrating some of the style rules from JSCS. Although note that JSCS is not a replacement for JSHint, it's intended to be more of a companion which focuses on styling vs code quality.

Or another one I've been looking at is Phantomas: https://npmjs.org/package/phantomas
It's a web performance wrapper for PhantomJS.

@pdehaan
Copy link
Contributor Author

pdehaan commented Jan 14, 2014

There is probably a lot of overlap (I hope) with the ESLint results above and the jscs results from #487. Let's punt this bug until Q1-2014 and I can clean up any results above that still exist after the Grunt jscs tasks are passing.

@ckarlof ckarlof modified the milestones: train-10 (Apr 14), train-08 (Mar 31) Mar 25, 2014
@ckarlof ckarlof modified the milestones: z-later, train-10 (Apr 14) Apr 15, 2014
@dannycoates
Copy link
Contributor

closing as "old"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants