.jshintrc 5.4 KB

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