.eslintrc.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. // @ts-check
  2. const { defineConfig } = require('eslint-define-config')
  3. module.exports = defineConfig({
  4. root: true,
  5. env: {
  6. browser: true,
  7. node: true,
  8. es6: true
  9. },
  10. parser: 'vue-eslint-parser',
  11. parserOptions: {
  12. parser: '@typescript-eslint/parser',
  13. ecmaVersion: 2020,
  14. sourceType: 'module',
  15. jsxPragma: 'React',
  16. ecmaFeatures: {
  17. jsx: true
  18. }
  19. },
  20. globals: {
  21. AMap: false,
  22. AMapUI: false
  23. },
  24. extends: ['plugin:vue/vue3-recommended', 'plugin:@typescript-eslint/recommended', 'prettier', 'plugin:prettier/recommended', './.eslintrc-auto-import.json'],
  25. rules: {
  26. '@typescript-eslint/ban-ts-ignore': 'off',
  27. '@typescript-eslint/explicit-function-return-type': 'off',
  28. '@typescript-eslint/no-explicit-any': 'off',
  29. '@typescript-eslint/no-var-requires': 'off',
  30. '@typescript-eslint/no-empty-function': 'off',
  31. 'vue/custom-event-name-casing': 'off',
  32. 'no-use-before-define': 'off',
  33. '@typescript-eslint/no-use-before-define': 'off',
  34. '@typescript-eslint/ban-ts-comment': 'off',
  35. '@typescript-eslint/ban-types': 'off',
  36. '@typescript-eslint/no-non-null-assertion': 'off',
  37. '@typescript-eslint/explicit-module-boundary-types': 'off',
  38. '@typescript-eslint/no-unused-vars': [
  39. 'error',
  40. {
  41. argsIgnorePattern: '^_',
  42. varsIgnorePattern: '^_'
  43. }
  44. ],
  45. 'no-unused-vars': [
  46. 'error',
  47. {
  48. argsIgnorePattern: '^_',
  49. varsIgnorePattern: '^_'
  50. }
  51. ],
  52. 'space-before-function-paren': 'off',
  53. // "vue/name-property-casing": ["error", "PascalCase"], // vue/component-definition-name-casing 对组件定义名称强制使用特定的大小
  54. 'vue/multi-word-component-names': [
  55. 'error',
  56. {
  57. ignores: ['index'] //需要忽略的组件名
  58. }
  59. ],
  60. 'vue/attributes-order': 'off',
  61. 'vue/one-component-per-file': 'off',
  62. 'vue/html-closing-bracket-newline': 'off',
  63. 'vue/max-attributes-per-line': 'off',
  64. 'vue/multiline-html-element-content-newline': 'off',
  65. 'vue/singleline-html-element-content-newline': 'off',
  66. 'vue/attribute-hyphenation': 'off',
  67. 'vue/require-default-prop': 'off',
  68. 'vue/script-setup-uses-vars': 'error', //防止<script setup>使用的变量<template>被标记为未使用
  69. 'vue/html-self-closing': [
  70. 'error',
  71. {
  72. html: {
  73. void: 'always',
  74. normal: 'never',
  75. component: 'always'
  76. },
  77. svg: 'always',
  78. math: 'always'
  79. }
  80. ]
  81. }
  82. })