.jshintrc 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. {
  2. // ┬┌─┐╦ ╦╦╔╗╔╔╦╗┬─┐┌─┐
  3. // │└─┐╠═╣║║║║ ║ ├┬┘│
  4. // o└┘└─┘╩ ╩╩╝╚╝ ╩ ┴└─└─┘
  5. //
  6. // This file (`.jshintrc`) exists to help with consistency of code
  7. // throughout this package, and throughout Sails and the Node-Machine project.
  8. //
  9. // To review what each of these options mean, see:
  10. // http://jshint.com/docs/options
  11. //
  12. // (or: https://github.com/jshint/jshint/blob/master/examples/.jshintrc)
  13. //////////////////////////////////////////////////////////////////////
  14. // NOT SUPPORTED IN SOME JSHINT VERSIONS SO LEAVING COMMENTED OUT:
  15. //////////////////////////////////////////////////////////////////////
  16. // Prevent overwriting prototypes of native classes like `Array`.
  17. // (doing this is _never_ ok in any of our packages that are intended
  18. // to be used as dependencies of other developers' modules and apps)
  19. // "freeze": true,
  20. //////////////////////////////////////////////////////////////////////
  21. //////////////////////////////////////////////////////////////////////
  22. // EVERYTHING ELSE:
  23. //////////////////////////////////////////////////////////////////////
  24. // Allow the use of ES6 features.
  25. // (re ES7, see https://github.com/jshint/jshint/issues/2297)
  26. "esversion": 6,
  27. // Allow the use of `eval` and `new Function()`
  28. // (we sometimes actually need to use these things)
  29. "evil": true,
  30. // Tolerate funny-looking dashes in RegExp literals.
  31. // (see https://github.com/jshint/jshint/issues/159#issue-903547)
  32. "regexdash": true,
  33. // The potential runtime "Environments" (as defined by jshint)
  34. // that the _style_ of code written in this package should be
  35. // compatible with (not the code itself, of course).
  36. "browser": true,
  37. "node": true,
  38. "wsh": true,
  39. // Tolerate the use `[]` notation when dot notation would be possible.
  40. // (this is sometimes preferable for readability)
  41. "sub": true,
  42. // Do NOT suppress warnings about mixed tabs and spaces
  43. // (two spaces always, please; see `.editorconfig`)
  44. "smarttabs": false,
  45. // Suppress warnings about trailing whitespace
  46. // (this is already enforced by the .editorconfig, so no need to warn as well)
  47. "trailing": false,
  48. // Suppress warnings about the use of expressions where fn calls or assignments
  49. // are expected, and about using assignments where conditionals are expected.
  50. // (while generally a good idea, without this setting, JSHint needlessly lights up warnings
  51. // in existing, working code that really shouldn't be tampered with. Pandora's box and all.)
  52. "expr": true,
  53. "boss": true,
  54. // Do NOT suppress warnings about using functions inside loops
  55. // (in the general case, we should be using iteratee functions with `_.each()`
  56. // or `Array.prototype.forEach()` instead of `for` or `while` statements
  57. // anyway. This warning serves as a helpful reminder.)
  58. "loopfunc": false,
  59. // Suppress warnings about "weird constructions"
  60. // i.e. allow code like:
  61. // ```
  62. // (new (function OneTimeUsePrototype () { } ))
  63. // ```
  64. //
  65. // (sometimes order of operations in JavaScript can be scary. There is
  66. // nothing wrong with using an extra set of parantheses when the mood
  67. // strikes or you get "that special feeling".)
  68. "supernew": true,
  69. // Do NOT allow backwards, node-dependency-style commas.
  70. // (while this code style choice was used by the project in the past,
  71. // we have since standardized these practices to make code easier to
  72. // read, albeit a bit less exciting)
  73. "laxcomma": false,
  74. // Do NOT allow avant garde use of commas in conditional statements.
  75. // (this prevents accidentally writing code like:
  76. // ```
  77. // if (!_.contains(['+ci', '-ci', '∆ci', '+ce', '-ce', '∆ce']), change.verb) {...}
  78. // ```
  79. // See the problem in that code? Neither did we-- that's the problem!)
  80. "nocomma": true,
  81. // Strictly enforce the consistent use of single quotes.
  82. // (this is a convention that was established primarily to make it easier
  83. // to grep [or FIND+REPLACE in Sublime] particular string literals in
  84. // JavaScript [.js] files. Note that JSON [.json] files are, of course,
  85. // still written exclusively using double quotes around key names and
  86. // around string literals.)
  87. "quotmark": "single",
  88. // Do NOT suppress warnings about the use of `==null` comparisons.
  89. // (please be explicit-- use Lodash or `require('util')` and call
  90. // either `.isNull()` or `.isUndefined()`)
  91. "eqnull": false,
  92. // Strictly enforce the use of curly braces with `if`, `else`, and `switch`
  93. // as well as, much less commonly, `for` and `while` statements.
  94. // (this is just so that all of our code is consistent, and to avoid bugs)
  95. "curly": true,
  96. // Strictly enforce the use of `===` and `!==`.
  97. // (this is always a good idea. Check out "Truth, Equality, and JavaScript"
  98. // by Angus Croll [the author of "If Hemmingway Wrote JavaScript"] for more
  99. // explanation as to why.)
  100. "eqeqeq": true,
  101. // Allow initializing variables to `undefined`.
  102. // For more information, see:
  103. // • https://jslinterrors.com/it-is-not-necessary-to-initialize-a-to-undefined
  104. // • https://github.com/jshint/jshint/issues/1484
  105. //
  106. // (it is often very helpful to explicitly clarify the initial value of
  107. // a local variable-- especially for folks new to more advanced JavaScript
  108. // and who might not recognize the subtle, yet critically important differences between our seemingly
  109. // between `null` and `undefined`, and the impact on `typeof` checks)
  110. "-W080": true
  111. }