diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index a7a5ccb..1f8bd9d 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -1,6 +1,6 @@ -import { defineConfig } from 'vitepress' import type { DefaultTheme } from 'vitepress' import UnoCSS from 'unocss/vite' +import { defineConfig } from 'vitepress' import { description, version } from '../../package.json' import { github, name, ogImage, ogUrl, releases } from './meta' diff --git a/eslint.config.mjs b/eslint.config.mjs index db7232e..9707b8e 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,5 +1,5 @@ -// @ts-check import { createConfigForNuxt } from '@nuxt/eslint-config/flat' +import perfectionist from 'eslint-plugin-perfectionist' export default createConfigForNuxt({ features: { @@ -12,3 +12,30 @@ export default createConfigForNuxt({ ], }, }) + .append({ + plugins: { + perfectionist, + }, + rules: { + 'import/order': 'off', + 'perfectionist/sort-exports': ['error', { order: 'asc', type: 'natural' }], + 'perfectionist/sort-imports': ['error', { + groups: [ + 'type', + ['parent-type', 'sibling-type', 'index-type'], + 'builtin', + 'external', + ['internal', 'internal-type'], + ['parent', 'sibling', 'index'], + 'side-effect', + 'object', + 'unknown', + ], + newlinesBetween: 'ignore', + order: 'asc', + type: 'natural', + }], + 'perfectionist/sort-named-exports': ['error', { order: 'asc', type: 'natural' }], + 'perfectionist/sort-named-imports': ['error', { order: 'asc', type: 'natural' }], + }, + }) diff --git a/package.json b/package.json index de75ac6..8b18400 100644 --- a/package.json +++ b/package.json @@ -67,6 +67,7 @@ "@types/node": "^22.9.0", "bumpp": "^9.8.1", "eslint": "^9.14.0", + "eslint-plugin-perfectionist": "^3.9.1", "nuxt": "^3.14.159", "openapi-typescript": "^7.4.3", "typescript": "^5.6.3", diff --git a/playground/pages/jsonPlaceholder.vue b/playground/pages/jsonPlaceholder.vue index 28ca28f..e85e5f5 100644 --- a/playground/pages/jsonPlaceholder.vue +++ b/playground/pages/jsonPlaceholder.vue @@ -1,7 +1,7 @@