.eslintrc 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. {
  2. 'env': {
  3. 'browser': true,
  4. 'amd': true
  5. },
  6. 'globals': {
  7. 'M': true,
  8. 'Y': true
  9. },
  10. 'rules': {
  11. // See http://eslint.org/docs/rules/ for all rules and explanations of all
  12. // rules.
  13. // === Possible Errors ===
  14. 'comma-dangle': 'off',
  15. 'no-cond-assign': 'error',
  16. 'no-console': 'error',
  17. 'no-constant-condition': 'error',
  18. 'no-control-regex': 'error',
  19. 'no-debugger': 'error',
  20. 'no-dupe-args': 'error',
  21. 'no-dupe-keys': 'error',
  22. 'no-duplicate-case': 'error',
  23. 'no-empty': 'warn',
  24. 'no-empty-character-class': 'error',
  25. 'no-ex-assign': 'error',
  26. 'no-extra-boolean-cast': 'error',
  27. 'no-extra-parens': 'off',
  28. 'no-extra-semi': 'error',
  29. 'no-func-assign': 'error',
  30. 'no-inner-declarations': 'error',
  31. 'no-invalid-regexp': 'error',
  32. 'no-irregular-whitespace': 'error',
  33. 'no-negated-in-lhs': 'error',
  34. 'no-obj-calls': 'error',
  35. 'no-prototype-builtins': 'off',
  36. 'no-regex-spaces': 'error',
  37. 'no-sparse-arrays': 'error',
  38. 'no-unexpected-multiline': 'error',
  39. 'no-unreachable': 'warn',
  40. 'no-unsafe-finally': 'error',
  41. 'use-isnan': 'error',
  42. 'valid-jsdoc': ['warn', { 'requireReturn': false, 'requireParamDescription': false, 'requireReturnDescription': false }],
  43. 'valid-typeof': 'error',
  44. // === Best Practices ===
  45. // (these mostly match our jshint config)
  46. 'array-callback-return': 'warn',
  47. 'block-scoped-var': 'warn',
  48. 'complexity': 'warn',
  49. 'consistent-return': 'warn',
  50. 'curly': 'error',
  51. 'dot-notation': 'warn',
  52. 'no-alert': 'warn',
  53. 'no-caller': 'error',
  54. 'no-case-declarations': 'error',
  55. 'no-div-regex': 'error',
  56. 'no-empty-pattern': 'error',
  57. 'no-empty-function': 'warn',
  58. 'no-eq-null': 'error',
  59. 'no-eval': 'error',
  60. 'no-extend-native': 'error',
  61. 'no-extra-bind': 'warn',
  62. 'no-fallthrough': 'error',
  63. 'no-floating-decimal': 'warn',
  64. // Enabled by grunt for AMD modules: 'no-implicit-globals': 'error',
  65. 'no-implied-eval': 'error',
  66. 'no-invalid-this': 'error',
  67. 'no-iterator': 'error',
  68. 'no-labels': 'error',
  69. 'no-loop-func': 'error',
  70. 'no-multi-spaces': 'warn',
  71. 'no-multi-str': 'error',
  72. 'no-native-reassign': 'warn',
  73. 'no-new-func': 'error',
  74. 'no-new-wrappers': 'error',
  75. 'no-octal': 'error',
  76. 'no-octal-escape': 'error',
  77. 'no-proto': 'error',
  78. 'no-redeclare': 'warn',
  79. 'no-return-assign': 'error',
  80. 'no-script-url': 'error',
  81. 'no-self-assign': 'error',
  82. 'no-self-compare': 'error',
  83. 'no-sequences': 'warn',
  84. 'no-throw-literal': 'warn',
  85. 'no-unmodified-loop-condition': 'error',
  86. 'no-unused-expressions': 'error',
  87. 'no-unused-labels': 'error',
  88. 'no-useless-call': 'warn',
  89. 'no-useless-escape': 'warn',
  90. 'no-with': 'error',
  91. 'wrap-iife': ['error', 'any'],
  92. // === Variables ===
  93. 'no-delete-var': 'error',
  94. 'no-undef': 'error',
  95. 'no-undef-init': 'error',
  96. 'no-unused-vars': ['error', { 'caughtErrors': 'none', 'argsIgnorePattern': "(e|event)" }],
  97. // === Stylistic Issues ===
  98. 'array-bracket-spacing': 'warn',
  99. 'block-spacing': 'warn',
  100. 'brace-style': ['warn', '1tbs'],
  101. 'camelcase': 'warn',
  102. 'comma-spacing': ['warn', { 'before': false, 'after': true }],
  103. 'comma-style': ['warn', 'last'],
  104. 'computed-property-spacing': 'error',
  105. 'consistent-this': 'off',
  106. 'eol-last': 'off',
  107. 'func-names': 'off',
  108. 'func-style': 'off',
  109. // indent currently not doing well with our wrapping style, so disabled.
  110. 'indent': ['off', 4, { 'SwitchCase': 1 }],
  111. 'key-spacing': ['warn', { 'beforeColon': false, 'afterColon': true, 'mode': minimum }],
  112. 'keyword-spacing': 'warn',
  113. 'linebreak-style': ['error', 'unix'],
  114. 'lines-around-comment': 'off',
  115. 'max-len': ['error', 132],
  116. 'max-lines': 'off',
  117. 'max-depth': 'warn',
  118. 'max-nested-callbacks': ['warn', 5],
  119. 'max-params': 'off',
  120. 'max-statements': 'off',
  121. 'max-statements-per-line': ['warn', { max: 2 }],
  122. 'new-cap': ['warn', { 'properties': false }],
  123. 'new-parens': 'warn',
  124. 'newline-after-var': 'off',
  125. 'newline-before-return': 'off',
  126. 'newline-per-chained-call': 'off',
  127. 'no-array-constructor': 'off',
  128. 'no-bitwise': 'error',
  129. 'no-continue': 'off',
  130. 'no-inline-comments': 'off',
  131. 'no-lonely-if': 'off',
  132. 'no-mixed-operators': 'off',
  133. 'no-mixed-spaces-and-tabs': 'error',
  134. 'no-multiple-empty-lines': 'warn',
  135. 'no-negated-condition': 'off',
  136. 'no-nested-ternary': 'warn',
  137. 'no-new-object': 'off',
  138. 'no-plusplus': 'off',
  139. 'no-spaced-func': 'warn',
  140. 'no-ternary': 'off',
  141. 'no-trailing-spaces': 'error',
  142. 'no-underscore-dangle': 'off',
  143. 'no-unneeded-ternary': 'off',
  144. 'no-whitespace-before-property': 'warn',
  145. 'object-curly-newline': 'off',
  146. 'object-curly-spacing': 'warn',
  147. 'object-property-newline': 'off',
  148. 'one-var': 'off',
  149. 'one-var-declaration-per-line': ['warn', 'initializations'],
  150. 'operator-assignment': 'off',
  151. 'operator-linebreak': 'off',
  152. 'padded-blocks': 'off',
  153. 'quote-props': ['warn', 'as-needed', {'unnecessary': false, 'keywords': true, 'numbers': true}],
  154. 'quotes': 'off',
  155. 'require-jsdoc': 'warn',
  156. 'semi': 'error',
  157. 'semi-spacing': ['warn', {'before': false, 'after': true}],
  158. 'sort-vars': 'off',
  159. 'space-before-blocks': 'warn',
  160. 'space-before-function-paren': ['warn', 'never'],
  161. 'space-in-parens': 'warn',
  162. 'space-infix-ops': 'warn',
  163. 'space-unary-ops': 'warn',
  164. 'spaced-comment': 'warn',
  165. 'unicode-bom': 'error',
  166. 'wrap-regex': 'off',
  167. }
  168. }