eslint.config.base.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // Eslint 9.x flat config
  2. const js = require('@eslint/js');
  3. const tseslint = require('typescript-eslint');
  4. const vuePlugin = require('eslint-plugin-vue');
  5. const vueParser = require('vue-eslint-parser');
  6. module.exports = [
  7. js.configs.recommended,
  8. ...tseslint.configs.recommended,
  9. ...vuePlugin.configs['flat/vue3-recommended'],
  10. {
  11. languageOptions: {
  12. ecmaVersion: 'latest',
  13. sourceType: 'module',
  14. parser: vueParser,
  15. parserOptions: {
  16. parser: tseslint.parser,
  17. ecmaVersion: 'latest',
  18. sourceType: 'module'
  19. },
  20. globals: {
  21. // Browser globals
  22. window: 'readonly',
  23. document: 'readonly',
  24. navigator: 'readonly',
  25. console: 'readonly',
  26. localStorage: 'readonly',
  27. sessionStorage: 'readonly',
  28. fetch: 'readonly',
  29. // Node globals
  30. process: 'readonly',
  31. module: 'readonly',
  32. require: 'readonly',
  33. __dirname: 'readonly',
  34. __filename: 'readonly',
  35. // ES2021 globals
  36. Promise: 'readonly',
  37. Symbol: 'readonly',
  38. Map: 'readonly',
  39. Set: 'readonly',
  40. Array: 'readonly',
  41. Object: 'readonly',
  42. String: 'readonly',
  43. Number: 'readonly',
  44. Boolean: 'readonly',
  45. Date: 'readonly',
  46. Error: 'readonly',
  47. setTimeout: 'readonly',
  48. clearTimeout: 'readonly',
  49. setInterval: 'readonly',
  50. clearInterval: 'readonly'
  51. }
  52. },
  53. rules: {
  54. // TypeScript rules
  55. '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
  56. '@typescript-eslint/no-explicit-any': 'warn',
  57. '@typescript-eslint/explicit-module-boundary-types': 'off',
  58. // Vue rules
  59. 'vue/multi-word-component-names': 'off',
  60. 'vue/no-v-html': 'warn',
  61. 'vue/require-default-prop': 'off',
  62. 'vue/require-explicit-emits': 'warn',
  63. // General rules
  64. 'no-console': 'warn',
  65. 'no-debugger': 'warn'
  66. }
  67. },
  68. {
  69. ignores: [
  70. '**/node_modules/**',
  71. '**/dist/**',
  72. '**/*.d.ts'
  73. ]
  74. }
  75. ];