1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- import type { Linter } from 'eslint';
- import { interopDefault } from '../util';
- export async function perfectionist(): Promise<Linter.Config[]> {
- const perfectionistPlugin = await interopDefault(
- // @ts-expect-error - no types
- import('eslint-plugin-perfectionist'),
- );
- return [
- perfectionistPlugin.configs['recommended-natural'],
- {
- rules: {
- 'perfectionist/sort-exports': [
- 'error',
- {
- order: 'asc',
- type: 'natural',
- },
- ],
- 'perfectionist/sort-imports': [
- 'error',
- {
- customGroups: {
- type: {
- 'vben-core-type': ['^@vben-core/.+'],
- 'vben-type': ['^@vben/.+'],
- 'vue-type': ['^vue$', '^vue-.+', '^@vue/.+'],
- },
- value: {
- vben: ['^@vben/.+'],
- 'vben-core': ['^@vben-core/.+'],
- vue: ['^vue$', '^vue-.+', '^@vue/.+'],
- },
- },
- environment: 'node',
- groups: [
- ['external-type', 'builtin-type', 'type'],
- 'vue-type',
- 'vben-type',
- 'vben-core-type',
- ['parent-type', 'sibling-type', 'index-type'],
- ['internal-type'],
- 'builtin',
- 'vue',
- 'vben',
- 'vben-core',
- 'external',
- 'internal',
- ['parent', 'sibling', 'index'],
- 'side-effect',
- 'side-effect-style',
- 'style',
- 'object',
- 'unknown',
- ],
- internalPattern: ['^#/.+'],
- newlinesBetween: 'always',
- order: 'asc',
- type: 'natural',
- },
- ],
- 'perfectionist/sort-modules': 'off',
- 'perfectionist/sort-named-exports': [
- 'error',
- {
- order: 'asc',
- type: 'natural',
- },
- ],
- 'perfectionist/sort-objects': [
- 'off',
- {
- customGroups: {
- items: 'items',
- list: 'list',
- children: 'children',
- },
- groups: ['unknown', 'items', 'list', 'children'],
- ignorePattern: ['children'],
- order: 'asc',
- type: 'natural',
- },
- ],
- },
- },
- ];
- }
|