-
Notifications
You must be signed in to change notification settings - Fork 725
Coding Standards
fabien-d edited this page Dec 1, 2012
·
4 revisions
Alertify Coding Standards are set for all code in the code-base to look like a single person wrote it. This is not to say my style preference is better than another, it's simply to keep the project consistent and easier to read.
Most of the code standards are based on idiomatic.js with a few minor overwrites/differences or project specifics.
- Whitespace: Tabs for indentation (spaces to align multiline variables)
- Quotes: Double quotes
- Single Line Statements: No curly braces for single line statements (code on 1 line not 2)
function () {
// tabs
var tab;
};
// spaces to align variables
var a..= "",
....ab.= "";
Yes
if (statement) something();
else somethingElse();
No
if (statement)
something();
else
somethingElse();
Current JSHint configuration
jshint : {
options: {
curly : false,
eqeqeq : true,
immed : true,
latedef : true,
noempty : true,
newcap : true,
noarg : true,
sub : true,
undef : true,
boss : true,
eqnull : true,
node : true,
smarttabs : true,
es5 : true
},
globals : {
exports : true,
Element : true
}
}