|  |      1Sin      2018-01-12 09:41:33 +08:00 分号党头顶青天 | 
|      2HuHui      2018-01-12 09:44:58 +08:00 突然想起男厕尿兜上方贴的一句话:前进一小步,文明一大步。 | 
|  |      3k9982874      2018-01-12 09:45:03 +08:00 via iPhone  5 vue 表示 wtf ! | 
|  |      4joshua7v      2018-01-12 09:45:24 +08:00 via Android 格式问题已经交给 prettier | 
|  |      5ctsed      2018-01-12 09:45:28 +08:00 via Android 艹 | 
|  |      6binux      2018-01-12 09:46:16 +08:00 via Android \分号党大胜利 / | 
|      7xiadd      2018-01-12 09:46:28 +08:00 我们现在写的 js 不是直接运行在浏览器里的 基本都需要编译一遍 所以没啥问题 | 
|  |      8dong3580      2018-01-12 09:47:37 +08:00 不知道我设置了什么,一写分号就检查不通过。。。 | 
|  |      9run2      2018-01-12 09:48:24 +08:00 你们真能折腾,偶尔写写 JavaScript 表示被 eslint 去掉;的时候很绝望(直接用项目自带的设置) 所以到底要折腾几种写法出来? | 
|  |      10jlkm2010      2018-01-12 09:50:34 +08:00 终于要带分号了,eslint 不给写分号恶心死了 | 
|      11kosilence      2018-01-12 09:51:09 +08:00 via iPhone 胜利! | 
|  |      12est      2018-01-12 09:51:59 +08:00  14   居然没人贴这个。 | 
|  |      13zhujinliang      2018-01-12 09:52:45 +08:00 via iPhone 耶✌️~ | 
|  |      14swulling      2018-01-12 09:54:34 +08:00 via iPhone 我司的代码规范就已经强制分号了 | 
|      15shaonian      2018-01-12 09:56:32 +08:00  2 ES6 已经定稿...怎么可能写入 ES6... | 
|  |      17oott123      2018-01-12 09:57:45 +08:00 via Android 正式? es6 ? | 
|  |      19hxsf      2018-01-12 09:59:54 +08:00 只是 Open 吧,还没 Merge 呢。。。 | 
|      20realwangyibo      2018-01-12 10:00:13 +08:00 standardjs 或成最大输家 | 
|  |      22kingcc      2018-01-12 10:07:54 +08:00  1 正式 Are you sure ? ES6 Are you sure ? ``` <em>This section is non-normative.</em> ``` | 
|  |      23isCyan      2018-01-12 10:08:52 +08:00 via Android 最喜欢分号了,分号能让思路清晰,分号党万岁 | 
|  |      24kingcc      2018-01-12 10:11:05 +08:00  1 ruanyifeng 那种标题党估计也只有楼主这种智商才会想也不想的转过来水贴 | 
|  |      25adeweb      2018-01-12 10:11:51 +08:00 分号看着难受,上下不对称。 | 
|      27Creabine      2018-01-12 10:14:20 +08:00 不要啊。。。雅蠛蝶。。。 | 
|  |      28autoxbc      2018-01-12 10:17:09 +08:00 分号党坐看好戏 | 
|  |      30lovedebug      2018-01-12 10:36:56 +08:00 还没有实锤,看双方博弈了 | 
|  |      31flashback313      2018-01-12 10:39:14 +08:00 妈蛋,不写分号才好看 | 
|  |      33AV1      2018-01-12 10:50:27 +08:00 连分号都懒得写的干嘛不用 coffeescript ? | 
|  |      34whypool      2018-01-12 10:55:50 +08:00 分号已经成了习惯,比如这样; | 
|  |      35sparkle2015      2018-01-12 11:01:31 +08:00 ... 现在看见分号就想删掉,不能省略分号的语言不是好语言! | 
|  |      36zjqzxc      2018-01-12 11:23:26 +08:00 有段时间写 js 多,也习惯了不加分号; 后来再写 C/PHP 的时候老是忘记分号; 于是就成了坚定的分号党,能加分号绝不省略; | 
|  |      37maplerecall      2018-01-12 11:30:39 +08:00 虽然还不是正式的,不过做为分号党心理还是暗爽的_(:3 」∠)_ | 
|      38MushishiXian      2018-01-12 11:30:46 +08:00 分号党路过... | 
|      39tonymitcher      2018-01-12 11:32:01 +08:00 哈哈,分号党的胜利 | 
|  |      40southsala      2018-01-12 12:04:39 +08:00 不加分好的语言都不是好语言 | 
|      41mooncakejs      2018-01-12 12:33:47 +08:00 @est 竟然还有人喜欢 python 的缩进。上班尺子带了没。 | 
|  |      42Phariel      2018-01-12 12:44:14 +08:00 via Android 强迫症表示不加分号我浑身难受。。。 | 
|  |      43ziki      2018-01-12 12:47:32 +08:00 四个空格啥时候写进标准 /滑稽 | 
|      44xiaojie668329      2018-01-12 12:49:17 +08:00 via iPhone 我不喜欢加分号,但是 prettier 会给我加上去。。。 | 
|      45lyhiving      2018-01-12 12:50:35 +08:00 via Android 习惯加分号 | 
|  |      46blless      2018-01-12 12:53:22 +08:00 @mooncakejs 缩进多了拆分函数啊 看见一个几百行的函数我就头痛 | 
|      47Mitt      2018-01-12 13:14:07 +08:00 妈的 还以为不写分号是大趋势 好不容易接受了设定现在又强制写分号了 | 
|  |      48otakustay      2018-01-12 13:17:12 +08:00  6 这楼里已经没一个人在认真看问题了,我贴一下关键的内容: > 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... 这时候没有明确的分号就会完蛋,那么在更多新语法进来的时候,就会死得更惨 与其这样,还不如推荐大家所有该加分号的地方都加上,保持一种一致的编码形式 | 
|  |      49dtysky      2018-01-12 13:20:47 +08:00 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. | 
|  |      50seki      2018-01-12 13:21:07 +08:00  1 分号?不接受,不参与,不承认,不执行,废纸一张 | 
|  |      51hyyou2010      2018-01-12 13:25:57 +08:00 一直觉得不加很别扭 | 
|  |      53superchijinpeng      2018-01-12 13:33:01 +08:00 via iPhone 上面不是写了 This section is non-normative ? ES 6 不是已经定稿了? 用 ESLint 规范代码貌似可以在新一行的开始加分号解决这个问题,所以说每一个语句都加分号没必要吧。 | 
|  |      54ob      2018-01-12 13:35:35 +08:00 via Android 必须分号; | 
|  |      55xAx      2018-01-12 13:51:47 +08:00 爽,对 vuejs 那套烦的不得了,烧死不加分号的异教徒 | 
|  |      58TimRChen      2018-01-12 14:20:24 +08:00 @dong3580 https://eslint.org/docs/user-guide/configuring#using-eslintrecommended 按配置把"semi": ["error", "always"],去掉,然后再看看? | 
|  |      59banricho      2018-01-12 14:28:46 +08:00 认真看内容的没几个,标题党大行其道 写不写分号是编码习惯,ESLint 配置也可以自己改 怪 ESLint 和 Vue 的不是很懂 | 
|  |      61Martox      2018-01-12 15:03:40 +08:00 我不服 | 
|  |      62an168bang521      2018-01-12 15:06:57 +08:00 js 代码不加分号,感觉就像拉屎不擦屁股; 2333,这个习惯,我应该是很难改了,看到没有分号的代码,总想给补全; | 
|  |      63libook      2018-01-12 15:07:28 +08:00 这个帖子有些标题党。 ES6 是 ECMA-262 6th Edition,如果后续有修改的话不知道是直接给 ES6 打补丁还是在 ES2018 做修订案。 不过这一部分是非规范性的,只是一些建议,最终什么趋势还说不准。 个人喜欢加分号,觉得在 ES 的语言特性方面严格使用分号是一种高可靠性方案; 不过确实此前 ES 的语法情况,末尾分号对语言、引擎和开发程序的设计和实现都没什么实质影响,末尾加不加分号全凭习惯;一些 JS 大牛也认为分号的意义太弱而推崇末尾无分号,综合来看,这确实是合理的。 可能在 ES 的未来发展方面,末尾分号对于语言、引擎的设计和实现造成了影响,未来 ES 对末尾分号的依赖有可能会逐渐增强。以前只需要注意几个特殊情况下特殊处理(如 standardjs 的方案),以保证末尾无分号的风格具备高可靠性;但未来随着新特性的增加,有可能这类特殊情况会越来越多,多到末尾无分号的方案失去其便利优势,到那个时候综合对比可能末尾写分号的代码风格会处于便利性和可靠性的优势地位。 当然都是后话了。 | 
|  |      64alian      2018-01-12 15:23:11 +08:00 表示最近几个月都不加分号开发真的很爽。。。现在这就有点尴尬了 | 
|  |      65dong3580      2018-01-12 15:49:33 +08:00 @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'] } | 
|  |      67deadEgg      2018-01-12 15:59:58 +08:00 “靠猜”这个说法不准确。 不加分号是存在二义性,二义性是 coder 角度的,而不是 parser 角度的。 对于 parser 来说,在你不加分号情况下得到的 AST 结构是稳定正确的。 | 
|      68lzszone      2018-01-12 15:59:58 +08:00  1 分号党昂首挺胸,为所欲为,胡作非为,肆意妄为 非分号党垂头丧气,无地自容,畏首畏尾,自暴自弃!!! | 
|  |      69xuhai951753      2018-01-12 16:35:49 +08:00 另外我还强烈建议把两格空格写进 ES6 标准(我不是在引战) | 
|      71coolcoffee      2018-01-12 17:26:19 +08:00 @xuhai951753  空格几个或者 tab 都没什么关系,大不了每个人用不同的缩进,提交代码的时候自动格式化就好了。 | 
|  |      72leemove      2018-01-12 17:29:38 +08:00 习惯不写分号,至少少按一次最无力的小拇指 哈哈 | 
|  |      73oswuhan      2018-01-12 17:32:53 +08:00 说没写分号习惯的“前端”们,你们不写 CSS 么?号称熟练安装各种 node_module 的全栈前端开发,怎么会不写 CSS ? | 
|  |      74vinsony      2018-01-12 17:58:29 +08:00 好不容易习惯了不加~~ | 
|  |      76madNeal      2018-01-12 18:38:17 +08:00 太赞了 | 
|  |      77hr6r      2018-01-12 18:40:17 +08:00 i dissent | 
|  |      78nosay      2018-01-12 18:48:06 +08:00 不加分号浑身难受 | 
|  |      79oswuhan      2018-01-12 19:03:23 +08:00 @skyadmin 今天撸了一天代码有点累,咱们立场不对立就歇歇。我只是想嘲讽哪些拿熟练安装第三方库以替代学习前端基础内容的人。 | 
|  |      80XueSeason      2018-01-12 19:32:52 +08:00  1 | 
|  |      81marcong95      2018-01-12 20:46:49 +08:00 via Android @oswuhan 所以我也想嘲讽一下你,css、sass、stylus 在「前端的基础内容」这一层面上并没有什么区别。难道 npm 能帮我把样式写好?你这嘲讽的点不太好理解。 我倒是真心不懂回车跟分号作为 EOS 在本质上到底有什么不同。 | 
|      84think2011      2018-01-12 21:27:57 +08:00 prettier +1 | 
|  |      85kingcos      2018-01-12 21:38:29 +08:00 还好 Swift 没有分号😂 | 
|      86xy90321      2018-01-12 21:46:11 +08:00 | 
|      87huclengyue      2018-01-12 22:06:48 +08:00 via Android @est 为什么分号不跟在每句结尾 | 
|      88huclengyue      2018-01-12 22:09:45 +08:00 via Android @mooncakejs 大部分语言都是要求缩进的只是不像 python 那么严格。。个人感觉有缩进的看着清晰。 | 
|  |      89wspsxing      2018-01-12 22:30:23 +08:00 胜利 | 
|  |      91fuxkcsdn      2018-01-12 22:45:59 +08:00 分号满塞! 修改起公司那些前端的代码就恨不得统一格式化 | 
|      92conn4575      2018-01-13 03:22:15 +08:00 via Android 后端表示看了没分号 js 浑身难受!! | 
|      93PythonAnswer      2018-01-13 04:40:02 +08:00 via Android nnd 生效后我就不写 js 了。抗议。 | 
|  |      94jtsai      2018-01-13 08:24:22 +08:00 via Android  1 加分号太丑了,受不了 | 
|  |      95jtsai      2018-01-13 08:46:36 +08:00 via Android 坚决不加分号到代码奔溃 | 
|  |      96doubleflower      2018-01-13 09:36:33 +08:00 看了下和现在没什么区别,都是在 linter 可以处理的范围内 | 
|  |      97awing      2018-01-13 16:29:49 +08:00  1 话说你们说完一句话要加句号吗? 基本上没人加 写完一句代码也不应该加; | 
|  |      98robinlovemaggie      2019-05-05 17:01:10 +08:00 python 党表示键盘上已经没有分号(;)这个键~ |