Express: 87th Line on express.js starts with ;

Created on 25 Jun 2018  路  5Comments  路  Source: expressjs/express

express is a great framework. I was going through the code and i found that 87th line starts with ';', i am very new to both nodejs and expressjs and i may be completely wrong. does the ; in line 87, is actually the semi colon for line 81? or the line 87 intentionally start with a semi colon?. I am very new to express JS and if it is intentional, can you kindly please explain the purpose of that starting ;, Thank you馃榾

duplicate question

All 5 comments

Hi! Thanks for taking a look. This is just following the StandardJS style and is intentional: https://standardjs.com/rules-en.html#semicolons

Also see previous issue #3558 as well :)

Could potentially be nice to extract the list into a variable, or even unroll the loop so that it doesn't happen when loading the module.

edit: unrolling the loop increases the performance of that part by ~33%, not sure it's worth the increased code size though... Naming the list would probably be nice though: var NO_LONGER_BUNDLED = [...], NO_LONGER_BUNDLED.forEach(...)

@LinusU Since this is at startup I am not sure a perf change is worth the churn. Also FWIW, I think all of this is going to be removed in 5 since it has been there for all of 4.

Yea, the block is deleted in 5.0 branch (AFAIK), but I think we probably should at least move it into a var as @LinusU proposed in the 4.x series. The reasons I'm thinking that is as follows: (1) there has already been two questions (at least) about the "strange placement" of the semicolon so far and (2) it really is just trying to be too-clever and thus clashing with no semicolons style, which is why it seems weird (and an intermediate variable would fix that).

If you guys agree, one of you (@LinusU ?) please feel welcome to open a PR moving it to a variable 馃憤

馃憠 #3678

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nove1398 picture nove1398  路  3Comments

snowdream picture snowdream  路  3Comments

cuni0716 picture cuni0716  路  3Comments

Domiii picture Domiii  路  3Comments

zackarychapple picture zackarychapple  路  3Comments