.eslintrc.cjs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* eslint-env node */
  2. module.exports = {
  3. env: {
  4. browser: true,
  5. es2021: true,
  6. node: true,
  7. 'vue/setup-compiler-macros': true
  8. },
  9. extends: ['plugin:vue/vue3-essential', 'airbnb-base', 'plugin:prettier/recommended', './.eslintrc-auto-import.json'],
  10. parserOptions: {
  11. ecmaVersion: 12,
  12. parser: '@typescript-eslint/parser',
  13. sourceType: 'module'
  14. },
  15. plugins: ['vue', '@typescript-eslint'],
  16. rules: {
  17. 'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
  18. eqeqeq: ['error', 'always'],
  19. 'no-empty': 'off',
  20. 'import/prefer-default-export': 'off',
  21. 'import/no-unresolved': 'off',
  22. 'import/extensions': 'off',
  23. 'import/no-absolute-path': 'off',
  24. 'import/no-extraneous-dependencies': 'off',
  25. 'vue/no-multiple-template-root': 'off',
  26. 'no-console': 'off',
  27. 'vue/multi-word-component-names': 'off',
  28. 'no-param-reassign': 'off',
  29. 'vue/no-v-model-argument': 'off',
  30. 'consistent-return': 'off',
  31. 'vue/no-unused-vars': 'off',
  32. 'vue/no-reserved-keys': 'off',
  33. 'vue/no-unused-components': 'off',
  34. 'vue/no-use-v-if-with-v-for': 'off',
  35. '@typescript-eslint/no-unused-vars': 'off',
  36. 'spaced-comment': 'off',
  37. // 关闭一些过于严格的规则
  38. 'no-use-before-define': 'off',
  39. 'class-methods-use-this': 'off',
  40. 'no-restricted-syntax': 'off',
  41. 'no-restricted-globals': 'off',
  42. 'prefer-destructuring': 'off',
  43. 'no-plusplus': 'off'
  44. },
  45. ignorePatterns: [
  46. 'package.json',
  47. 'tsconfig.json',
  48. 'tsconfig.app.json',
  49. 'tsconfig.node.json',
  50. 'tsconfig.test.json',
  51. 'vite.config.ts',
  52. 'vitest.config.ts',
  53. 'playwright.config.ts'
  54. ],
  55. globals: {
  56. ref: 'readonly',
  57. reactive: 'readonly',
  58. computed: 'readonly',
  59. watch: 'readonly',
  60. watchEffect: 'readonly',
  61. onMounted: 'readonly',
  62. onUnmounted: 'readonly',
  63. defineProps: 'readonly',
  64. defineEmits: 'readonly',
  65. defineExpose: 'readonly',
  66. withDefaults: 'readonly',
  67. ElMessage: 'readonly',
  68. ElMessageBox: 'readonly',
  69. __APP_VERSION__: 'readonly'
  70. }
  71. }