The best way to make sure your issue is addressed is to submit a patch. We accept patches through all mediums: pull requests, email, issue comment, tweet with a link to a snippet, graffiti outside of Anton's apartment, etc.
However, before sending a patch, please make sure that the following applies:
node make.js test
and node make.js lint
).This section describes our coding style guide. You might not agree with it and that‘s fine but if you’re going to send us patches treat this guide as a law.
All code in any code-base should look like a single person typed it, no matter how many people contributed. —idiomatic.js
if
, for
, while
, etc.function
for anonymous functions but not for named functions:var a = function () {}; function a() {}
// Good var next = token.peak(); var prev = token.peak(-1); var cur = token.current; var scope = { name: "(global)", parent: parentScope, vars: [], uses: [] }; // Bad var cur = token.current; var isSemicolon = cur.isPunctuator(";");
var
per variable unless you don‘t assign any values to it (and it’s short enough):var token = tokens.find(index); var scope = scopes.current; var next, prev, cur;
//
for all comments.===
and !==
.// Good token = token || tokens.find(0); // Bad token.isPunctuator(";") && report.addWarning("W001"); // Good if (token.isPunctuator(";")) report.addWarning("W001");
Today we use JSHint‘s white:true
to enforce some of these rules. Eventually we’ll switch to JSHint Next style enforcing component. But it's not ready yet.