1
Sin Jan 12, 2018
分号党头顶青天
|
2
HuHui Jan 12, 2018
突然想起男厕尿兜上方贴的一句话:前进一小步,文明一大步。
|
3
k9982874 Jan 12, 2018 via iPhone vue 表示 wtf !
|
4
joshua7v Jan 12, 2018 via Android
格式问题已经交给 prettier
|
5
ctsed Jan 12, 2018 via Android
艹
|
6
binux Jan 12, 2018 via Android
\分号党大胜利 /
|
7
xiadd Jan 12, 2018
我们现在写的 js 不是直接运行在浏览器里的 基本都需要编译一遍 所以没啥问题
|
8
dong3580 Jan 12, 2018
不知道我设置了什么,一写分号就检查不通过。。。
|
9
run2 Jan 12, 2018
你们真能折腾,偶尔写写 JavaScript 表示被 eslint 去掉;的时候很绝望(直接用项目自带的设置)
所以到底要折腾几种写法出来? |
10
jlkm2010 Jan 12, 2018
终于要带分号了,eslint 不给写分号恶心死了
|
11
kosilence Jan 12, 2018 via iPhone
胜利!
|
12
est Jan 12, 2018 居然没人贴这个。 |
13
zhujinliang Jan 12, 2018 via iPhone
耶✌️~
|
14
swulling Jan 12, 2018 via iPhone
我司的代码规范就已经强制分号了
|
15
shaonian Jan 12, 2018 ES6 已经定稿...怎么可能写入 ES6...
|
17
oott123 Jan 12, 2018 via Android
正式?
es6 ? |
19
hxsf Jan 12, 2018
只是 Open 吧,还没 Merge 呢。。。
|
20
realwangyibo Jan 12, 2018
standardjs 或成最大输家
|
22
kingcc Jan 12, 2018 正式 Are you sure ?
ES6 Are you sure ? ``` <em>This section is non-normative.</em> ``` |
23
isCyan Jan 12, 2018 via Android
最喜欢分号了,分号能让思路清晰,分号党万岁
|
24
kingcc Jan 12, 2018 ruanyifeng 那种标题党估计也只有楼主这种智商才会想也不想的转过来水贴
|
25
adeweb Jan 12, 2018
分号看着难受,上下不对称。
|
27
Creabine Jan 12, 2018
不要啊。。。雅蠛蝶。。。
|
28
autoxbc Jan 12, 2018
分号党坐看好戏
|
30
lovedebug Jan 12, 2018
还没有实锤,看双方博弈了
|
31
flashback313 Jan 12, 2018
妈蛋,不写分号才好看
|
33
AV1 Jan 12, 2018
连分号都懒得写的干嘛不用 coffeescript ?
|
34
whypool Jan 12, 2018
分号已经成了习惯,比如这样;
|
35
sparkle2015 Jan 12, 2018
... 现在看见分号就想删掉,不能省略分号的语言不是好语言!
|
36
zjqzxc Jan 12, 2018
有段时间写 js 多,也习惯了不加分号;
后来再写 C/PHP 的时候老是忘记分号; 于是就成了坚定的分号党,能加分号绝不省略; |
37
maplerecall Jan 12, 2018
虽然还不是正式的,不过做为分号党心理还是暗爽的_(:3 」∠)_
|
38
MushishiXian Jan 12, 2018
分号党路过...
|
39
tonymitcher Jan 12, 2018
哈哈,分号党的胜利
|
40
southsala Jan 12, 2018
不加分好的语言都不是好语言
|
41
mooncakejs Jan 12, 2018
@est 竟然还有人喜欢 python 的缩进。上班尺子带了没。
|
42
Phariel Jan 12, 2018 via Android
强迫症表示不加分号我浑身难受。。。
|
43
ziki Jan 12, 2018
四个空格啥时候写进标准 /滑稽
|
44
voidcomma Jan 12, 2018 via iPhone
我不喜欢加分号,但是 prettier 会给我加上去。。。
|
45
lyhiving Jan 12, 2018 via Android
习惯加分号
|
46
blless Jan 12, 2018
@mooncakejs 缩进多了拆分函数啊 看见一个几百行的函数我就头痛
|
47
Mitt Jan 12, 2018
妈的 还以为不写分号是大趋势 好不容易接受了设定现在又强制写分号了
|
48
otakustay Jan 12, 2018 这楼里已经没一个人在认真看问题了,我贴一下关键的内容:
> What we state here is that using ASI style is likely to lead to an inconsistent programming style in the future and in result code that requires higher cognitive load to work with. 确实分号自动插入(可省分号)在当前是工作得 OK 的,但是这导致在新语法进来后,需要手动写分号的地方越来越多,那么你写代码的时候就需要越来越多的思考“这里能不能省分号”,变得不友好 > The crux of the issue is that ASI makes it harder for the language to evolve. This is not an opinion but a fact. The committee has tried hard to support a semicolon-free coding style so far, but there are cases where it ’ s not feasible to do so (@bmeck repeatedly pointed to one), and there will be more in the future. 省分号已经严重影响了新的语法的设计,当前的 Class Property 已经遇到这个问题,后面更多语法总会有各种各样的边界情况 --- 这里一个本质的问题其实不在于分号,而在于:ES 不把换行符当作语法的分隔符 这一特性导致一个 ES 片段是可以写在多行里的,比如这么写: const a = 0 [x].map... 这时候没有明确的分号就会完蛋,那么在更多新语法进来的时候,就会死得更惨 与其这样,还不如推荐大家所有该加分号的地方都加上,保持一种一致的编码形式 |
49
dtysky Jan 12, 2018
Error Correction
One of the most hotly contested religious wars in the JS community (besides tabs vs. spaces) is whether to rely heavily/exclusively on ASI or not. Most, but not all, semicolons are optional, but the two ;s in the for ( .. ) .. loop header are required. On the pro side of this debate, many developers believe that ASI is a useful mechanism that allows them to write more terse (and more "beautiful") code by omitting all but the strictly required ;s (which are very few). It is often asserted that ASI makes many ;s optional, so a correctly written program without them is no different than a correctly written program with them. On the con side of the debate, many other developers will assert that there are too many places that can be accidental gotchas, especially for newer, less experienced developers, where unintended ;s being magically inserted change the meaning. Similarly, some developers will argue that if they omit a semicolon, it's a flat-out mistake, and they want their tools (linters, etc.) to catch it before the JS engine corrects the mistake under the covers. Let me just share my perspective. A strict reading of the spec implies that ASI is an "error correction" routine. What kind of error, you may ask? Specifically, a parser error. In other words, in an attempt to have the parser fail less, ASI lets it be more tolerant. But tolerant of what? In my view, the only way a parser error occurs is if it's given an incorrect/errored program to parse. So, while ASI is strictly correcting parser errors, the only way it can get such errors is if there were first program authoring errors -- omitting semicolons where the grammar rules require them. So, to put it more bluntly, when I hear someone claim that they want to omit "optional semicolons," my brain translates that claim to "I want to write the most parser-broken program I can that will still work." I find that to be a ludicrous position to take and the arguments of saving keystrokes and having more "beautiful code" to be weak at best. Furthermore, I don't agree that this is the same thing as the spaces vs tabs debate -- that it's purely cosmetic -- but rather I believe it's a fundamental question of writing code that adheres to grammar requirements vs. code that relies on grammar exceptions to just barely skate through. Another way of looking at it is that relying on ASI is essentially considering newlines to be significant "whitespace." Other languages like Python have true significant whitespace. But is it really appropriate to think of JavaScript as having significant newlines as it stands today? My take: use semicolons wherever you know they are "required," and limit your assumptions about ASI to a minimum. |
50
seki Jan 12, 2018 分号?不接受,不参与,不承认,不执行,废纸一张
|
51
hyyou2010 Jan 12, 2018
一直觉得不加很别扭
|
53
cutiechi Jan 12, 2018 via iPhone
上面不是写了 This section is non-normative ?
ES 6 不是已经定稿了? 用 ESLint 规范代码貌似可以在新一行的开始加分号解决这个问题,所以说每一个语句都加分号没必要吧。 |
54
ob Jan 12, 2018 via Android
必须分号;
|
55
xAx Jan 12, 2018
爽,对 vuejs 那套烦的不得了,烧死不加分号的异教徒
|
58
TimRChen Jan 12, 2018
@dong3580 https://eslint.org/docs/user-guide/configuring#using-eslintrecommended 按配置把"semi": ["error", "always"],去掉,然后再看看?
|
59
banricho Jan 12, 2018
认真看内容的没几个,标题党大行其道
写不写分号是编码习惯,ESLint 配置也可以自己改 怪 ESLint 和 Vue 的不是很懂 |
61
Martox Jan 12, 2018
我不服
|
62
an168bang521 Jan 12, 2018
js 代码不加分号,感觉就像拉屎不擦屁股;
2333,这个习惯,我应该是很难改了,看到没有分号的代码,总想给补全; |
63
libook Jan 12, 2018
这个帖子有些标题党。
ES6 是 ECMA-262 6th Edition,如果后续有修改的话不知道是直接给 ES6 打补丁还是在 ES2018 做修订案。 不过这一部分是非规范性的,只是一些建议,最终什么趋势还说不准。 个人喜欢加分号,觉得在 ES 的语言特性方面严格使用分号是一种高可靠性方案; 不过确实此前 ES 的语法情况,末尾分号对语言、引擎和开发程序的设计和实现都没什么实质影响,末尾加不加分号全凭习惯;一些 JS 大牛也认为分号的意义太弱而推崇末尾无分号,综合来看,这确实是合理的。 可能在 ES 的未来发展方面,末尾分号对于语言、引擎的设计和实现造成了影响,未来 ES 对末尾分号的依赖有可能会逐渐增强。以前只需要注意几个特殊情况下特殊处理(如 standardjs 的方案),以保证末尾无分号的风格具备高可靠性;但未来随着新特性的增加,有可能这类特殊情况会越来越多,多到末尾无分号的方案失去其便利优势,到那个时候综合对比可能末尾写分号的代码风格会处于便利性和可靠性的优势地位。 当然都是后话了。 |
64
alian Jan 12, 2018
表示最近几个月都不加分号开发真的很爽。。。现在这就有点尴尬了
|
65
dong3580 Jan 12, 2018
@TimRChen
看了看,我没那个配置嘛,是不是 babel-eslint 的原因呢? root: true, parser: 'babel-eslint', parserOptions: { sourceType: 'module' }, env: { browser: true, commonjs: true, es6: true, jquery: true }, extends: 'standard', plugins: ['html'], rules: { 'arrow-parens': 0, 'generator-star-spacing': 0, quotes: ['error', 'single'] } |
67
deadEgg Jan 12, 2018
“靠猜”这个说法不准确。
不加分号是存在二义性,二义性是 coder 角度的,而不是 parser 角度的。 对于 parser 来说,在你不加分号情况下得到的 AST 结构是稳定正确的。 |
68
lzszone Jan 12, 2018 分号党昂首挺胸,为所欲为,胡作非为,肆意妄为
非分号党垂头丧气,无地自容,畏首畏尾,自暴自弃!!! |
69
xuhai951753 Jan 12, 2018
另外我还强烈建议把两格空格写进 ES6 标准(我不是在引战)
|
71
coolcoffee Jan 12, 2018
@xuhai951753 空格几个或者 tab 都没什么关系,大不了每个人用不同的缩进,提交代码的时候自动格式化就好了。
|
72
leemove Jan 12, 2018
习惯不写分号,至少少按一次最无力的小拇指 哈哈
|
73
oswuhan Jan 12, 2018
说没写分号习惯的“前端”们,你们不写 CSS 么?号称熟练安装各种 node_module 的全栈前端开发,怎么会不写 CSS ?
|
74
vinsony Jan 12, 2018
好不容易习惯了不加~~
|
76
madNeal Jan 12, 2018
太赞了
|
77
hr6r Jan 12, 2018
i dissent
|
78
nosay Jan 12, 2018
不加分号浑身难受
|
80
XueSeason Jan 12, 2018 |
81
marcong95 Jan 12, 2018 via Android
@oswuhan 所以我也想嘲讽一下你,css、sass、stylus 在「前端的基础内容」这一层面上并没有什么区别。难道 npm 能帮我把样式写好?你这嘲讽的点不太好理解。
我倒是真心不懂回车跟分号作为 EOS 在本质上到底有什么不同。 |
84
think2011 Jan 12, 2018
prettier +1
|
85
kingcos Jan 12, 2018
还好 Swift 没有分号😂
|
87
huclengyue Jan 12, 2018 via Android
@est 为什么分号不跟在每句结尾
|
88
huclengyue Jan 12, 2018 via Android
@mooncakejs 大部分语言都是要求缩进的只是不像 python 那么严格。。个人感觉有缩进的看着清晰。
|
89
wspsxing Jan 12, 2018
胜利
|
91
fuxkcsdn Jan 12, 2018
分号满塞!
修改起公司那些前端的代码就恨不得统一格式化 |
92
conn4575 Jan 13, 2018 via Android
后端表示看了没分号 js 浑身难受!!
|
93
PythonAnswer Jan 13, 2018 via Android
nnd 生效后我就不写 js 了。抗议。
|
94
jtsai Jan 13, 2018 via Android 加分号太丑了,受不了
|
95
jtsai Jan 13, 2018 via Android
坚决不加分号到代码奔溃
|
96
doubleflower Jan 13, 2018
看了下和现在没什么区别,都是在 linter 可以处理的范围内
|
97
awing Jan 13, 2018 话说你们说完一句话要加句号吗?
基本上没人加 写完一句代码也不应该加; |
98
robinlovemaggie May 5, 2019
python 党表示键盘上已经没有分号(;)这个键~
|