Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

.eslintrc.js 8.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. module.exports = {
  2. 'env': {
  3. 'browser': true,
  4. 'commonjs': true,
  5. 'es6': true
  6. },
  7. 'extends': [
  8. 'eslint:recommended',
  9. 'plugin:flowtype/recommended'
  10. ],
  11. 'globals': {
  12. // The globals that (1) are accessed but not defined within many of our
  13. // files, (2) are certainly defined, and (3) we would like to use
  14. // without explicitly specifying them (using a comment) inside of our
  15. // files.
  16. '__filename': false
  17. },
  18. 'parser': 'babel-eslint',
  19. 'parserOptions': {
  20. 'ecmaFeatures': {
  21. 'experimentalObjectRestSpread': true
  22. },
  23. 'sourceType': 'module'
  24. },
  25. 'plugins': [
  26. 'flowtype',
  27. // ESLint's rule no-duplicate-imports does not understand Flow's import
  28. // type. Fortunately, eslint-plugin-import understands Flow's import
  29. // type.
  30. 'import'
  31. ],
  32. 'rules': {
  33. // Possible Errors group
  34. 'no-cond-assign': 2,
  35. 'no-console': 0,
  36. 'no-constant-condition': 2,
  37. 'no-control-regex': 2,
  38. 'no-debugger': 2,
  39. 'no-dupe-args': 2,
  40. 'no-dupe-keys': 2,
  41. 'no-duplicate-case': 2,
  42. 'no-empty': 2,
  43. 'no-empty-character-class': 2,
  44. 'no-ex-assign': 2,
  45. 'no-extra-boolean-cast': 2,
  46. 'no-extra-parens': [
  47. 'error',
  48. 'all',
  49. { 'nestedBinaryExpressions': false }
  50. ],
  51. 'no-extra-semi': 2,
  52. 'no-func-assign': 2,
  53. 'no-inner-declarations': 2,
  54. 'no-invalid-regexp': 2,
  55. 'no-irregular-whitespace': 2,
  56. 'no-negated-in-lhs': 2,
  57. 'no-obj-calls': 2,
  58. 'no-prototype-builtins': 0,
  59. 'no-regex-spaces': 2,
  60. 'no-sparse-arrays': 2,
  61. 'no-unexpected-multiline': 2,
  62. 'no-unreachable': 2,
  63. 'no-unsafe-finally': 2,
  64. 'use-isnan': 2,
  65. 'valid-typeof': 2,
  66. // Best Practices group
  67. 'accessor-pairs': 0,
  68. 'array-callback-return': 2,
  69. 'block-scoped-var': 0,
  70. 'complexity': 0,
  71. 'consistent-return': 0,
  72. 'curly': 2,
  73. 'default-case': 0,
  74. 'dot-location': [ 'error', 'property' ],
  75. 'dot-notation': 2,
  76. 'eqeqeq': 2,
  77. 'guard-for-in': 2,
  78. 'no-alert': 2,
  79. 'no-caller': 2,
  80. 'no-case-declarations': 2,
  81. 'no-div-regex': 0,
  82. 'no-else-return': 2,
  83. 'no-empty-function': 2,
  84. 'no-empty-pattern': 2,
  85. 'no-eq-null': 2,
  86. 'no-eval': 2,
  87. 'no-extend-native': 2,
  88. 'no-extra-bind': 2,
  89. 'no-extra-label': 2,
  90. 'no-fallthrough': 2,
  91. 'no-floating-decimal': 2,
  92. 'no-implicit-coercion': 2,
  93. 'no-implicit-globals': 2,
  94. 'no-implied-eval': 2,
  95. 'no-invalid-this': 2,
  96. 'no-iterator': 2,
  97. 'no-labels': 2,
  98. 'no-lone-blocks': 2,
  99. 'no-loop-func': 2,
  100. 'no-magic-numbers': 0,
  101. 'no-multi-spaces': 2,
  102. 'no-multi-str': 2,
  103. 'no-native-reassign': 2,
  104. 'no-new': 2,
  105. 'no-new-func': 2,
  106. 'no-new-wrappers': 2,
  107. 'no-octal': 2,
  108. 'no-octal-escape': 2,
  109. 'no-param-reassign': 2,
  110. 'no-proto': 2,
  111. 'no-redeclare': 2,
  112. 'no-return-assign': 2,
  113. 'no-script-url': 2,
  114. 'no-self-assign': 2,
  115. 'no-self-compare': 2,
  116. 'no-sequences': 2,
  117. 'no-throw-literal': 2,
  118. 'no-unmodified-loop-condition': 2,
  119. 'no-unused-expressions': [
  120. 'error',
  121. {
  122. 'allowShortCircuit': true,
  123. 'allowTernary': true
  124. }
  125. ],
  126. 'no-unused-labels': 2,
  127. 'no-useless-call': 2,
  128. 'no-useless-concat': 2,
  129. 'no-useless-escape': 2,
  130. 'no-void': 2,
  131. 'no-warning-comments': 0,
  132. 'no-with': 2,
  133. 'radix': 2,
  134. 'vars-on-top': 2,
  135. 'wrap-iife': [ 'error', 'inside' ],
  136. 'yoda': 2,
  137. // Strict Mode group
  138. 'strict': 2,
  139. // Variables group
  140. 'init-declarations': 0,
  141. 'no-catch-shadow': 2,
  142. 'no-delete-var': 2,
  143. 'no-label-var': 2,
  144. 'no-restricted-globals': 0,
  145. 'no-shadow': 2,
  146. 'no-shadow-restricted-names': 2,
  147. 'no-undef': 2,
  148. 'no-undef-init': 2,
  149. 'no-undefined': 0,
  150. 'no-unused-vars': 2,
  151. 'no-use-before-define': [ 'error', { 'functions': false } ],
  152. // Stylistic issues group
  153. 'array-bracket-spacing': [
  154. 'error',
  155. 'always',
  156. { 'objectsInArrays': true }
  157. ],
  158. 'block-spacing': [ 'error', 'always' ],
  159. 'brace-style': 2,
  160. 'camelcase': 2,
  161. 'comma-dangle': 2,
  162. 'comma-spacing': 2,
  163. 'comma-style': 2,
  164. 'computed-property-spacing': 2,
  165. 'consistent-this': [ 'error', 'self' ],
  166. 'eol-last': 2,
  167. 'func-names': 0,
  168. 'func-style': 0,
  169. 'id-blacklist': 0,
  170. 'id-length': 0,
  171. 'id-match': 0,
  172. 'indent': [
  173. 'error',
  174. 4,
  175. {
  176. 'CallExpression': {
  177. arguments: 'off'
  178. },
  179. 'FunctionDeclaration': {
  180. parameters: 2
  181. },
  182. 'FunctionExpression': {
  183. parameters: 2
  184. },
  185. 'MemberExpression': 'off',
  186. 'SwitchCase': 0
  187. }
  188. ],
  189. 'key-spacing': 2,
  190. 'keyword-spacing': 2,
  191. 'linebreak-style': [ 'error', 'unix' ],
  192. 'lines-around-comment': [
  193. 'error',
  194. {
  195. 'allowBlockStart': true,
  196. 'allowObjectStart': true,
  197. 'beforeBlockComment': true,
  198. 'beforeLineComment': true
  199. }
  200. ],
  201. 'max-depth': 2,
  202. 'max-len': [ 'error', 80 ],
  203. 'max-lines': 0,
  204. 'max-nested-callbacks': 2,
  205. 'max-params': 2,
  206. 'max-statements': 0,
  207. 'max-statements-per-line': 2,
  208. 'multiline-ternary': 0,
  209. 'new-cap': 2,
  210. 'new-parens': 2,
  211. 'newline-after-var': 2,
  212. 'newline-before-return': 2,
  213. 'newline-per-chained-call': 2,
  214. 'no-array-constructor': 2,
  215. 'no-bitwise': 2,
  216. 'no-continue': 2,
  217. 'no-inline-comments': 0,
  218. 'no-lonely-if': 2,
  219. 'no-mixed-operators': 2,
  220. 'no-mixed-spaces-and-tabs': 2,
  221. 'no-multiple-empty-lines': 2,
  222. 'no-negated-condition': 2,
  223. 'no-nested-ternary': 0,
  224. 'no-new-object': 2,
  225. 'no-plusplus': 0,
  226. 'no-restricted-syntax': 0,
  227. 'no-spaced-func': 2,
  228. 'no-tabs': 2,
  229. 'no-ternary': 0,
  230. 'no-trailing-spaces': 2,
  231. 'no-underscore-dangle': 0,
  232. 'no-unneeded-ternary': 2,
  233. 'no-whitespace-before-property': 2,
  234. 'object-curly-newline': 0,
  235. 'object-curly-spacing': [ 'error', 'always' ],
  236. 'object-property-newline': 2,
  237. 'one-var': 0,
  238. 'one-var-declaration-per-line': 0,
  239. 'operator-assignment': 0,
  240. 'operator-linebreak': [ 'error', 'before' ],
  241. 'padded-blocks': 0,
  242. 'quote-props': 0,
  243. 'quotes': [ 'error', 'single' ],
  244. 'require-jsdoc': [
  245. 'error',
  246. {
  247. 'require': {
  248. 'ClassDeclaration': true,
  249. 'FunctionDeclaration': true,
  250. 'MethodDefinition': true
  251. }
  252. }
  253. ],
  254. 'semi': [ 'error', 'always' ],
  255. 'semi-spacing': 2,
  256. 'sort-vars': 2,
  257. 'space-before-blocks': 2,
  258. 'space-before-function-paren': [ 'error', 'never' ],
  259. 'space-in-parens': [ 'error', 'never' ],
  260. 'space-infix-ops': 2,
  261. 'space-unary-ops': 2,
  262. 'spaced-comment': 2,
  263. 'unicode-bom': 0,
  264. 'wrap-regex': 0,
  265. // ES6 group rules
  266. 'arrow-body-style': [
  267. 'error',
  268. 'as-needed',
  269. { requireReturnForObjectLiteral: true }
  270. ],
  271. 'arrow-parens': [ 'error', 'as-needed' ],
  272. 'arrow-spacing': 2,
  273. 'constructor-super': 2,
  274. 'generator-star-spacing': 2,
  275. 'no-class-assign': 2,
  276. 'no-confusing-arrow': 2,
  277. 'no-const-assign': 2,
  278. 'no-dupe-class-members': 2,
  279. 'no-new-symbol': 2,
  280. 'no-restricted-imports': 0,
  281. 'no-this-before-super': 2,
  282. 'no-useless-computed-key': 2,
  283. 'no-useless-constructor': 2,
  284. 'no-useless-rename': 2,
  285. 'no-var': 2,
  286. 'object-shorthand': [
  287. 'error',
  288. 'always',
  289. { 'avoidQuotes': true }
  290. ],
  291. 'prefer-arrow-callback': [ 'error', { 'allowNamedFunctions': true } ],
  292. 'prefer-const': 2,
  293. 'prefer-reflect': 0,
  294. 'prefer-rest-params': 2,
  295. 'prefer-spread': 2,
  296. 'prefer-template': 2,
  297. 'require-yield': 2,
  298. 'rest-spread-spacing': 2,
  299. 'sort-imports': 0,
  300. 'template-curly-spacing': 2,
  301. 'yield-star-spacing': 2,
  302. 'import/no-duplicates': 2
  303. }
  304. };