Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import のエイリアスを可能にした #98

Closed
wants to merge 3 commits into from

Conversation

aster-void
Copy link
Contributor

  • gatsby settings

    • [install] gatsby-plugin-alias-imports (50k install / 5k weekly)
    • [edit] added some aliases to gatsby-config.js
  • eslint settings

    • [install] eslint-import-resolver-alias (250k weekly install)
    • [edit] added alias resolver to eslintrc.js
  • (seemingly) unrelated package updates

Copy link

cloudflare-pages bot commented Jan 10, 2024

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8cc3a91
Status: ✅  Deploy successful!
Preview URL: https://d6e8827a.utcode-website.pages.dev
Branch Preview URL: https://allow-import-aliasing.utcode-website.pages.dev

View logs

@aster-void
Copy link
Contributor Author

tsc は知らないのでやってないです。時間があったら明日やります

Copy link
Contributor

@chelproc chelproc left a comment

Choose a reason for hiding this comment

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

5k/週のライブラリは正直使わないほうがいいと思います
特に npm はパッケージインストール時に任意のプログラムを実行できたりするのでもっと慎重になったほうがいいです。
GitHub のリポジトリもアーカイブされています。メンテ状況とかもちゃんとチェックしたほうがいいですね。
https://github.com/rowanfreeman/gatsby-plugin-alias-imports

基本的にサークルのプロジェクトはメンテコストを可能な限り低く抑えるのが大事です。import 文のわずかな読みやすさと引き換えにプロジェクト構成の複雑化を取るかと言われるとサークルのプロジェクトとしてはナシかなという感じです。

技術的な点を言うと、TypeScript側の設定もしないと型チェックやエディタ支援が動かなくなると思います

@aster-void
Copy link
Contributor Author

https://www.gatsbyjs.com/docs/how-to/custom-configuration/add-custom-webpack-config/#absolute-imports
プラグインなしでもできそうですが、こっちならいいですかね?
TypeScript の config は明日書きます。

@chelproc
Copy link
Contributor

正直 Webpack、ESLint、TypeScriptの3つの設定を弄って頑張って同期を取ってまでこの機能を入れるメリットが見当たらないと思っています。
VSCodeでimport文は自動生成できますし、ファイルを移動したときは自動で書き換えられますし、そもそもimport文を上から読んでいくことはなくないですかね?

@aster-void
Copy link
Contributor Author

正直 Webpack、ESLint、TypeScriptの3つの設定を弄って頑張って同期を取ってまでこの機能を入れるメリットが見当たらないと思っています。
VSCodeでimport文は自動生成できますし、ファイルを移動したときは自動で書き換えられますし、そもそもimport文を上から読んでいくことはなくないですかね?

確かに。じゃあいいか

@aster-void aster-void closed this Jan 11, 2024
@aster-void aster-void deleted the allow-import-aliasing branch January 11, 2024 06:15
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.

None yet

2 participants