chore: init read-star monorepo
This commit is contained in:
55
packages/eslint-config/src/index.js
Normal file
55
packages/eslint-config/src/index.js
Normal file
@ -0,0 +1,55 @@
|
||||
import { antfu } from '@antfu/eslint-config'
|
||||
|
||||
export function readStarConfig(options = {}, ...userConfigs) {
|
||||
return antfu(
|
||||
{
|
||||
vue: true,
|
||||
typescript: true,
|
||||
unocss: true,
|
||||
formatters: {
|
||||
css: true,
|
||||
html: true,
|
||||
markdown: 'prettier',
|
||||
},
|
||||
...options,
|
||||
},
|
||||
// --- 针对 Soybean 模版遗留问题的补丁 ---
|
||||
{
|
||||
rules: {
|
||||
// 强制块顺序:script -> template -> style
|
||||
'vue/block-order': [
|
||||
'error',
|
||||
{
|
||||
order: ['script', 'template', 'style'],
|
||||
},
|
||||
],
|
||||
// 1. 解决 vite-env.d.ts 中的旧版规则报错
|
||||
// 告诉 ESLint,如果遇到旧的 @typescript-eslint 前缀,不要报错
|
||||
'@typescript-eslint/no-shadow': 'off',
|
||||
'ts/no-shadow': 'error',
|
||||
|
||||
// 2. 将正则校验中的硬性错误降级为警告
|
||||
// 这样可以跑通 lint,同时在编辑器里给你提示
|
||||
'regexp/no-useless-quantifier': 'warn',
|
||||
'regexp/no-super-linear-backtracking': 'warn',
|
||||
'regexp/no-unused-capturing-group': 'warn',
|
||||
|
||||
// 3. 忽略 JSDoc 校验(Soybean 模版中参数注释不规范)
|
||||
'jsdoc/check-param-names': 'off',
|
||||
|
||||
// 4. 其他 Soybean 自动生成代码的兼容
|
||||
'eslint-comments/no-unlimited-disable': 'off',
|
||||
},
|
||||
},
|
||||
// --- 排除掉不需要校验的自动生成目录 ---
|
||||
{
|
||||
ignores: [
|
||||
'**/router/elegant/**',
|
||||
'**/typings/elegant-router.d.ts',
|
||||
],
|
||||
},
|
||||
...userConfigs,
|
||||
)
|
||||
}
|
||||
|
||||
export default readStarConfig
|
||||
Reference in New Issue
Block a user