refactor: 优化 perfectionist 导入排序规则:首先是类型导入(type),然后是 UI 和组件导入,接着是工具和函数导入

pull/68/head
puhui999 2025-04-07 12:22:28 +08:00
parent b4d1c678fd
commit fccd91fd74
2 changed files with 21 additions and 16 deletions

View File

@ -24,28 +24,33 @@ export async function perfectionist(): Promise<Linter.Config[]> {
{ {
customGroups: { customGroups: {
type: { type: {
'vben-core-type': ['^@vben-core/.+'], 'type-adapter': ['^#/adapter/.+'],
'vben-type': ['^@vben/.+'], 'type-api': ['^#/api/.+'],
'vue-type': ['^vue$', '^vue-.+', '^@vue/.+'], 'type-others': ['.*'],
}, },
value: { value: {
vben: ['^@vben/.+'], 'ui-common': ['^@vben/common-ui'],
'vben-core': ['^@vben-core/.+'], 'ui-antd': ['^ant-design-vue'],
vue: ['^vue$', '^vue-.+', '^@vue/.+'], 'ui-icons': ['^@vben/icons'],
'local-components': ['^\\./modules/.+\\.vue$', '^\\./components/.+\\.vue$'],
'other-components': ['^#/components/.+'],
'utils-locale': ['^#/locales'],
'vue-core': ['^vue$'],
'utils-adapter': ['^#/adapter/.+'],
'utils-api': ['^#/api/system/.+', '^#/api/.+'],
'utils-functions': ['^#/utils/.+'],
'local-data': ['^\\./data$', '^\\./data.ts$'],
}, },
}, },
environment: 'node', environment: 'node',
groups: [ groups: [
['external-type', 'builtin-type', 'type'], ['type-adapter', 'type-api', 'type-others', 'external-type', 'builtin-type', 'type', 'parent-type', 'sibling-type', 'index-type', 'internal-type'],
'vue-type',
'vben-type', ['ui-common', 'ui-antd', 'ui-icons', 'local-components', 'other-components'],
'vben-core-type',
['parent-type', 'sibling-type', 'index-type'], ['utils-locale', 'vue-core', 'utils-adapter', 'utils-api', 'utils-functions', 'local-data'],
['internal-type'],
'builtin', 'builtin',
'vue',
'vben',
'vben-core',
'external', 'external',
'internal', 'internal',
['parent', 'sibling', 'index'], ['parent', 'sibling', 'index'],

View File

@ -10,7 +10,7 @@ export default {
}, },
], ],
plugins: ['prettier-plugin-tailwindcss'], plugins: ['prettier-plugin-tailwindcss'],
printWidth: 80, printWidth: 120,
proseWrap: 'never', proseWrap: 'never',
semi: true, semi: true,
singleQuote: true, singleQuote: true,