pr软件日常有用吗_JS开发人员获得PR批准的20个超级有用技巧

pr软件日常有用吗

JS开发人员获得PR批准的20个超级有用技巧 (20 Super Useful Tips for JS developers to get your PR approved)

拥有清晰的代码,可节省3分钟的时间 (3mins to save hours by having clean code)

Photo by Marvin Meyer on unsplash
Maven·迈耶 ( Marvin Meyer)

让我们看看大多数开发人员在进行PR或代码审查之前面临的一些常见问题: (Let’s see some common problems which most of the developers face before making a PR or before a code review:)

  1. Don’t forget to keep your branch up to date. As a habit try to get a pull before you start or after you finish your day.

    不要忘记使分支保持最新。 作为一种习惯,尝试在开始之前或结束一天之后获得帮助。
  2. Check the ;(semi-colon) at line endings, end of returns, end of functions etc.

    在行尾,返回结尾,函数结尾等处检查;(分号)。
  3. Remove unused imports, constants etc., that may have been used in development but removed for deployments. I suggest to use a lint such as EsLint.

    删除可能已在开发中使用但为部署而删除的未使用的导入,常量等。 我建议使用诸如EsLint之类的皮棉。
  4. Check if describe.only is removed from test cases.

    检查describe.only是否从测试用例中删除。

5. Check if all testing console logs are removed.

5.检查是否删除了所有测试控制台日志。

6. Check for code alignment and additional spaces at line endings.(I suggest to use lint such as esLint or prettier)

6.检查在行尾代码对准和额外的空间。(我建议使用棉绒如esLint漂亮 )

7. Check if lengthy statements are broken down.(maximum line length of 120)

7.检查冗长的语句是否被分解。(最大行长度为120)

8. Check if functions are defined before calling in all cases.

8.在所有情况下调用之前,请检查是否已定义函数。

9. Check for duplicate code segments, duplicate strings, numbers used as values, etc. and define as constants or extracted to common functions.

9.检查是否有重复的代码段,重复的字符串,用作值的数字等,并将其定义为常量或提取到通用函数中。

10. Keep logical complexity in nested functions to its minimal. Avoid heavy nesting.

10.将嵌套函数的逻辑复杂度降至最低。 避免大量嵌套。

“The most damaging phrase in the language is.. it’s always been done this way” — Grace Hopper

“语言中最具破坏性的短语是..总是用这种方式完成的。” — Grace Hopper

JuniperPhoton on Unsplash unsplash 拍摄的JuniperPhoton照片

11. Since JavaScript is not type safe, add parameter types and return types to ensure type safety in functions.

11.由于JavaScript不是类型安全的,因此添加参数类型和返回类型以确保函数中的类型安全。

12. Organize parameters as follows to increase readability .

12.如下组织参数以提高可读性。

{
non-boolean variables,
booean variables,
functions
}

13. Do not use nouns for function names. Use verbs instead.

13.不要在函数名称中使用名词。 请改用动词。

14. Comment as much as you can. But it is better not to comment unnecessarily.

14.尽可能多地发表评论。 但是最好不要发表不必要的评论。

15. Keep parameter functions and object parameter functions separately.

15.将参数功能和对象参数功能分开保存。

16. Try to make function names, parameters as generic when naming.

16.命名时,尽量使函数名称和参数通用。

17. Try to reduce global variables as much as you can. Use let instead as much as possible.

17.尝试尽可能减少全局变量。 尽可能使用let代替。

18. Modularization - try to limit functions with a single responsibility. Do not over use functions.

18.模块化-尝试以单一职责限制功能。 不要过度使用功能。

19. Use long List of Variables. reduce the “Var” Keyword and Use Commas Instead.

19.使用长变量列表。 减少“ Var”关键字并改用逗号。

var num1;
var num2;
var num3;//use instead
var num1,num2,num3;

20. Double check for typos, camel case notation for function names, and snake case notation for event names.

20.仔细检查拼写错误,函数名称的驼峰表示法和事件名称的蛇形表示法。

Okay. Try to make most out of this article and apply them to your checklist. You won’t regret about the outcomes at the end. Please let me know your feedback after you apply them.

好的。 尝试充分利用本文,并将其应用于您的清单。 最后,您将不会后悔。 应用它们后,请让我知道您的反馈。

Thanks for reading and Happy coding :)

感谢您的阅读和快乐的编码:)

翻译自: https://medium.com/javascript-in-plain-english/20-super-useful-tips-for-js-developers-to-get-your-pr-approved-b078ac78bb6

pr软件日常有用吗

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值