Skip to content

Comments

[web] Update aliases for using ~/ instead of @ #400

Merged
dgdavid merged 3 commits intomasterfrom
change-aliases
Jan 19, 2023
Merged

[web] Update aliases for using ~/ instead of @ #400
dgdavid merged 3 commits intomasterfrom
change-aliases

Conversation

@dgdavid
Copy link
Contributor

@dgdavid dgdavid commented Jan 19, 2023

Because "@" is used by npm for packages published under a named scope. From their documentation:

The scope name is everything between the @ and the slash

Additionally, "~" use to kind of means "home" or "root", which suits well for an alias pointing to the "root" directory.

Consequently, it is easier to understand now whether an import comes from a dependency or the source code of the project.


Related to #325 and f33e327

@dgdavid dgdavid requested a review from imobachgs January 19, 2023 07:39
@coveralls
Copy link

coveralls commented Jan 19, 2023

Coverage Status

Coverage: 75.821%. Remained the same when pulling b850b67 on change-aliases into 874b266 on master.

"~icons/*": ["node_modules/@material-symbols/svg-400/outlined/*"]
"~/*": ["src/*"],
"~/client": ["src/client/index.js"],
"@icons/*": ["node_modules/@material-symbols/svg-400/outlined/*"]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Use the @ here because this alias actually is a shortcut for an import from a node package.

imobachgs

This comment was marked as outdated.

Because "@" is used by npm for packages published under a named scope[1]. From
their documentation:

  > The scope name is everything between the @ and the slash

Additionally, "~" use to kind of means "home" or "root", which suits well for
an alias pointing to the "root" directory.

Consequently, it is easier to understand now whether an import comes from a
dependency or the source code of the project.

[1] https://docs.npmjs.com/about-scopes
Since we are not alising nested routes (e.g., ~/layout for
src/components/layout or ~/core for src/components/core), most of defined
aliases were actually redundant.
@dgdavid dgdavid merged commit f873778 into master Jan 19, 2023
@dgdavid dgdavid deleted the change-aliases branch January 19, 2023 08:21
@imobachgs imobachgs mentioned this pull request Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants