.eslintrc.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. module.exports = {
  2. root: true,
  3. env: {
  4. node: true,
  5. },
  6. extends: [
  7. 'plugin:vue/strongly-recommended',
  8. '@vue/airbnb',
  9. ],
  10. rules: {
  11. "linebreak-style": [0 ,"error", "windows"], //允许windows开发环境
  12. 'class-methods-use-this': 0,
  13. 'no-console': process.env.NODE_ENV === 'production' ? ['error', { allow: ['warn', 'error'] }] : 'off',
  14. 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
  15. 'no-param-reassign': [
  16. 'error',
  17. {
  18. props: true,
  19. ignorePropertyModificationsFor: ['state', 'vm', 'item'],
  20. },
  21. ],
  22. 'import/extensions': [
  23. 'error',
  24. 'always',
  25. {
  26. js: 'never',
  27. vue: 'always',
  28. },
  29. ],
  30. indent: [
  31. 'error',
  32. 4,
  33. {
  34. SwitchCase: 1,
  35. },
  36. ],
  37. 'max-len': [2, 260, 4],
  38. 'vue/attribute-hyphenation': [
  39. 'error',
  40. 'always',
  41. ],
  42. 'vue/attributes-order': 'error',
  43. 'vue/html-closing-bracket-newline': [
  44. 'error',
  45. {
  46. singleline: 'never',
  47. multiline: 'always',
  48. },
  49. ],
  50. 'vue/html-closing-bracket-spacing': 'error',
  51. 'vue/html-end-tags': 'error',
  52. 'vue/html-indent': [
  53. 'error',
  54. 4,
  55. ],
  56. 'vue/html-quotes': [
  57. 'error',
  58. 'double',
  59. ],
  60. 'vue/html-self-closing': 'error',
  61. 'vue/max-attributes-per-line': [
  62. 'error',
  63. {
  64. singleline: 6,
  65. multiline: {
  66. max: 1,
  67. allowFirstLine: false,
  68. },
  69. },
  70. ],
  71. 'vue/no-confusing-v-for-v-if': 'error',
  72. 'vue/no-parsing-error': 'error',
  73. 'vue/no-use-v-if-with-v-for': 'error',
  74. 'vue/no-v-html': 'error',
  75. 'vue/order-in-components': 'error',
  76. 'vue/prop-name-casing': 'error',
  77. 'vue/require-default-prop': 'error',
  78. 'vue/require-prop-types': 'error',
  79. 'vue/script-indent': [
  80. 'error',
  81. 4,
  82. {
  83. baseIndent: 0,
  84. switchCase: 1,
  85. ignores: [],
  86. },
  87. ],
  88. 'vue/this-in-template': 'error',
  89. },
  90. parserOptions: {
  91. parser: 'babel-eslint',
  92. "ecmaFeatures": {
  93. "legacyDecorators": true
  94. }
  95. },
  96. globals: {
  97. 'AMap': false,
  98. 'AMapUI': false,
  99. },
  100. };