.eslintrc.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. module.exports = {
  2. root: true,
  3. env: {
  4. browser: true,
  5. es6: true,
  6. node: true,
  7. jest: true,
  8. },
  9. plugins: ['vue', 'vuejs-accessibility'],
  10. extends: ['plugin:vue/vue3-essential', '@vue/airbnb'],
  11. rules: {
  12. 'vue/script-setup-uses-vars': 'off',
  13. 'vue/custom-event-name-casing': 'off',
  14. 'vuejs-accessibility/rule-name': 'off',
  15. 'vue/no-deprecated-slot-attribute': 'off',
  16. 'vue/experimental-script-setup-vars': 'off',
  17. 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
  18. 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
  19. 'no-shadow': 0,
  20. 'no-plusplus': 0, // 禁止使用++,--
  21. 'guard-for-in': 0,
  22. 'no-extra-semi': 0, // 和prettier冲突
  23. 'import/extensions': 0, // import不需要写文件扩展名
  24. semi: ['error', 'never'], // 无分号
  25. 'import/no-unresolved': 0,
  26. 'no-restricted-syntax': 0,
  27. 'no-underscore-dangle': 0, // 无下划线
  28. 'no-restricted-syntax': 0,
  29. 'consistent-return': 'off',
  30. 'max-len': ['error', { code: 200 }],
  31. 'no-use-before-define': 'off',
  32. 'no-prototype-builtins': 'off',
  33. 'class-methods-use-this': 'off',
  34. 'template-curly-spacing': 'off',
  35. 'arrow-parens': ['error', 'as-needed'],
  36. 'vue/multi-word-component-names': 'off',
  37. 'comma-dangle': ['error', 'only-multiline'],
  38. 'no-param-reassign': ['error', { props: false }],
  39. 'vuejs-accessibility/click-events-have-key-events': 'off',
  40. 'import/no-extraneous-dependencies': ['error', { devDependencies: ['script/**/*.js'] }],
  41. indent: [
  42. 'warn',
  43. 2,
  44. {
  45. ignoredNodes: ['TemplateLiteral'],
  46. SwitchCase: 1,
  47. },
  48. ],
  49. 'object-curly-newline': [
  50. 'error',
  51. {
  52. ImportDeclaration: 'never',
  53. },
  54. ],
  55. },
  56. parserOptions: {
  57. parser: '@babel/eslint-parser',
  58. },
  59. }