.jshintrc 5.4 KB

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