| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import js from '@eslint/js'
- import tseslint from 'typescript-eslint'
- import pluginVue from 'eslint-plugin-vue'
- import prettierConfig from 'eslint-config-prettier'
- export default [
- // 忽略目录
- { ignores: ['dist/**', 'node_modules/**'] },
- // JS 基础规则
- js.configs.recommended,
- // TypeScript 规则
- ...tseslint.configs.recommended,
- // Vue3 规则
- ...pluginVue.configs['flat/recommended'],
- // .vue 文件使用 ts 解析器
- {
- files: ['**/*.vue'],
- languageOptions: {
- parserOptions: {
- parser: tseslint.parser,
- },
- },
- },
- // 关闭与 Prettier 冲突的规则(必须放最后)
- prettierConfig,
- // 自定义规则
- {
- languageOptions: {
- globals: {
- process: 'readonly',
- },
- },
- rules: {
- 'vue/multi-word-component-names': 'off',
- '@typescript-eslint/no-explicit-any': 'warn',
- 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
- },
- },
- ]
|