.eslintrc 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. {
  2. "parser": "babel-eslint",
  3. "ecmaFeatures": {
  4. "jsx": true,
  5. "modules": true
  6. },
  7. "env": {
  8. "browser": true,
  9. "es6": true,
  10. "mocha": true, // we use Chai, but close enough,
  11. "jquery": true // hard-loaded into vendor.js
  12. },
  13. "globals": {
  14. "require": false,
  15. "expect": false,
  16. "sinon": false,
  17. "MockApiClient": true,
  18. "TestStubs": true,
  19. "Raven": true,
  20. "jest": true
  21. },
  22. "plugins": [
  23. "react",
  24. "getsentry"
  25. ],
  26. "rules": {
  27. /**
  28. * Strict mode
  29. */
  30. "strict": [
  31. 2,
  32. "global"
  33. ], // http://eslint.org/docs/rules/strict
  34. /**
  35. * ES6
  36. */
  37. "no-var": 2, // http://eslint.org/docs/rules/no-var
  38. "prefer-const": 0, // http://eslint.org/docs/rules/prefer-const
  39. /**
  40. * Variables
  41. */
  42. "no-shadow": 2, // http://eslint.org/docs/rules/no-shadow
  43. "no-shadow-restricted-names": 2, // http://eslint.org/docs/rules/no-shadow-restricted-names
  44. "no-undef": 2, // http://eslint.org/docs/rules/no-undef
  45. "no-unused-vars": [
  46. 2,
  47. { // http://eslint.org/docs/rules/no-unused-vars
  48. "vars": "local",
  49. "args": "none"
  50. }
  51. ],
  52. "no-use-before-define": 2, // http://eslint.org/docs/rules/no-use-before-define
  53. /**
  54. * Possible errors
  55. */
  56. "comma-dangle": [
  57. 0,
  58. "always-multiline"
  59. ], // http://eslint.org/docs/rules/comma-dangle
  60. "no-cond-assign": [
  61. 2,
  62. "always"
  63. ], // http://eslint.org/docs/rules/no-cond-assign
  64. "no-console": 1, // http://eslint.org/docs/rules/no-console
  65. "no-debugger": 1, // http://eslint.org/docs/rules/no-debugger
  66. "no-alert": 1, // http://eslint.org/docs/rules/no-alert
  67. "no-constant-condition": 1, // http://eslint.org/docs/rules/no-constant-condition
  68. "no-dupe-keys": 2, // http://eslint.org/docs/rules/no-dupe-keys
  69. "no-duplicate-case": 2, // http://eslint.org/docs/rules/no-duplicate-case
  70. "no-empty": 2, // http://eslint.org/docs/rules/no-empty
  71. "no-ex-assign": 2, // http://eslint.org/docs/rules/no-ex-assign
  72. "no-extra-boolean-cast": 0, // http://eslint.org/docs/rules/no-extra-boolean-cast
  73. "no-extra-semi": 2, // http://eslint.org/docs/rules/no-extra-semi
  74. "no-func-assign": 2, // http://eslint.org/docs/rules/no-func-assign
  75. "no-inner-declarations": 2, // http://eslint.org/docs/rules/no-inner-declarations
  76. "no-invalid-regexp": 2, // http://eslint.org/docs/rules/no-invalid-regexp
  77. "no-irregular-whitespace": 2, // http://eslint.org/docs/rules/no-irregular-whitespace
  78. "no-obj-calls": 2, // http://eslint.org/docs/rules/no-obj-calls
  79. "no-sparse-arrays": 2, // http://eslint.org/docs/rules/no-sparse-arrays
  80. "no-unreachable": 2, // http://eslint.org/docs/rules/no-unreachable
  81. "semi": [
  82. 2,
  83. "always"
  84. ], // http://eslint.org/docs/rules/semi.html
  85. "use-isnan": 2, // http://eslint.org/docs/rules/use-isnan
  86. "block-scoped-var": 2, // http://eslint.org/docs/rules/block-scoped-var
  87. /**
  88. * Best practices
  89. */
  90. "consistent-return": 2, // http://eslint.org/docs/rules/consistent-return
  91. "curly": 0, // http://eslint.org/docs/rules/curly [REVISIT ME]
  92. "default-case": 2, // http://eslint.org/docs/rules/default-case
  93. "dot-notation": [
  94. 2,
  95. { // http://eslint.org/docs/rules/dot-notation
  96. "allowKeywords": true
  97. }
  98. ],
  99. "eqeqeq": 0, // http://eslint.org/docs/rules/eqeqeq [REVISIT ME]
  100. "guard-for-in": 0, // http://eslint.org/docs/rules/guard-for-in [REVISIT ME]
  101. "jsx-quotes": [
  102. 2,
  103. "prefer-double"
  104. ], // http://eslint.org/docs/rules/jsx-quotes
  105. "no-caller": 2, // http://eslint.org/docs/rules/no-caller
  106. "no-else-return": 0, // http://eslint.org/docs/rules/no-else-return [REVISIT ME]
  107. "no-eq-null": 2, // http://eslint.org/docs/rules/no-eq-null
  108. "no-eval": 2, // http://eslint.org/docs/rules/no-eval
  109. "no-extend-native": 2, // http://eslint.org/docs/rules/no-extend-native
  110. "no-extra-bind": 2, // http://eslint.org/docs/rules/no-extra-bind
  111. "no-fallthrough": 2, // http://eslint.org/docs/rules/no-fallthrough
  112. "no-floating-decimal": 2, // http://eslint.org/docs/rules/no-floating-decimal
  113. "no-implied-eval": 2, // http://eslint.org/docs/rules/no-implied-eval
  114. "no-lone-blocks": 2, // http://eslint.org/docs/rules/no-lone-blocks
  115. "no-loop-func": 2, // http://eslint.org/docs/rules/no-loop-func
  116. "no-multi-str": 2, // http://eslint.org/docs/rules/no-multi-str
  117. "no-native-reassign": 2, // http://eslint.org/docs/rules/no-native-reassign
  118. "no-new": 2, // http://eslint.org/docs/rules/no-new
  119. "no-new-func": 2, // http://eslint.org/docs/rules/no-new-func
  120. "no-new-wrappers": 2, // http://eslint.org/docs/rules/no-new-wrappers
  121. "no-octal": 2, // http://eslint.org/docs/rules/no-octal
  122. "no-octal-escape": 2, // http://eslint.org/docs/rules/no-octal-escape
  123. "no-param-reassign": 0, // http://eslint.org/docs/rules/no-param-reassign [REVISIT ME]
  124. "no-proto": 2, // http://eslint.org/docs/rules/no-proto
  125. "no-redeclare": 2, // http://eslint.org/docs/rules/no-redeclare
  126. "no-return-assign": 2, // http://eslint.org/docs/rules/no-return-assign
  127. "no-script-url": 2, // http://eslint.org/docs/rules/no-script-url
  128. "no-self-compare": 2, // http://eslint.org/docs/rules/no-self-compare
  129. "no-sequences": 2, // http://eslint.org/docs/rules/no-sequences
  130. "no-throw-literal": 2, // http://eslint.org/docs/rules/no-throw-literal
  131. "no-with": 2, // http://eslint.org/docs/rules/no-with
  132. "quotes": [
  133. 2,
  134. "single",
  135. {
  136. "avoidEscape": true
  137. }
  138. ], // http://eslint.org/docs/rules/quotes.html
  139. "radix": 2, // http://eslint.org/docs/rules/radix
  140. "computed-property-spacing": [
  141. 2,
  142. "never"
  143. ], // http://eslint.org/docs/rules/space-in-brackets.html
  144. "array-bracket-spacing": [
  145. 2,
  146. "never"
  147. ], // http://eslint.org/docs/rules/space-in-brackets.html
  148. "object-curly-spacing": [
  149. 2,
  150. "never"
  151. ], // http://eslint.org/docs/rules/space-in-brackets.html
  152. "space-infix-ops": 2, // http://eslint.org/docs/rules/space-infix-ops.html
  153. "vars-on-top": 0, // http://eslint.org/docs/rules/vars-on-top
  154. "wrap-iife": [
  155. 2,
  156. "any"
  157. ], // http://eslint.org/docs/rules/wrap-iife
  158. "yoda": 2, // http://eslint.org/docs/rules/yoda
  159. /**
  160. * React
  161. */
  162. "react/display-name": 0, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md
  163. "react/no-multi-comp": [
  164. 0,
  165. {
  166. "ignoreStateless": true
  167. }
  168. ], // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md
  169. "react/jsx-key": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-key.md
  170. "react/jsx-no-undef": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md
  171. "react/jsx-no-duplicate-props": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md
  172. "react/jsx-uses-react": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md
  173. "react/jsx-uses-vars": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md
  174. "react/no-did-mount-set-state": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md
  175. "react/no-did-update-set-state": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md"
  176. "react/no-unknown-property": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md
  177. "react/prop-types": [
  178. 2,
  179. {
  180. "ignore": [
  181. "className",
  182. "children",
  183. "location",
  184. "params"
  185. ]
  186. }
  187. ],
  188. "react/react-in-jsx-scope": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md
  189. "react/self-closing-comp": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
  190. "react/sort-comp": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-comp.md
  191. "react/jsx-wrap-multilines": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/wrap-multilines.md
  192. /**
  193. * Custom
  194. */
  195. "getsentry/jsx-needs-il8n": 0, // highlights literals in JSX components w/o translation tags
  196. }
  197. }