You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

.eslintrc.js 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. module.exports = {
  2. 'extends': '../.eslintrc.js',
  3. 'parserOptions': {
  4. 'ecmaFeatures': {
  5. 'jsx': true
  6. }
  7. },
  8. 'plugins': [
  9. 'jsdoc',
  10. 'react',
  11. 'react-native'
  12. ],
  13. 'rules': {
  14. // Possible Errors group
  15. // Currently, we are using both valid-jsdoc and 'jsdoc' plugin. In the
  16. // future we might stick to one as soon as it has all the features.
  17. 'valid-jsdoc': [
  18. 'error',
  19. {
  20. 'matchDescription': '.+',
  21. 'prefer': {
  22. 'arg': 'param',
  23. 'argument': 'param',
  24. 'return': 'returns'
  25. },
  26. 'preferType': {
  27. 'array': 'Array',
  28. 'Boolean': 'boolean',
  29. 'function': 'Function',
  30. 'Number': 'number',
  31. 'object': 'Object',
  32. 'String': 'string'
  33. },
  34. 'requireParamDescription': true,
  35. 'requireReturn': true,
  36. 'requireReturnDescription': false,
  37. 'requireReturnType': true
  38. }
  39. ],
  40. // Best Practices group
  41. 'jsx-quotes': [ 'error', 'prefer-single' ],
  42. // ES6 group rules
  43. // JsDoc plugin rules group. The following rules are in addition to
  44. // valid-jsdoc rule.
  45. 'jsdoc/check-param-names': 0,
  46. 'jsdoc/check-tag-names': 2,
  47. 'jsdoc/check-types': 0,
  48. 'jsdoc/newline-after-description': 2,
  49. // XXX Because the following plugin is not very smart about words which
  50. // legitimately begin with uppercase characters mid-sentence, set it to
  51. // warn only.
  52. 'jsdoc/require-description-complete-sentence': 1,
  53. 'jsdoc/require-hyphen-before-param-description': 2,
  54. // The following 5 rules are covered by valid-jsdoc, so disable them.
  55. 'jsdoc/require-param': 0,
  56. 'jsdoc/require-param-description': 0,
  57. 'jsdoc/require-param-type': 0,
  58. 'jsdoc/require-returns-description': 0,
  59. 'jsdoc/require-returns-type': 0,
  60. // React plugin rules group
  61. 'react/display-name': 0,
  62. 'react/forbid-prop-types': 0,
  63. 'react/no-danger': 2,
  64. 'react/no-deprecated': 2,
  65. 'react/no-did-mount-set-state': 2,
  66. 'react/no-did-update-set-state': 2,
  67. 'react/no-direct-mutation-state': 2,
  68. 'react/no-find-dom-node': 2,
  69. 'react/no-is-mounted': 2,
  70. 'react/no-multi-comp': 2,
  71. 'react/no-render-return-value': 2,
  72. 'react/no-set-state': 0,
  73. 'react/no-string-refs': 2,
  74. 'react/no-unknown-property': 2,
  75. 'react/prefer-es6-class': 2,
  76. 'react/prefer-stateless-function': 0,
  77. 'react/prop-types': 2,
  78. 'react/react-in-jsx-scope': 2,
  79. 'react/require-extension': 0,
  80. 'react/require-optimization': 0,
  81. 'react/require-render-return': 2,
  82. 'react/self-closing-comp': 2,
  83. 'react/sort-comp': 0,
  84. 'react/sort-prop-types': 2,
  85. // React plugin JSX-specific rule group
  86. 'react/jsx-boolean-value': [ 'error', 'always' ],
  87. 'react/jsx-closing-bracket-location': [
  88. 'error',
  89. 'after-props'
  90. ],
  91. 'react/jsx-curly-spacing': [
  92. 'error',
  93. 'always',
  94. {
  95. 'spacing': {
  96. 'objectLiterals': 'never'
  97. }
  98. }
  99. ],
  100. 'react/jsx-equals-spacing': [ 'error', 'always' ],
  101. 'react/jsx-filename-extension': 0,
  102. 'react/jsx-first-prop-new-line': [ 'error', 'multiline' ],
  103. 'react/jsx-handler-names': [
  104. 'error',
  105. {
  106. 'eventHandlerPrefix': '_on',
  107. 'eventHandlerPropPrefix': 'on'
  108. }
  109. ],
  110. 'react/jsx-indent': 2,
  111. 'react/jsx-indent-props': 2,
  112. 'react/jsx-key': 2,
  113. 'react/jsx-max-props-per-line': 2,
  114. 'react/jsx-no-bind': 2,
  115. 'react/jsx-no-comment-textnodes': 2,
  116. 'react/jsx-no-duplicate-props': 2,
  117. 'react/jsx-no-literals': 0,
  118. 'react/jsx-no-target-blank': 2,
  119. 'react/jsx-no-undef': 2,
  120. 'react/jsx-pascal-case': 2,
  121. 'react/jsx-sort-props': 2,
  122. 'react/jsx-tag-spacing': [
  123. 'error',
  124. {
  125. 'beforeSelfClosing': 'always'
  126. }
  127. ],
  128. 'react/jsx-uses-react': 2,
  129. 'react/jsx-uses-vars': 2,
  130. 'react/jsx-wrap-multilines': 2,
  131. // React Native plugin rules group
  132. 'react-native/no-color-literals': 2,
  133. 'react-native/no-inline-styles': 2,
  134. 'react-native/no-unused-styles': 2,
  135. 'react-native/split-platform-components': 2
  136. }
  137. };