Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitaly Puzrin committed Feb 16, 2013
1 parent 33e7d80 commit 5cb4e9f
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 20 deletions.
15 changes: 11 additions & 4 deletions .jshintrc
Expand Up @@ -2,20 +2,26 @@
// Enforcing Options ///////////////////////////////////////////////////////// // Enforcing Options /////////////////////////////////////////////////////////


"bitwise" : true, // Prohibit bitwise operators (&, |, ^, etc.). "bitwise" : true, // Prohibit bitwise operators (&, |, ^, etc.).
"camelcase" : false, // Require variable names to be camelCase style or UPPER_CASE
"curly" : true, // Require {} for every new block or scope. "curly" : true, // Require {} for every new block or scope.
"eqeqeq" : true, // Require triple equals i.e. `===`. "eqeqeq" : true, // Require triple equals i.e. `===`.
"forin" : false, // Tolerate `for in` loops without `hasOwnPrototype`. "forin" : false, // Tolerate `for in` loops without `hasOwnPrototype`.
"immed" : true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );` "immed" : true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
"indent" : 2, // This option enforces specific tab width for your code
"latedef" : true, // Prohibit hariable use before definition. "latedef" : true, // Prohibit hariable use before definition.
"newcap" : true, // Require capitalization of all constructor functions e.g. `new F()`. "newcap" : true, // Require capitalization of all constructor functions e.g. `new F()`.
"noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`. "noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`.
"noempty" : true, // Prohibit use of empty blocks. "noempty" : true, // Prohibit use of empty blocks.
"nonew" : true, // Prohibit use of constructors for side-effects. "nonew" : true, // Prohibit use of constructors for side-effects.
"plusplus" : true, // Prohibit use of `++` & `--`. "plusplus" : false, // Prohibit use of `++` & `--`.
"quotmark" : false, // Enforces the consistency of quotation marks used throughout your code.
"regexp" : false, // Prohibit `.` and `[^...]` in regular expressions. "regexp" : false, // Prohibit `.` and `[^...]` in regular expressions.
"undef" : true, // Require all non-global variables be declared before they are used. "undef" : true, // Require all non-global variables be declared before they are used.
"unused" : true, // This option warns when you define and never use your variables.
"strict" : true, // Require `use strict` pragma in every file. "strict" : true, // Require `use strict` pragma in every file.
"trailing" : true, // Prohibit trailing whitespaces. "trailing" : true, // Prohibit trailing whitespaces.
"maxstatements" : false, // Enforce max amount of statements per function
"maxcomplexity" : false, // Enforce cyclomatic complexity level


// Relaxing Options ////////////////////////////////////////////////////////// // Relaxing Options //////////////////////////////////////////////////////////


Expand All @@ -32,6 +38,7 @@
"iterator" : false, // Allow usage of __iterator__ property. "iterator" : false, // Allow usage of __iterator__ property.
"lastsemic" : false, // Tolerate semicolon omited for the last statement. "lastsemic" : false, // Tolerate semicolon omited for the last statement.
"laxbreak" : false, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons. "laxbreak" : false, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons.
"laxcomma" : true, // This option suppresses warnings about comma-first coding style
"loopfunc" : false, // Allow functions to be defined within loops. "loopfunc" : false, // Allow functions to be defined within loops.
"multistr" : false, // Tolerate multi-line strings. "multistr" : false, // Tolerate multi-line strings.
"onecase" : false, // Tolerate swithes with only one case. "onecase" : false, // Tolerate swithes with only one case.
Expand All @@ -55,6 +62,7 @@
"nonstandard" : false, // Defines non-standard but widely adopted globals such as escape and unescape "nonstandard" : false, // Defines non-standard but widely adopted globals such as escape and unescape
"prototypejs" : false, // Defines globals exposed by the Prototype "prototypejs" : false, // Defines globals exposed by the Prototype
"rhino" : false, // Defines globals exposed when running under Rhino "rhino" : false, // Defines globals exposed when running under Rhino
"worker" : false, // Defines globals exposed when running Web Worker
"wsh" : false, // Defines globals exposed when running under WSH "wsh" : false, // Defines globals exposed when running under WSH


// Legacy //////////////////////////////////////////////////////////////////// // Legacy ////////////////////////////////////////////////////////////////////
Expand All @@ -64,8 +72,7 @@
"passfail" : false, // Stop on first error. "passfail" : false, // Stop on first error.
"white" : false, // Check against strict whitespace and indentation rules. "white" : false, // Check against strict whitespace and indentation rules.


// Undocumented ////////////////////////////////////////////////////////////// // Other /////////////////////////////////////////////////////////////////////


"maxerr" : 100, // Maximum error before stopping. "maxerr" : 100 // Maximum error before stopping.
"indent" : 2 // Specify indentation spacing
} }
11 changes: 5 additions & 6 deletions bin/ndoc.js
Expand Up @@ -7,7 +7,6 @@
// stdlib // stdlib
var fs = require('fs'); var fs = require('fs');
var path = require('path'); var path = require('path');
var exec = require('child_process').exec;




// 3rd-party // 3rd-party
Expand All @@ -23,12 +22,12 @@ var template = require('../lib/ndoc/common').template;




function exit(err) { function exit(err) {
if (err) { if (err) {
console.error(err.message || err); console.error(err.message || err);
process.exit(1); process.exit(1);
} }


process.exit(0); process.exit(0);
} }




Expand Down
2 changes: 1 addition & 1 deletion lib/ndoc.js
Expand Up @@ -218,7 +218,7 @@ function build_tree(nodes, options) {


// assign aliases, subclasses, constructors // assign aliases, subclasses, constructors
// correct method types (class or entity) // correct method types (class or entity)
_.each(nodes, function (node, id) { _.each(nodes, function (node /*, id*/) {
// aliases // aliases
if (node.alias_of && nodes[node.alias_of]) { if (node.alias_of && nodes[node.alias_of]) {
nodes[node.alias_of].aliases.push(node.id); nodes[node.alias_of].aliases.push(node.id);
Expand Down
3 changes: 1 addition & 2 deletions lib/ndoc/cli.js
Expand Up @@ -43,7 +43,6 @@


// stdlib // stdlib
var fs = require('fs'); var fs = require('fs');
var path = require('path');




// 3rd-party // 3rd-party
Expand All @@ -64,7 +63,7 @@ var renderers = require('./renderers');
var cli = module.exports = new ArgumentParser({ var cli = module.exports = new ArgumentParser({
version: require('./version'), version: require('./version'),
addHelp: true, addHelp: true,
formatterClass: function(options) { formatterClass: function (options) {
options['maxHelpPosition'] = 40; options['maxHelpPosition'] = 40;
return new argparse.HelpFormatter(options); return new argparse.HelpFormatter(options);
} }
Expand Down
2 changes: 1 addition & 1 deletion lib/ndoc/cli/lazy-choices.js
Expand Up @@ -21,6 +21,6 @@ var LazyChoices = module.exports = function LazyChoices(options) {
require('util').inherits(LazyChoices, Action); require('util').inherits(LazyChoices, Action);




LazyChoices.prototype.call = function (parser, namespace, values, optionString) { LazyChoices.prototype.call = function (parser, namespace, values) {
namespace.set(this.dest, values); namespace.set(this.dest, values);
}; };
2 changes: 1 addition & 1 deletion lib/ndoc/cli/read-file.js
Expand Up @@ -23,6 +23,6 @@ var ReadFile = module.exports = function ReadFile(options) {
require('util').inherits(ReadFile, Action); require('util').inherits(ReadFile, Action);




ReadFile.prototype.call = function (parser, namespace, values, optionString) { ReadFile.prototype.call = function (parser, namespace, values) {
namespace.set(this.dest, fs.readFileSync(values.shift(), 'utf8')); namespace.set(this.dest, fs.readFileSync(values.shift(), 'utf8'));
}; };
2 changes: 1 addition & 1 deletion lib/ndoc/cli/read-json.js
Expand Up @@ -23,7 +23,7 @@ var ReadJSON = module.exports = function ReadJSON(options) {
require('util').inherits(ReadJSON, Action); require('util').inherits(ReadJSON, Action);




ReadJSON.prototype.call = function (parser, namespace, values, optionString) { ReadJSON.prototype.call = function (parser, namespace, values) {
var str = fs.readFileSync(values.shift(), 'utf8'); var str = fs.readFileSync(values.shift(), 'utf8');
namespace.set(this.dest, JSON.parse(str)); namespace.set(this.dest, JSON.parse(str));
}; };
4 changes: 2 additions & 2 deletions lib/ndoc/plugins/parsers/javascript.js
Expand Up @@ -32,7 +32,7 @@ var parser = require('./javascript/parser');


function parse_javascript(file, options, callback) { function parse_javascript(file, options, callback) {
fs.readFile(file, 'utf8', function (err, source) { fs.readFile(file, 'utf8', function (err, source) {
var nodes, list = {}, tree, parted, sections, children; var nodes, list = {};


if (err) { if (err) {
callback(err); callback(err);
Expand All @@ -50,7 +50,7 @@ function parse_javascript(file, options, callback) {
} }


// do pre-distribute early work // do pre-distribute early work
_.each(nodes, function (node, id) { _.each(nodes, function (node /*, id*/) {
var clone; var clone;


// assign hierarchy helpers // assign hierarchy helpers
Expand Down
4 changes: 2 additions & 2 deletions lib/ndoc/plugins/renderers/html.js
Expand Up @@ -49,7 +49,7 @@ var template = require('../../common').template;




// Markdown highlighter callback function // Markdown highlighter callback function
var marked_highlight = function(code, lang) { var marked_highlight = function (code, lang) {
if (lang) { if (lang) {
return hljs.highlight(lang, code).value; return hljs.highlight(lang, code).value;
} else { } else {
Expand Down Expand Up @@ -165,7 +165,7 @@ function render_html(ndoc, options, callback) {
var r = obj.id; var r = obj.id;
if (sig.args) { if (sig.args) {
r += '('; r += '(';
sig.args.forEach(function (arg, idx, args) { sig.args.forEach(function (arg, idx) {
var skip_first, a, value; var skip_first, a, value;
// skip the first bound argument for prototype methods // skip the first bound argument for prototype methods
skip_first = obj.bound && obj.id.indexOf('#') >= 0; skip_first = obj.bound && obj.id.indexOf('#') >= 0;
Expand Down

0 comments on commit 5cb4e9f

Please sign in to comment.