开发者

Local variable naming convention with JS Lint

开发者 https://www.devze.com 2023-03-05 10:17 出处:网络
Industry standard for most locally scoped variables is an \'_\' but JS Lint complains mightily about these _\'s.

Industry standard for most locally scoped variables is an '_' but JS Lint complains mightily about these _'s.

Does anyone else have a naming convention for locally scoped variable开发者_StackOverflow社区s in a JavaScript file


We develop in .NET here, and made the simple decision to standardize on a simple convention. C# and JavaScript code should be as close to one another as possible.

Hence, camelCase for local variables, TitleCase for types, and so on.

It's actually worked out pretty well, since there's no jarring transition between the two languages, and it does a great job of distinguishing our code from native JS code and that of 3rd party libraries.

My 2 cents.

P.S. We use the StyleCop standards, FWIW. And they probably won't make JSLint any happier.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号