refactor: simplify internal require() calls#4056
Merged
rejas merged 1 commit intoMagicMirrorOrg:developfrom Mar 12, 2026
Merged
refactor: simplify internal require() calls#4056rejas merged 1 commit intoMagicMirrorOrg:developfrom
require() calls#4056rejas merged 1 commit intoMagicMirrorOrg:developfrom
Conversation
Collaborator
|
test fails because of #4055 ? Will you rebase so the tests are green before merging? |
Collaborator
Author
|
Yes. I'll rebase tomorrow 🙂 |
Remove unnecessary `__dirname` template-literal prefix from relative require() paths in js/app.js, js/server.js and js/utils.js. Node.js resolves relative require() paths correctly without it.
44bb698 to
3c5a7d9
Compare
rejas
approved these changes
Mar 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Remove unnecessary
__dirnametemplate-literal prefix from relativerequire()paths. Node.js resolves relative require() paths correctly without it.While this may look like nitpicking:
require("./server")is transparent to static analysis tools - IDEs can resolve the path and support go-to-definition. Template literals with__dirnameare opaque to them. It also removes another usage of__dirname, which has no native equivalent in ESM and would need to be replaced there anyway (when we switch to ESM anytime in the future).The import reordering is a side effect:
import-x/ordertreats template-literalrequire()calls differently from plain strings, so the previous order was no longer valid.