.eslintrc.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. module.exports = {
  2. root: true,
  3. globals: {
  4. defineProps: 'readonly',
  5. defineEmits: 'readonly',
  6. },
  7. parserOptions: {
  8. parser: '@typescript-eslint/parser',
  9. ecmaVersion: 'latest',
  10. sourceType: 'module',
  11. ecmaFeatures: {
  12. jsx: true,
  13. },
  14. },
  15. env: {
  16. browser: true,
  17. node: true,
  18. es6: true,
  19. },
  20. // https://eslint.vuejs.org/
  21. extends: [
  22. 'plugin:@typescript-eslint/recommended',
  23. 'plugin:vue/base',
  24. 'plugin:vue/vue3-essential',
  25. 'plugin:vue/vue3-strongly-recommended',
  26. 'plugin:vue/vue3-recommended',
  27. 'prettier',
  28. ],
  29. // add your custom rules here
  30. rules: {
  31. // override/add rules settings here, such as:
  32. // 'vue/no-unused-vars': 'error'
  33. eqeqeq: ['error', 'always', { null: 'ignore' }],
  34. 'no-var': 2,
  35. 'no-console': 0,
  36. 'no-debugger': 0,
  37. 'no-new-wrappers': 2, // 禁止new String() 等等
  38. 'no-duplicate-imports': 1, // 禁止重复imports
  39. 'no-multiple-empty-lines': [
  40. 1,
  41. {
  42. max: 2,
  43. },
  44. ],
  45. 'no-eval': 2,
  46. semi: 1,
  47. indent: off,
  48. camelcase: 2,
  49. 'vue/no-empty-component-block': 2, // 禁止<template> <script> <style>块为空
  50. 'vue/html-self-closing': 0,
  51. 'vue/max-attributes-per-line': 0,
  52. 'vue/singleline-html-element-content-newline': 0,
  53. 'vue/attribute-hyphenation': 0,
  54. 'vue/multi-word-component-names': 0,
  55. 'vue/html-indent': 0,
  56. 'vue/v-on-event-hyphenation': [2, 'never'],
  57. // Enable vue/script-setup-uses-vars rule
  58. "eqeqeq": 0
  59. },
  60. };