2025-06-21 17:29:42 +08:00
|
|
|
|
import uniHelper from '@uni-helper/eslint-config'
|
2025-06-21 16:50:31 +08:00
|
|
|
|
|
2025-06-21 17:29:42 +08:00
|
|
|
|
export default uniHelper({
|
2025-06-21 16:50:31 +08:00
|
|
|
|
unocss: true,
|
|
|
|
|
|
vue: true,
|
2025-06-21 16:59:01 +08:00
|
|
|
|
markdown: false,
|
|
|
|
|
|
ignores: [
|
2025-09-25 15:52:47 +08:00
|
|
|
|
// 忽略uni_modules目录
|
|
|
|
|
|
'**/uni_modules/',
|
|
|
|
|
|
// 忽略原生插件目录
|
|
|
|
|
|
'**/nativeplugins/',
|
2025-06-21 16:59:01 +08:00
|
|
|
|
'dist',
|
2025-06-23 11:39:29 +08:00
|
|
|
|
// unplugin-auto-import 生成的类型文件,每次提交都改变,所以加入这里吧,与 .gitignore 配合使用
|
|
|
|
|
|
'auto-import.d.ts',
|
|
|
|
|
|
// vite-plugin-uni-pages 生成的类型文件,每次切换分支都一堆不同的,所以直接 .gitignore
|
|
|
|
|
|
'uni-pages.d.ts',
|
|
|
|
|
|
// 插件生成的文件
|
|
|
|
|
|
'src/pages.json',
|
|
|
|
|
|
'src/manifest.json',
|
|
|
|
|
|
// 忽略自动生成文件
|
2025-09-11 09:46:49 +08:00
|
|
|
|
'src/service/**',
|
2025-06-21 16:59:01 +08:00
|
|
|
|
],
|
2025-09-08 18:09:26 +08:00
|
|
|
|
// https://eslint-config.antfu.me/rules
|
2025-06-21 16:59:01 +08:00
|
|
|
|
rules: {
|
2025-08-19 17:07:42 +08:00
|
|
|
|
'no-useless-return': 'off',
|
2025-06-21 16:59:01 +08:00
|
|
|
|
'no-console': 'off',
|
|
|
|
|
|
'no-unused-vars': 'off',
|
|
|
|
|
|
'vue/no-unused-refs': 'off',
|
|
|
|
|
|
'unused-imports/no-unused-vars': 'off',
|
|
|
|
|
|
'eslint-comments/no-unlimited-disable': 'off',
|
|
|
|
|
|
'jsdoc/check-param-names': 'off',
|
|
|
|
|
|
'jsdoc/require-returns-description': 'off',
|
|
|
|
|
|
'ts/no-empty-object-type': 'off',
|
2025-06-21 17:11:17 +08:00
|
|
|
|
'no-extend-native': 'off',
|
2025-12-12 19:17:50 +08:00
|
|
|
|
'style/brace-style': 'off', // 参考 https://github.com/antfu/eslint-config/issues/322 帖子:关闭此规则,使用下面的 brace-style 规则
|
2025-08-01 22:13:15 +08:00
|
|
|
|
'vue/singleline-html-element-content-newline': [
|
|
|
|
|
|
'error',
|
|
|
|
|
|
{
|
2025-08-07 16:32:27 +08:00
|
|
|
|
externalIgnores: ['text'],
|
2025-08-01 22:13:15 +08:00
|
|
|
|
},
|
|
|
|
|
|
],
|
2025-09-08 18:09:26 +08:00
|
|
|
|
// vue SFC 调换顺序改这里
|
2025-12-12 19:17:50 +08:00
|
|
|
|
// 解释 by 芋艿:为什么 script 开始放在 template 前面:https://yb.tencent.com/s/1fYYlgBopLAT
|
2025-09-08 18:09:26 +08:00
|
|
|
|
'vue/block-order': ['error', {
|
|
|
|
|
|
order: [['script', 'template'], 'style'],
|
|
|
|
|
|
}],
|
2025-12-12 19:17:50 +08:00
|
|
|
|
// add by 芋艿:else、catch、} 等,不换行:https://zh-hans.eslint.org/docs/latest/rules/brace-style
|
|
|
|
|
|
'brace-style': ['error', '1tbs', {
|
|
|
|
|
|
allowSingleLine: true,
|
|
|
|
|
|
}],
|
2025-06-21 16:59:01 +08:00
|
|
|
|
},
|
2025-06-23 11:39:29 +08:00
|
|
|
|
formatters: {
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Format CSS, LESS, SCSS files, also the `<style>` blocks in Vue
|
|
|
|
|
|
* By default uses Prettier
|
|
|
|
|
|
*/
|
|
|
|
|
|
css: true,
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Format HTML files
|
|
|
|
|
|
* By default uses Prettier
|
|
|
|
|
|
*/
|
|
|
|
|
|
html: true,
|
|
|
|
|
|
},
|
2025-06-21 16:50:31 +08:00
|
|
|
|
})
|