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

根据 2.x 规则和 Airbnb base 规则进行修改,规范规则 #11

Merged
merged 1 commit into from Jul 7, 2016

Conversation

geekdada
Copy link
Member

@geekdada geekdada commented Jun 2, 2016

对规则增加了注释,@since 3.0.0 代表原来未定义或者定义有修改的规则。在规则修改上较尊重 Airbnb 的规则,不过在有差异的地方会根据现有 egg 的代码进行权衡。

@@ -18,7 +18,7 @@
"homepage": "https://github.com/egg-express/eslint-config-egg",
"author": "popomore <sakura9515@gmail.com>",
"scripts": {
"lint": "eslint test index.js",
"lint": "eslint test -c index.js index.js legacy.js rules/*.js",
Copy link
Member

Choose a reason for hiding this comment

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

index.js 重复了

Copy link
Member Author

Choose a reason for hiding this comment

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

一开始没用 .eslintrc,就直接拿 index.js 当配置了…

@fengmk2
Copy link
Member

fengmk2 commented Jun 2, 2016

好详细

@geekdada
Copy link
Member Author

geekdada commented Jun 2, 2016

airbnb 的解释很详细,我基本上就是批量整理

* 条件判断最多允许 11 条路径
* @see http://eslint.org/docs/rules/complexity
*/
complexity: [0, 11],
Copy link
Member

Choose a reason for hiding this comment

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

11 的由来?

Copy link
Member Author

Choose a reason for hiding this comment

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

有的规则第一位是 0,代表关闭,airbnb 和原来的规则都这样写,我就照搬了

Copy link
Member

Choose a reason for hiding this comment

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

只是想知道为何是 11, 不是10, 不是12

@atian25
Copy link
Member

atian25 commented Jun 4, 2016

跑下 egg 和 nut 的 core 代码看看? (test 里面应该可以稍微放松)

@geekdada
Copy link
Member Author

geekdada commented Jun 4, 2016

试过 egg,能通过

@atian25
Copy link
Member

atian25 commented Jun 4, 2016

@eggjs/contributor 大家看看这套规则怎么样, 如果 OK 的话, 后面插件开源时就顺便搞搞

* // 正确
* function doSomething(condition) {
* if (condition) {
* return true;
Copy link
Member

Choose a reason for hiding this comment

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

例子不太好吧,如果返回是 true,那么我们还是希望返回值是 boolean 的,而不是 undefined

Copy link
Member

Choose a reason for hiding this comment

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

function doSomething(condition) {
  if (condition) {
    return;
  }
}

Copy link
Member Author

Choose a reason for hiding this comment

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

重点在于有没有 return,至于 return 什么类型这个依情况而定。

Copy link
Member Author

@geekdada geekdada Jun 20, 2016

Choose a reason for hiding this comment

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

@fengmk2 我觉得这个应该打开,避免方法执行结果不一的情况。并且打开 treatUndefinedAsUnspecified

Copy link
Contributor

Choose a reason for hiding this comment

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

这条规则我记得打开过,怎么又被关掉了?

chair/chair#662

Copy link
Member Author

Choose a reason for hiding this comment

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

修订时的 eslint-config-egg 是关闭的

Copy link
Member

Choose a reason for hiding this comment

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

@geekdada 就按你的来 'consistent-return': 0

@geekdada geekdada force-pushed the revamp branch 2 times, most recently from a940755 to 25bc00b Compare June 22, 2016 13:20
@geekdada
Copy link
Member Author

@fengmk2 我已经全部改完了

@dead-horse
Copy link
Member

注释还是用中文?

@geekdada
Copy link
Member Author

我觉得中英文混合可能会更好

@atian25
Copy link
Member

atian25 commented Jun 24, 2016

按昨天的讨论, 全英文~

中英文混合的话, 担心同步问题.

@geekdada 加油~

@geekdada geekdada force-pushed the revamp branch 2 times, most recently from 81a5afd to d5b4a81 Compare July 3, 2016 07:37
@geekdada
Copy link
Member Author

geekdada commented Jul 3, 2016

所有的注释都已经有英文版本了

@dead-horse
Copy link
Member

中文去掉好了?别中英混了。。

@geekdada
Copy link
Member Author

geekdada commented Jul 4, 2016

@atian25 天猪说中文可以保留…好的,我去掉…

@geekdada
Copy link
Member Author

geekdada commented Jul 7, 2016

@dead-horse @fengmk2 @popomore 麻烦最后检查一下

@fengmk2
Copy link
Member

fengmk2 commented Jul 7, 2016

+1

@fengmk2 fengmk2 merged commit 0f052b7 into eggjs:master Jul 7, 2016
@fengmk2
Copy link
Member

fengmk2 commented Jul 7, 2016

发 minor 还是 major 呢?

@geekdada
Copy link
Member Author

geekdada commented Jul 7, 2016

如果 minor 会挂一大片的…

@dead-horse
Copy link
Member

👍

@fengmk2 fengmk2 added the Major label Jul 7, 2016
@fengmk2
Copy link
Member

fengmk2 commented Jul 7, 2016

@geekdada egg 很多项目都得改?

@popomore
Copy link
Member

popomore commented Jul 8, 2016

major 吧
fengmk2 notifications@github.com于2016年7月8日 周五上午1:50写道:

@geekdada https://github.com/geekdada egg 很多项目都得改?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#11 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAWA1fBbxldiJ9rrTSb9Fz3toSVmRTc7ks5qTTxbgaJpZM4Iseao
.

@geekdada
Copy link
Member Author

geekdada commented Jul 8, 2016

规则和原来比肯定有变动的,而且个别规则可能跟某些人习惯不一样

On Jul 8, 2016 8:48 AM, "Haoliang Gao" notifications@github.com wrote:

major 吧
fengmk2 notifications@github.com于2016年7月8日 周五上午1:50写道:

@geekdada https://github.com/geekdada egg 很多项目都得改?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<
#11 (comment)
,
or mute the thread
<
https://github.com/notifications/unsubscribe/AAWA1fBbxldiJ9rrTSb9Fz3toSVmRTc7ks5qTTxbgaJpZM4Iseao

.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#11 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ADH4YrZaziDtj945f4DXfO_jtWIx0xYNks5qTZ5qgaJpZM4Iseao
.

@popomore
Copy link
Member

popomore commented Jul 8, 2016

可以先在几个库试一下
Roy Li notifications@github.com于2016年7月8日 周五上午8:52写道:

规则和原来比肯定有变动的,而且个别规则可能跟某些人习惯不一样

On Jul 8, 2016 8:48 AM, "Haoliang Gao" notifications@github.com wrote:

major 吧
fengmk2 notifications@github.com于2016年7月8日 周五上午1:50写道:

@geekdada https://github.com/geekdada egg 很多项目都得改?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<

#11 (comment)

,
or mute the thread
<

https://github.com/notifications/unsubscribe/AAWA1fBbxldiJ9rrTSb9Fz3toSVmRTc7ks5qTTxbgaJpZM4Iseao

.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<
#11 (comment)
,
or mute the thread
<
https://github.com/notifications/unsubscribe/ADH4YrZaziDtj945f4DXfO_jtWIx0xYNks5qTZ5qgaJpZM4Iseao

.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#11 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAWA1VZPsnfSAqYauO4g_YyuQ5-Fqqh1ks5qTZ82gaJpZM4Iseao
.

@geekdada
Copy link
Member Author

geekdada commented Jul 8, 2016

我们这边几个库都挂了

2016-07-08 9:00 GMT+08:00 Haoliang Gao notifications@github.com:

可以先在几个库试一下
Roy Li notifications@github.com于2016年7月8日 周五上午8:52写道:

规则和原来比肯定有变动的,而且个别规则可能跟某些人习惯不一样

On Jul 8, 2016 8:48 AM, "Haoliang Gao" notifications@github.com wrote:

major 吧
fengmk2 notifications@github.com于2016年7月8日 周五上午1:50写道:

@geekdada https://github.com/geekdada egg 很多项目都得改?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<

#11 (comment)

,
or mute the thread
<

https://github.com/notifications/unsubscribe/AAWA1fBbxldiJ9rrTSb9Fz3toSVmRTc7ks5qTTxbgaJpZM4Iseao

.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<

#11 (comment)

,
or mute the thread
<

https://github.com/notifications/unsubscribe/ADH4YrZaziDtj945f4DXfO_jtWIx0xYNks5qTZ5qgaJpZM4Iseao

.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<
#11 (comment)
,
or mute the thread
<
https://github.com/notifications/unsubscribe/AAWA1VZPsnfSAqYauO4g_YyuQ5-Fqqh1ks5qTZ82gaJpZM4Iseao

.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#11 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ADH4YgaqIvydIDGF1BXgQ2TOE2Gwfhwjks5qTaFEgaJpZM4Iseao
.

李一航
Roy Li

@fengmk2
Copy link
Member

fengmk2 commented Jul 8, 2016

我发 3.0

@fengmk2
Copy link
Member

fengmk2 commented Jul 8, 2016

@popomore 好吧,忘记了,只有你能发,我已经 push 到 master 了

npm owner ls
popomore <sakura9515@gmail.com>

@geekdada geekdada deleted the revamp branch July 8, 2016 03:30
@popomore
Copy link
Member

popomore commented Jul 8, 2016

加你了

  • eslint-config-egg@3.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants