ESLint

  1. module.exports = {
  2. root: true,
  3. parser: 'babel-eslint',
  4. parserOptions: {
  5. sourceType: 'module'
  6. },
  7. env: {
  8. browser: true,
  9. node: true,
  10. es6: true,
  11. },
  12. extends: 'eslint:recommended',
  13. //it is base on https://github.com/vuejs/eslint-config-vue
  14. 'rules': {
  15. 'accessor-pairs': 2,
  16. 'arrow-spacing': [2, { 'before': true, 'after': true }],
  17. 'block-spacing': [2, 'always'],
  18. 'brace-style': [2, '1tbs', { 'allowSingleLine': true }],
  19. 'camelcase': [0, { 'properties': 'always' }],
  20. 'comma-dangle': [2, 'always-multiline'],
  21. 'comma-spacing': [2, { 'before': false, 'after': true }],
  22. 'comma-style': [2, 'last'],
  23. 'constructor-super': 2,
  24. 'curly': [2, 'multi-line'],
  25. 'dot-location': [2, 'property'],
  26. 'eol-last': 2,
  27. 'eqeqeq': [2, 'allow-null'],
  28. 'generator-star-spacing': [2, { 'before': true, 'after': true }],
  29. 'handle-callback-err': [2, '^(err|error)$' ],
  30. 'indent': [2, 2, { 'SwitchCase': 1 }],
  31. 'jsx-quotes': [2, 'prefer-double'],
  32. 'key-spacing': [2, { 'beforeColon': false, 'afterColon': true }],
  33. 'keyword-spacing': [2, { 'before': true, 'after': true }],
  34. 'new-cap': [2, { 'newIsCap': true, 'capIsNew': false }],
  35. 'new-parens': 2,
  36. 'no-array-constructor': 2,
  37. 'no-caller': 2,
  38. 'no-console': 'off',
  39. 'no-class-assign': 2,
  40. 'no-cond-assign': 2,
  41. 'no-const-assign': 2,
  42. 'no-control-regex': 2,
  43. 'no-delete-var': 2,
  44. 'no-dupe-args': 2,
  45. 'no-dupe-class-members': 2,
  46. 'no-dupe-keys': 2,
  47. 'no-duplicate-case': 2,
  48. 'no-empty-character-class': 2,
  49. 'no-empty-pattern': 2,
  50. 'no-eval': 2,
  51. 'no-ex-assign': 2,
  52. 'no-extend-native': 2,
  53. 'no-extra-bind': 2,
  54. 'no-extra-boolean-cast': 2,
  55. 'no-extra-parens': [2, 'functions'],
  56. 'no-fallthrough': 2,
  57. 'no-floating-decimal': 2,
  58. 'no-func-assign': 2,
  59. 'no-implied-eval': 2,
  60. 'no-inner-declarations': [2, 'functions'],
  61. 'no-invalid-regexp': 2,
  62. 'no-irregular-whitespace': 2,
  63. 'no-iterator': 2,
  64. 'no-label-var': 2,
  65. 'no-labels': [2, { 'allowLoop': false, 'allowSwitch': false }],
  66. 'no-lone-blocks': 2,
  67. 'no-mixed-spaces-and-tabs': 2,
  68. 'no-multi-spaces': 2,
  69. 'no-multi-str': 2,
  70. 'no-multiple-empty-lines': [2, { 'max': 1 }],
  71. 'no-native-reassign': 2,
  72. 'no-negated-in-lhs': 2,
  73. 'no-new-object': 2,
  74. 'no-new-require': 2,
  75. 'no-new-symbol': 2,
  76. 'no-new-wrappers': 2,
  77. 'no-obj-calls': 2,
  78. 'no-octal': 2,
  79. 'no-octal-escape': 2,
  80. 'no-path-concat': 2,
  81. 'no-proto': 2,
  82. 'no-redeclare': 2,
  83. 'no-regex-spaces': 2,
  84. 'no-return-assign': [2, 'except-parens'],
  85. 'no-self-assign': 2,
  86. 'no-self-compare': 2,
  87. 'no-sequences': 2,
  88. 'no-shadow-restricted-names': 2,
  89. 'no-spaced-func': 2,
  90. 'no-sparse-arrays': 2,
  91. 'no-this-before-super': 2,
  92. 'no-throw-literal': 2,
  93. 'no-trailing-spaces': 2,
  94. 'no-undef': 2,
  95. 'no-undef-init': 2,
  96. 'no-unexpected-multiline': 2,
  97. 'no-unmodified-loop-condition': 2,
  98. 'no-unneeded-ternary': [2, { 'defaultAssignment': false }],
  99. 'no-unreachable': 2,
  100. 'no-unsafe-finally': 2,
  101. 'no-unused-vars': [2, { 'vars': 'all', 'args': 'none' }],
  102. 'no-useless-call': 2,
  103. 'no-useless-computed-key': 2,
  104. 'no-useless-constructor': 2,
  105. 'no-useless-escape': 0,
  106. 'no-whitespace-before-property': 2,
  107. 'no-with': 2,
  108. 'one-var': [2, { 'initialized': 'never' }],
  109. 'operator-linebreak': [2, 'after', { 'overrides': { '?': 'before', ':': 'before' } }],
  110. 'padded-blocks': [2, 'never'],
  111. 'quotes': [2, 'single', { 'avoidEscape': true, 'allowTemplateLiterals': true }],
  112. 'semi': [2, 'always'],
  113. 'semi-spacing': [2, { 'before': false, 'after': true }],
  114. 'space-before-blocks': [2, 'always'],
  115. 'space-before-function-paren': [2, 'never'],
  116. 'space-in-parens': [2, 'never'],
  117. 'space-infix-ops': 2,
  118. 'space-unary-ops': [2, { 'words': true, 'nonwords': false }],
  119. 'spaced-comment': [2, 'always', { 'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ','] }],
  120. 'template-curly-spacing': [2, 'never'],
  121. 'use-isnan': 2,
  122. 'valid-typeof': 2,
  123. 'wrap-iife': [2, 'any'],
  124. 'yield-star-spacing': [2, 'both'],
  125. 'yoda': [2, 'never'],
  126. 'prefer-const': 2,
  127. 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
  128. 'object-curly-spacing': [2, 'always', { objectsInObjects: false }],
  129. 'array-bracket-spacing': [2, 'never']
  130. }
  131. }

Prettier