| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- // eslint.config.js
- import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'
- import pluginVue from 'eslint-plugin-vue'
- import eslintPluginJs from '@eslint/js'
- import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'
- import { globalIgnores } from 'eslint/config'
- export default defineConfigWithVueTs(
- // ✅ 基础推荐规则(提供语法检测能力)
- eslintPluginJs.configs.recommended,
- // ✅ Vue 规则
- pluginVue.configs['flat/essential'],
- // ✅ TypeScript 推荐规则
- vueTsConfigs.recommended,
- // ✅ 跳过格式化冲突(Prettier)
- skipFormatting,
- // ✅ 忽略目录
- globalIgnores(['**/dist/**', '**/dist-ssr/**', '**/coverage/**']),
- // ✅ 项目自定义规则
- {
- name: 'app/files-to-lint',
- files: ['**/*.{ts,mts,tsx,vue}'],
- rules: {
- // 🚫 关闭常用约束
- 'vue/multi-word-component-names': 'off',
- '@typescript-eslint/no-explicit-any': 'off',
- // ✅ 强化语法检测
- 'no-unexpected-multiline': 'error',
- 'no-unreachable': 'error',
- 'no-empty': 'error',
- 'no-extra-parens': 'error',
- 'no-fallthrough': 'error',
- },
- },
- )
|