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

不推荐使用 camelCase/PascalCase 命名文件 #22

Open
nmsn opened this issue Jul 11, 2022 · 0 comments
Open

不推荐使用 camelCase/PascalCase 命名文件 #22

nmsn opened this issue Jul 11, 2022 · 0 comments
Labels

Comments

@nmsn
Copy link
Owner

nmsn commented Jul 11, 2022

来源:https://medium.com/@martin_hotell/10-typescript-pro-tips-patterns-with-or-without-react-5799488d6680

Don't

SkaterBoy.tsx
userAccessHandlers.ts

Do

skater-boy.tsx
user-access-handlers.ts
  1. 可读性更好

    文中说 my-half-fixed-deduped-dir-resolver vs MyHalfFixedDedupedDirResolver,我觉得差不多

  2. git 更友好(git 默认不区分文件名大小写)

    我觉得这个才是关键点

  3. 一致性(存疑)

    consistency (I don’t have to think if this file is component or some helper or service. tsx extension tells me that)

    文中原话,不是很理解

  4. 和组件名映射清晰(存疑)

    nicely maps to component implementation name skater-boy.tsx 👉 const SkaterBoy = () => {}

    文中原话,那 SkaterBoy.tsx 不是映射关系更清晰么

@nmsn nmsn added the React label Jul 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant