.eslintrc.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /*
  2. rigwild's personal ESLint configuration
  3. Using modern JavaScript syntax, very restrictive.
  4. Preferably use with autofix on save.
  5. This config is made for a Babel + Vue.js project (vue-cli).
  6. https://github.com/rigwild
  7. */
  8. // prettier-ignore
  9. module.exports = {
  10. parserOptions: {
  11. parser: 'babel-eslint',
  12. ecmaVersion: 2019,
  13. sourceType: 'module'
  14. },
  15. root: true,
  16. env: {
  17. node: true,
  18. es6: true
  19. },
  20. extends: [
  21. 'plugin:vue/recommended',
  22. '@vue/standard' // Optional, add "@vue/eslint-config-standard" as a devDependency
  23. ],
  24. rules: {
  25. // Possible Errors
  26. // The following rules point out areas where you might have made mistakes.
  27. 'comma-dangle': 1,
  28. 'no-cond-assign': 2,
  29. 'no-constant-condition': 2,
  30. 'no-control-regex': 2,
  31. 'no-debugger': 2,
  32. 'no-dupe-args': 2,
  33. 'no-dupe-keys': 2,
  34. 'no-duplicate-case': 2,
  35. 'no-empty': 2,
  36. 'no-ex-assign': 2,
  37. 'no-extra-boolean-cast': 2,
  38. 'no-extra-parens': 0,
  39. 'no-extra-semi': 2,
  40. 'no-func-assign': 2,
  41. 'no-inner-declarations': 2,
  42. 'no-invalid-regexp': 2,
  43. 'no-irregular-whitespace': 2,
  44. 'no-negated-in-lhs': 2,
  45. 'no-obj-calls': 2,
  46. 'no-regex-spaces': 2,
  47. 'no-sparse-arrays': 2,
  48. 'no-unreachable': 2,
  49. 'use-isnan': 2,
  50. 'valid-jsdoc': 2,
  51. 'valid-typeof': 2,
  52. // Best Practices
  53. // These are rules designed to prevent you from making mistakes.
  54. 'block-scoped-var': 0,
  55. 'complexity': 0,
  56. 'curly': 'off',
  57. 'default-case': 2,
  58. 'dot-notation': 2,
  59. 'eqeqeq': 2,
  60. 'guard-for-in': 2,
  61. 'no-alert': 2,
  62. 'no-caller': 2,
  63. 'no-div-regex': 2,
  64. 'no-else-return': 2,
  65. 'no-eq-null': 2,
  66. 'no-eval': 2,
  67. 'no-extend-native': 2,
  68. 'no-extra-bind': 2,
  69. 'no-fallthrough': 2,
  70. 'no-floating-decimal': 2,
  71. 'no-implied-eval': 2,
  72. 'no-iterator': 2,
  73. 'no-labels': 2,
  74. 'no-lone-blocks': 2,
  75. 'no-loop-func': 0,
  76. 'no-multi-spaces': 2,
  77. 'no-multi-str': 2,
  78. 'no-native-reassign': 2,
  79. 'no-new': 2,
  80. 'no-new-func': 2,
  81. 'no-new-wrappers': 2,
  82. 'no-octal': 2,
  83. 'no-octal-escape': 2,
  84. 'no-proto': 2,
  85. 'no-redeclare': 2,
  86. 'no-script-url': 2,
  87. 'no-self-compare': 2,
  88. 'no-sequences': 0,
  89. 'no-throw-literal': 2,
  90. 'no-void': 2,
  91. 'no-warning-comments': [0, { terms: ['todo', 'fixme'], location: 'start' }],
  92. 'no-with': 2,
  93. 'radix': 2,
  94. 'vars-on-top': 2,
  95. 'wrap-iife': 2,
  96. 'yoda': 2,
  97. // Strict Mode
  98. // These rules relate to using strict mode.
  99. 'strict': 0,
  100. // Variables
  101. // These rules have to do with variable declarations.
  102. 'no-catch-shadow': 2,
  103. 'no-delete-var': 2,
  104. 'no-label-var': 2,
  105. 'no-shadow': 2,
  106. 'no-shadow-restricted-names': 2,
  107. 'no-undef': 2,
  108. 'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
  109. 'no-use-before-define': 2,
  110. // Stylistic Issues
  111. // These rules are purely matters of style and are quite subjective.
  112. 'indent': [1, 2],
  113. 'brace-style': ['error', 'stroustrup'],
  114. 'camelcase': 1,
  115. 'comma-spacing': [1, { before: false, after: true }],
  116. 'comma-style': [1, 'last'],
  117. 'consistent-this': [1, '_this'],
  118. 'eol-last': 1,
  119. 'key-spacing': [1, { beforeColon: false, afterColon: true }],
  120. 'new-cap': [1, { newIsCap: true, capIsNew: false }],
  121. 'new-parens': 1,
  122. 'newline-after-var': 0,
  123. 'no-array-constructor': 1,
  124. 'no-mixed-spaces-and-tabs': 1,
  125. 'no-multiple-empty-lines': [1, { max: 2 }],
  126. 'no-trailing-spaces': 1,
  127. 'no-underscore-dangle': 0,
  128. 'quote-props': [1, 'consistent'],
  129. 'quotes': [1, 'single'],
  130. 'semi': ['error', 'never'],
  131. 'keyword-spacing': 'warn',
  132. 'space-before-function-paren': [1, { anonymous: 'always', named: 'never' }],
  133. 'space-in-parens': [1, 'never'],
  134. 'spaced-comment': 'warn',
  135. // ECMAScript 6
  136. // These rules are only relevant to ES6 environments and are off by default.
  137. 'no-var': 2,
  138. 'promise/param-names': 0,
  139. // Vue.js
  140. 'vue/max-attributes-per-line': 0,
  141. 'vue/attributes-order': 0,
  142. 'vue/singleline-html-element-content-newline': 0,
  143. 'vue/html-self-closing': [
  144. 'error',
  145. {
  146. html: {
  147. void: 'any',
  148. normal: 'any',
  149. component: 'always'
  150. },
  151. svg: 'always',
  152. math: 'always'
  153. }
  154. ]
  155. }
  156. }