diff --git a/.prettierrc.json b/.prettierrc.json index bc51dad44..560d768c9 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -12,7 +12,7 @@ "tabWidth": 2, "trailingComma": "es5", "useTabs": false, - "importOrder": ["^((api-mocks|components|data|formio|hooks|map|story-utils|types)/(.*)|(api|api-mocks|cache|Context|errors|headers|i18n|sdk|sentry|types|utils))$", "^[./]"], + "importOrder": ["^@/.*", "^((api-mocks|components|data|formio|hooks|map|story-utils|types)/(.*)|(api|api-mocks|cache|Context|errors|headers|i18n|sdk|sentry|types|utils))$", "^[./]"], "importOrderSeparation": true, "importOrderSortSpecifiers": true } diff --git a/jsconfig.json b/jsconfig.json index 5875dc5b6..01a79527b 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -1,6 +1,9 @@ { "compilerOptions": { - "baseUrl": "src" + "baseUrl": "src", + "paths": { + "@/*": ["./*"] + }, }, "include": ["src"] } diff --git a/src/vitest.setup.js b/src/vitest.setup.js index 493ad8515..8076d16c2 100644 --- a/src/vitest.setup.js +++ b/src/vitest.setup.js @@ -4,7 +4,7 @@ // learn more: https://github.com/testing-library/jest-dom import '@testing-library/jest-dom'; -import mswServer from 'api-mocks/msw-server'; +import mswServer from '@/api-mocks/msw-server'; beforeAll(() => mswServer.listen()); afterEach(() => mswServer.resetHandlers()); diff --git a/vite.config.mts b/vite.config.mts index 228685f04..a964490a7 100644 --- a/vite.config.mts +++ b/vite.config.mts @@ -35,5 +35,8 @@ export default defineConfig({ environment: 'jsdom', globals: true, // for compatibility with jest setupFiles: ['./src/vitest.setup.js'], + alias: { + '@/': new URL('./src/', import.meta.url).pathname, + }, }, });