Skip to content

refactor(frontend): move to and enforce absolute imports - #8732

Merged
SebastianKrupinski merged 1 commit into
mainfrom
absolute-imports
Aug 16, 2026
Merged

refactor(frontend): move to and enforce absolute imports#8732
SebastianKrupinski merged 1 commit into
mainfrom
absolute-imports

Conversation

@odzhychko

Copy link
Copy Markdown
Contributor

Enforce absolute imports as they were often request in PR reviews ^^

Example before

import useCalendarsStore from '../../../store/calendars.js'

Example after

import useCalendarsStore from '@/store/calendars.js'

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI
    • only used AI for writing eslint.config.mjs
    • changes to imports were done by ESLint
    • changes to path in vi.mock were done by search and replace

Assisted-by: ClaudeCode:claude-opus-4.8
Signed-off-by: Oleksandr Dzhychko <hey@oleks.dev>
@codecov

codecov Bot commented Aug 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@SebastianKrupinski SebastianKrupinski left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank goodness for eslint fix!

@SebastianKrupinski SebastianKrupinski added the 3. to review Waiting for reviews label Aug 16, 2026
@SebastianKrupinski SebastianKrupinski added this to the v6.6.0 milestone Aug 16, 2026
@SebastianKrupinski
SebastianKrupinski merged commit e15bd85 into main Aug 16, 2026
41 of 55 checks passed
@SebastianKrupinski
SebastianKrupinski deleted the absolute-imports branch August 16, 2026 17:48
@SebastianKrupinski

Copy link
Copy Markdown
Contributor

Bypassed failed PHP tests as the failures are unrelated

@susnux

susnux commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

I am curious as this is non standard behavior and always will require tooling plugins, so there must be a benefit larger than that?

@odzhychko

odzhychko commented Aug 21, 2026

Copy link
Copy Markdown
Contributor Author

[...]
Second, absolute imports let me easily move files around. When all imports are absolute, there’s less friction to moving a file, because all of the imports will just boringly work in the new directory.
[...]
Third, absolute imports scale well. A large React component is typically going to have a lot of imports:
[...]

https://www.jakeworth.com/posts/the-joy-of-javascript-absolute-imports/

For me those two points are the main benefits of absolute imports.

Also support of @/ for absolute imports is something the official Vue starter (npm create vue@latest) configures by default. So I guess, it is not too uncommon and kind of a quasi standard 🤷

@SebastianKrupinski

SebastianKrupinski commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

I am curious as this is non standard behavior and always will require tooling plugins, so there must be a benefit larger than that?

The "@/" is supported out of the box with webpack/vite/ts/etc without plug-ins... the plugins are only for usage enforcement.

The main point to it stop the dot insanity "../../../" in some places we had "../../../../../../" makes it hard to figure out which folder you are referencing

@susnux

susnux commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

The "@/" is supported out of the box with webpack/vite/ts/etc without plug-ins... the plugins are only for usage enforcement.

I was more referring to actual standards like ECMA for ESM and thus general tooling support.
But yes I get the benefit for deeply nested code :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants