2024-05-19 13:20:42 +00:00
|
|
|
|
import type { Linter } from 'eslint';
|
|
|
|
|
|
2024-07-07 14:14:40 +00:00
|
|
|
|
const restrictedImportIgnores = [
|
|
|
|
|
'**/vite.config.mts',
|
|
|
|
|
'**/tailwind.config.mjs',
|
|
|
|
|
'**/postcss.config.mjs',
|
|
|
|
|
];
|
|
|
|
|
|
2024-08-04 05:02:01 +00:00
|
|
|
|
const customConfig: Linter.Config[] = [
|
2024-07-07 15:52:19 +00:00
|
|
|
|
// shadcn-ui 内部组件是自动生成的,不做太多限制
|
2024-05-19 13:20:42 +00:00
|
|
|
|
{
|
2024-06-23 12:03:41 +00:00
|
|
|
|
files: ['packages/@core/ui-kit/shadcn-ui/**/**'],
|
2024-05-19 13:20:42 +00:00
|
|
|
|
rules: {
|
|
|
|
|
'vue/require-default-prop': 'off',
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-08-09 15:27:18 +00:00
|
|
|
|
{
|
|
|
|
|
files: ['packages/effects/**/**', 'packages/types/**/**'],
|
|
|
|
|
ignores: restrictedImportIgnores,
|
|
|
|
|
rules: {
|
|
|
|
|
'perfectionist/sort-interfaces': 'off',
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-07-07 14:14:40 +00:00
|
|
|
|
{
|
|
|
|
|
// apps内部的一些基础规则
|
|
|
|
|
files: ['apps/**/**'],
|
|
|
|
|
ignores: restrictedImportIgnores,
|
|
|
|
|
rules: {
|
|
|
|
|
'no-restricted-imports': [
|
|
|
|
|
'error',
|
|
|
|
|
{
|
|
|
|
|
patterns: [
|
|
|
|
|
{
|
|
|
|
|
group: ['#/api/*'],
|
|
|
|
|
message:
|
|
|
|
|
'The #/api package cannot be imported, please use the @core package itself',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
group: ['#/layouts/*'],
|
|
|
|
|
message:
|
|
|
|
|
'The #/layouts package cannot be imported, please use the @core package itself',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
group: ['#/locales/*'],
|
|
|
|
|
message:
|
|
|
|
|
'The #/locales package cannot be imported, please use the @core package itself',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
group: ['#/stores/*'],
|
|
|
|
|
message:
|
|
|
|
|
'The #/stores package cannot be imported, please use the @core package itself',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
],
|
2024-08-09 15:27:18 +00:00
|
|
|
|
'perfectionist/sort-interfaces': 'off',
|
2024-07-07 14:14:40 +00:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
// @core内部组件,不能引入@vben/* 里面的包
|
|
|
|
|
files: ['packages/@core/**/**'],
|
|
|
|
|
ignores: restrictedImportIgnores,
|
|
|
|
|
rules: {
|
|
|
|
|
'no-restricted-imports': [
|
|
|
|
|
'error',
|
|
|
|
|
{
|
|
|
|
|
patterns: [
|
|
|
|
|
{
|
|
|
|
|
group: ['@vben/*'],
|
|
|
|
|
message:
|
|
|
|
|
'The @core package cannot import the @vben package, please use the @core package itself',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
// @core/shared内部组件,不能引入@vben/* 或者 @vben-core/* 里面的包
|
2024-07-30 13:05:03 +00:00
|
|
|
|
files: ['packages/@core/base/**/**'],
|
2024-07-07 14:14:40 +00:00
|
|
|
|
ignores: restrictedImportIgnores,
|
|
|
|
|
rules: {
|
|
|
|
|
'no-restricted-imports': [
|
|
|
|
|
'error',
|
|
|
|
|
{
|
|
|
|
|
patterns: [
|
|
|
|
|
{
|
|
|
|
|
group: ['@vben/*', '@vben-core/*'],
|
|
|
|
|
message:
|
|
|
|
|
'The @vben-core/shared package cannot import the @vben package, please use the @core/shared package itself',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
// 不能引入@vben/*里面的包
|
|
|
|
|
files: [
|
|
|
|
|
'packages/types/**/**',
|
|
|
|
|
'packages/utils/**/**',
|
|
|
|
|
'packages/icons/**/**',
|
|
|
|
|
'packages/constants/**/**',
|
|
|
|
|
'packages/styles/**/**',
|
2024-07-29 14:11:22 +00:00
|
|
|
|
'packages/stores/**/**',
|
|
|
|
|
'packages/preferences/**/**',
|
|
|
|
|
'packages/locales/**/**',
|
2024-07-07 14:14:40 +00:00
|
|
|
|
],
|
|
|
|
|
ignores: restrictedImportIgnores,
|
|
|
|
|
rules: {
|
|
|
|
|
'no-restricted-imports': [
|
|
|
|
|
'error',
|
|
|
|
|
{
|
|
|
|
|
patterns: [
|
|
|
|
|
{
|
|
|
|
|
group: ['@vben/*'],
|
|
|
|
|
message:
|
|
|
|
|
'The @vben package cannot be imported, please use the @core package itself',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
// 后端模拟代码,不需要太多规则
|
2024-06-23 05:19:55 +00:00
|
|
|
|
{
|
2024-08-01 13:05:31 +00:00
|
|
|
|
files: ['apps/backend-mock/**/**', 'docs/**/**'],
|
2024-06-23 05:19:55 +00:00
|
|
|
|
rules: {
|
|
|
|
|
'@typescript-eslint/no-extraneous-class': 'off',
|
2024-07-20 03:14:32 +00:00
|
|
|
|
'n/no-extraneous-import': 'off',
|
2024-07-20 00:31:05 +00:00
|
|
|
|
'n/prefer-global/buffer': 'off',
|
2024-07-29 14:11:22 +00:00
|
|
|
|
'n/prefer-global/process': 'off',
|
2024-06-23 05:19:55 +00:00
|
|
|
|
'no-console': 'off',
|
2024-06-30 14:28:35 +00:00
|
|
|
|
'unicorn/prefer-module': 'off',
|
2024-06-23 05:19:55 +00:00
|
|
|
|
},
|
|
|
|
|
},
|
2024-07-20 00:31:05 +00:00
|
|
|
|
{
|
|
|
|
|
files: ['internal/**/**'],
|
|
|
|
|
rules: {
|
|
|
|
|
'no-console': 'off',
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-05-19 13:20:42 +00:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
export { customConfig };
|