eslint.config.mjs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. import vue from 'eslint-plugin-vue';
  2. import typescriptEslint from '@typescript-eslint/eslint-plugin';
  3. import globals from 'globals';
  4. import parser from 'vue-eslint-parser';
  5. import path from 'node:path';
  6. import { fileURLToPath } from 'node:url';
  7. import js from '@eslint/js';
  8. import { FlatCompat } from '@eslint/eslintrc';
  9. const __filename = fileURLToPath(import.meta.url);
  10. const __dirname = path.dirname(__filename);
  11. const compat = new FlatCompat({
  12. baseDirectory: __dirname,
  13. recommendedConfig: js.configs.recommended,
  14. allConfig: js.configs.all,
  15. });
  16. export default [
  17. {
  18. ignores: [
  19. '**/*.sh',
  20. '**/node_modules',
  21. '**/lib',
  22. '**/*.md',
  23. '**/*.scss',
  24. '**/*.woff',
  25. '**/*.ttf',
  26. '**/.vscode',
  27. '**/.idea',
  28. '**/dist',
  29. '**/mock',
  30. '**/public',
  31. '**/bin',
  32. '**/build',
  33. '**/config',
  34. '**/index.html',
  35. 'src/assets',
  36. ],
  37. },
  38. ...compat.extends('plugin:vue/vue3-essential', 'plugin:vue/essential', 'eslint:recommended'),
  39. {
  40. plugins: {
  41. vue,
  42. '@typescript-eslint': typescriptEslint,
  43. },
  44. languageOptions: {
  45. globals: {
  46. ...globals.browser,
  47. ...globals.node,
  48. },
  49. parser: parser,
  50. ecmaVersion: 12,
  51. sourceType: 'module',
  52. parserOptions: {
  53. parser: '@typescript-eslint/parser',
  54. },
  55. },
  56. rules: {
  57. '@typescript-eslint/ban-ts-ignore': 'off',
  58. '@typescript-eslint/explicit-function-return-type': 'off',
  59. '@typescript-eslint/no-explicit-any': 'off',
  60. '@typescript-eslint/no-var-requires': 'off',
  61. '@typescript-eslint/no-empty-function': 'off',
  62. '@typescript-eslint/no-use-before-define': 'off',
  63. '@typescript-eslint/ban-ts-comment': 'off',
  64. '@typescript-eslint/ban-types': 'off',
  65. '@typescript-eslint/no-non-null-assertion': 'off',
  66. '@typescript-eslint/explicit-module-boundary-types': 'off',
  67. '@typescript-eslint/no-redeclare': 'off',
  68. '@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
  69. '@typescript-eslint/no-unused-vars': 'warn',
  70. 'vue/no-unused-vars': 'off',
  71. 'vue/no-mutating-props': 'warn',
  72. 'vue/custom-event-name-casing': 'off',
  73. 'vue/attributes-order': 'off',
  74. 'vue/one-component-per-file': 'off',
  75. 'vue/html-closing-bracket-newline': 'off',
  76. 'vue/max-attributes-per-line': 'off',
  77. 'vue/multiline-html-element-content-newline': 'off',
  78. 'vue/singleline-html-element-content-newline': 'off',
  79. 'vue/attribute-hyphenation': 'off',
  80. 'vue/valid-v-else': 'warn',
  81. 'vue/no-deprecated-filter': 'warn',
  82. 'vue/html-self-closing': 'off',
  83. 'vue/no-multiple-template-root': 'off',
  84. 'vue/require-default-prop': 'off',
  85. 'vue/no-v-model-argument': 'off',
  86. 'vue/no-arrow-functions-in-watch': 'off',
  87. 'vue/no-template-key': 'off',
  88. 'vue/no-v-for-template-key': 'warn',
  89. 'vue/no-v-html': 'off',
  90. 'vue/comment-directive': 'off',
  91. 'vue/no-parsing-error': 'off',
  92. 'vue/no-deprecated-v-on-native-modifier': 'off',
  93. 'vue/multi-word-component-names': 'off',
  94. 'no-constant-binary-expression': 'warn',
  95. 'no-useless-escape': 'off',
  96. 'no-sparse-arrays': 'off',
  97. 'no-prototype-builtins': 'off',
  98. 'no-constant-condition': 'off',
  99. 'no-use-before-define': 'off',
  100. 'no-restricted-globals': 'off',
  101. 'no-restricted-syntax': 'off',
  102. 'generator-star-spacing': 'off',
  103. 'no-unreachable': 'off',
  104. 'no-multiple-template-root': 'off',
  105. 'no-unused-vars': 'off',
  106. 'no-v-model-argument': 'off',
  107. 'no-case-declarations': 'off',
  108. 'no-console': 'off',
  109. 'no-redeclare': 'off',
  110. },
  111. },
  112. {
  113. files: ['**/*.ts', '**/*.tsx', '**/*.vue'],
  114. rules: {
  115. 'no-undef': 'off',
  116. },
  117. },
  118. ];