update ESLint dependency; enable new rules; delint

This commit is contained in:
Jeff Williams 2014-10-27 12:58:32 -07:00
parent b28f3341a3
commit a2e119a88b
16 changed files with 71 additions and 52 deletions

View File

@ -1,14 +1,15 @@
{
"env": {
"jasmine": true,
"node": true
},
"rules": {
// Possible errors
"no-comma-dangle": 2,
"no-cond-assign": 2,
"no-console": 0,
"no-constant-condition": 0,
"no-comma-dangle": 2,
"no-control-regex": 2,
"no-debugger": 2,
"no-dupe-keys": 2,
@ -19,10 +20,13 @@
"no-extra-parens": 0,
"no-extra-semi": 2,
"no-func-assign": 2,
"no-inner-declarations": [2, "functions"],
"no-invalid-regexp": 2,
"no-irregular-whitespace": 2,
"no-negated-in-lhs": 2,
"no-obj-calls": 2,
"no-regex-spaces": 2,
"no-reserved-keys": 0,
"no-sparse-arrays": 2,
"no-unreachable": 2,
"use-isnan": 2,
@ -34,8 +38,8 @@
"complexity": 0, // TODO: enable
"consistent-return": 2,
"curly": [2, "all"],
"default-case": 2,
"dot-notation": 2,
"eol-last": 2,
"eqeqeq": [2, "smart"],
"guard-for-in": 2,
"no-alert": 2,
@ -45,15 +49,16 @@
"no-empty-label": 2,
"no-eq-null": 2,
"no-eval": 2,
"no-extra-bind": 2,
"no-extend-native": 2,
"no-fallthrough": 2,
"no-floating-decimal": 2,
"no-implied-eval": 2,
"no-labels": 2,
"no-iterator": 2,
"no-labels": 2,
"no-lone-blocks": 2,
"no-loop-func": 2,
"no-mixed-spaces-and-tabs": 2,
"no-multi-spaces": 2,
"no-multi-str": 2,
"no-native-reassign": 2,
"no-new": 2,
@ -61,23 +66,24 @@
"no-new-wrappers": 2,
"no-octal": 2,
"no-octal-escape": 2,
"no-process-env": 2,
"no-proto": 2,
"no-redeclare": 2,
"no-return-assign": 2,
"no-script-url": 2,
"no-self-compare": 2,
"no-sequences": 2,
"no-trailing-spaces": 2,
"no-undefined": 0,
"no-unused-expressions": 2,
"no-void": 2,
"no-warning-comments": 0,
"no-with": 2,
"radix": 2,
"vars-on-top": 0,
"wrap-iife": [2, "inside"],
"yoda": 2,
// Strict mode
"no-global-strict": 0,
"global-strict": 0,
"no-extra-strict": 2,
"strict": 2,
@ -89,42 +95,66 @@
"no-shadow-restricted-names": 2,
"no-undef": 2,
"no-undef-init": 2,
"no-undefined": 0,
"no-unused-vars": 0,
"no-use-before-define": 2,
// Node.js
"handle-callback-err": 2,
"no-mixed-requires": 2,
"no-new-require": 2,
"no-path-concat": 2,
"no-process-exit": 2,
"no-restricted-modules": 0,
"no-sync": 0,
// Stylistic issues
"brace-style": 0, // TODO: enable with "stroustrup" (or "1tbsp" + lots of cleanup)
"camelcase": 2,
"comma-spacing": [2, {
"before": false,
"after": true
}],
"comma-style": [2, "last"],
"consistent-this": [2, "self"],
"func-names": 0, // TODO: enable
"eol-last": 2,
"func-names": 0,
"func-style": 0,
"key-spacing": [2, {
"beforeColon": false,
"afterColon": true
}],
"max-nested-callbacks": 0,
"new-cap": 2,
"new-parens": 2,
"no-nested-ternary": 2,
"no-array-constructor": 2,
"no-lonely-if": 2,
"no-mixed-spaces-and-tabs": 2,
"no-multiple-empty-lines": [2, {
"max": 2
}],
"no-nested-ternary": 2,
"no-new-object": 2,
"no-spaced-func": 2,
"no-space-before-semi": 2,
"no-spaced-func": 2,
"no-ternary": 0,
"no-trailing-spaces": 2,
"no-underscore-dangle": 0,
"no-wrap-func": 2,
"one-var": 0,
"padded-blocks": [2, "never"],
"quotes": [2, "single", "avoid-escape"],
"quote-props": 0,
"semi": [2, "always"],
"sort-vars": 0, // TODO: enable
"sort-vars": 0,
"space-after-keywords": [2, "always"],
"space-before-blocks": [2, "always"],
"space-in-brackets": 0, // TODO: enable?
"space-in-parens": 0, // TODO: enable?
"space-infix-ops": 2,
"space-return-throw-case": 2,
"space-unary-word-ops": 2,
"spaced-line-comment": [2, "always"],
"wrap-regex": 0,
// Legacy

1
cli.js
View File

@ -460,5 +460,4 @@ cli.exit = function(exitCode, message) {
};
return cli;
})();

View File

@ -162,18 +162,16 @@ exports.resolve = function(doclet) {
doclet.scope = puncToScope[about.scope];
}
}
else {
if (doclet.name && doclet.memberof && !doclet.longname) {
if ( REGEXP_LEADING_SCOPE.test(doclet.name) ) {
doclet.scope = puncToScope[RegExp.$1];
doclet.name = doclet.name.substr(1);
}
else {
doclet.scope = DEFAULT_SCOPE;
}
doclet.setLongname(doclet.memberof + scopeToPunc[doclet.scope] + doclet.name);
else if (doclet.name && doclet.memberof && !doclet.longname) {
if ( REGEXP_LEADING_SCOPE.test(doclet.name) ) {
doclet.scope = puncToScope[RegExp.$1];
doclet.name = doclet.name.substr(1);
}
else {
doclet.scope = DEFAULT_SCOPE;
}
doclet.setLongname(doclet.memberof + scopeToPunc[doclet.scope] + doclet.name);
}
if (about.variation) {

View File

@ -237,7 +237,6 @@ ArgParser.prototype.parse = function(args, defaults) {
// like -t
if (arg.charAt(0) === '-') {
// like --template
if (arg.charAt(1) === '-') {
name = longName = arg.slice(2);

View File

@ -24,17 +24,17 @@ exports.installPlugins = function(plugins, parser) {
plugin = require(plugins[i]);
// allow user-defined plugins to...
//...register event handlers
// ...register event handlers
if (plugin.handlers) {
addHandlers(plugin.handlers, parser);
}
//...define tags
// ...define tags
if (plugin.defineTags) {
plugin.defineTags(dictionary);
}
//...add a Rhino node visitor (deprecated in JSDoc 3.3)
// ...add a Rhino node visitor (deprecated in JSDoc 3.3)
if (plugin.nodeVisitor) {
if ( !parser.addNodeVisitor ) {
logger.error('Unable to add the Rhino node visitor from %s, because JSDoc ' +
@ -45,7 +45,7 @@ exports.installPlugins = function(plugins, parser) {
}
}
//...add a Mozilla Parser API node visitor
// ...add a Mozilla Parser API node visitor
if (plugin.astNodeVisitor) {
parser.addAstNodeVisitor(plugin.astNodeVisitor);
}

View File

@ -220,7 +220,7 @@ function addSymbolMemberof(parser, doclet, astNode) {
}
else {
memberofInfo = parser.astnodeToMemberof(astNode);
if( Array.isArray(memberofInfo) ) {
if ( Array.isArray(memberofInfo) ) {
basename = memberofInfo[1];
memberof = memberofInfo[0];
}
@ -283,7 +283,6 @@ function newSymbolDoclet(parser, docletSrc, e) {
*/
exports.attachTo = function(parser) {
// Handle JSDoc "virtual comments" that include one of the following:
//
// + A `@name` tag
// + Another tag that accepts a name, such as `@function`
parser.on('jsdocCommentFound', function(e) {

View File

@ -36,7 +36,6 @@ var PARSERS = exports.PARSERS = {
// TODO: docs
exports.createParser = function(type) {
var modulePath;
if (!type) {
@ -236,7 +235,6 @@ Parser.prototype._parseSourceCode = function(sourceCode, sourceName) {
if (ast) {
this._walker.recurse(sourceName, ast, this._visitor);
}
}
this.emit('fileComplete', e);

View File

@ -217,9 +217,7 @@ var baseTags = exports.baseTags = {
},
// Special separator tag indicating that multiple doclets should be generated for the same
// comment. Used internally (and by some JSDoc users, although it's not officially supported).
//
// In the following example, the parser will replace `//**` with an `@also` tag:
//
// /**
// * Foo.
// *//**
@ -324,7 +322,7 @@ var baseTags = exports.baseTags = {
type = doclet.meta.code.type;
value = doclet.meta.code.value;
switch(type) {
switch (type) {
case Syntax.ArrayExpression:
doclet.defaultvalue = nodeToString(doclet.meta.code.node);
doclet.defaultvaluetype = 'array';

View File

@ -176,7 +176,7 @@ function getTypeStrings(parsedType, isOutermostType) {
var TYPES = catharsis.Types;
switch(parsedType.type) {
switch (parsedType.type) {
case TYPES.AllLiteral:
types.push('*');
break;

View File

@ -29,7 +29,6 @@ exports.Template = function(path) {
interpolate: /<\?js=([\s\S]+?)\?>/g,
escape: /<\?js~([\s\S]+?)\?>/g
};
};
/** Loads template from given file.

View File

@ -81,7 +81,7 @@ function initializeNode(args) {
}
exports.initialize = function(args) {
switch(runtime) {
switch (runtime) {
case RHINO:
initializeRhino(args);
break;

View File

@ -26,6 +26,7 @@
"wrench": "~1.3.9"
},
"devDependencies": {
"eslint": "~0.9.1",
"gulp": "~3.8.5",
"gulp-eslint": "~0.1.7",
"gulp-json-editor": "~2.0.2",

View File

@ -5,6 +5,8 @@
*/
'use strict';
/*eslint spaced-line-comment: 0 */
exports.handlers = {
///
/// Convert ///-style comments into jsdoc comments.

View File

@ -1,4 +1,3 @@
/*global env: true */
/**
@overview Adds support for reusable partial jsdoc files.
@module plugins/partial
@ -10,21 +9,21 @@ var fs = require('jsdoc/fs');
var path = require('path');
exports.handlers = {
///
/// Include a partial jsdoc
/// @param e
/// @param e.filename
/// @param e.source
///
/// @example
/// @partial "partial_doc.jsdoc"
///
/**
* Include a partial jsdoc
*
* @param e
* @param e.filename
* @param e.source
* @example
* @partial "partial_doc.jsdoc"
*/
beforeParse: function(e) {
e.source = e.source.replace(/(@partial \".*\")+/g, function($) {
var pathArg = $.match(/\".*\"/)[0].replace(/"/g,'');
var fullPath = path.join(e.filename , '..', pathArg);
var partialData = fs.readFileSync(fullPath, env.opts.encoding);
var partialData = fs.readFileSync(fullPath, global.env.opts.encoding);
return partialData;
});

View File

@ -23,7 +23,6 @@ exports.handlers = {
tag,
value;
//console.log(e.doclet);
// any user-defined tags in this doclet?
if (typeof tags !== 'undefined') {
// only interested in the @source tags

View File

@ -197,7 +197,6 @@ function graft(parentNode, childNodes, parentLongname, parentName) {
@param {object} opts
*/
exports.publish = function(data, opts) {
var root = {},
docs;
@ -218,5 +217,4 @@ exports.publish = function(data, opts) {
else {
console.log('This template only supports output to the console. Use the option "-d console" when you run JSDoc.');
}
};