mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
enable ESLint quotes rule (and associated cleanup)
This commit is contained in:
parent
bce238bb51
commit
db7e65deb1
@ -113,7 +113,7 @@
|
|||||||
"no-underscore-dangle": 0,
|
"no-underscore-dangle": 0,
|
||||||
"no-wrap-func": 2,
|
"no-wrap-func": 2,
|
||||||
"one-var": 0,
|
"one-var": 0,
|
||||||
"quotes": 0, // TODO: enable with "single", "avoid-escape"
|
"quotes": [2, "single", "avoid-escape"],
|
||||||
"quote-props": 0,
|
"quote-props": 0,
|
||||||
"semi": [2, "always"],
|
"semi": [2, "always"],
|
||||||
"sort-vars": 0, // TODO: enable
|
"sort-vars": 0, // TODO: enable
|
||||||
|
|||||||
@ -9,7 +9,7 @@ function mapDependencies(index) {
|
|||||||
doclets = index[name];
|
doclets = index[name];
|
||||||
for (var i = 0, ii = doclets.length; i < ii; ++i) {
|
for (var i = 0, ii = doclets.length; i < ii; ++i) {
|
||||||
doc = doclets[i];
|
doc = doclets[i];
|
||||||
if (doc.kind === "class" || doc.kind === "external") {
|
if (doc.kind === 'class' || doc.kind === 'external') {
|
||||||
dependencies[name] = {};
|
dependencies[name] = {};
|
||||||
len = doc.augments && doc.augments.length || 0;
|
len = doc.augments && doc.augments.length || 0;
|
||||||
for (var j = 0; j < len; ++j) {
|
for (var j = 0; j < len; ++j) {
|
||||||
@ -63,7 +63,7 @@ function getMembers(longname, docs) {
|
|||||||
var candidate, members = [];
|
var candidate, members = [];
|
||||||
for (var i = 0, ii = docs.length; i < ii; ++i) {
|
for (var i = 0, ii = docs.length; i < ii; ++i) {
|
||||||
candidate = docs[i];
|
candidate = docs[i];
|
||||||
if (candidate.memberof === longname && candidate.scope === "instance") {
|
if (candidate.memberof === longname && candidate.scope === 'instance') {
|
||||||
members.push(candidate);
|
members.push(candidate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -71,7 +71,7 @@ function getMembers(longname, docs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getAdditions(doclets, docs, longnames) {
|
function getAdditions(doclets, docs, longnames) {
|
||||||
var doop = require("jsdoc/util/doop").doop;
|
var doop = require('jsdoc/util/doop');
|
||||||
|
|
||||||
var additions = [];
|
var additions = [];
|
||||||
var doc;
|
var doc;
|
||||||
@ -86,7 +86,7 @@ function getAdditions(doclets, docs, longnames) {
|
|||||||
for (var i = 0, ii = doclets.length; i < ii; i++) {
|
for (var i = 0, ii = doclets.length; i < ii; i++) {
|
||||||
doc = doclets[i];
|
doc = doclets[i];
|
||||||
parents = doc.augments;
|
parents = doc.augments;
|
||||||
if (parents && doc.kind === "class") {
|
if (parents && doc.kind === 'class') {
|
||||||
for (var j = 0, jj = parents.length; j < jj; j++) {
|
for (var j = 0, jj = parents.length; j < jj; j++) {
|
||||||
members = getMembers(parents[j], docs);
|
members = getMembers(parents[j], docs);
|
||||||
for (var k = 0, kk = members.length; k < kk; k++) {
|
for (var k = 0, kk = members.length; k < kk; k++) {
|
||||||
@ -99,9 +99,9 @@ function getAdditions(doclets, docs, longnames) {
|
|||||||
member.inherited = true;
|
member.inherited = true;
|
||||||
|
|
||||||
member.memberof = doc.longname;
|
member.memberof = doc.longname;
|
||||||
parts = member.longname.split("#");
|
parts = member.longname.split('#');
|
||||||
parts[0] = doc.longname;
|
parts[0] = doc.longname;
|
||||||
member.longname = parts.join("#");
|
member.longname = parts.join('#');
|
||||||
|
|
||||||
// if the child doesn't override the parent member, add the parent member
|
// if the child doesn't override the parent member, add the parent member
|
||||||
if (longnames.indexOf(member.longname) === -1) {
|
if (longnames.indexOf(member.longname) === -1) {
|
||||||
|
|||||||
@ -25,18 +25,18 @@ function mergeRecurse(target, source) {
|
|||||||
|
|
||||||
// required config values, override these defaults in your config.json if necessary
|
// required config values, override these defaults in your config.json if necessary
|
||||||
var defaults = {
|
var defaults = {
|
||||||
"tags": {
|
tags: {
|
||||||
"allowUnknownTags": true
|
allowUnknownTags: true
|
||||||
},
|
},
|
||||||
"templates": {
|
templates: {
|
||||||
"monospaceLinks": false,
|
monospaceLinks: false,
|
||||||
"cleverLinks": false
|
cleverLinks: false
|
||||||
},
|
},
|
||||||
"source": {
|
source: {
|
||||||
"includePattern": ".+\\.js(doc)?$",
|
includePattern: '.+\\.js(doc)?$',
|
||||||
"excludePattern": ""
|
excludePattern: ''
|
||||||
},
|
},
|
||||||
"plugins": []
|
plugins: []
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -45,7 +45,7 @@ var defaults = {
|
|||||||
@param {string} [json] - The contents of config.json.
|
@param {string} [json] - The contents of config.json.
|
||||||
*/
|
*/
|
||||||
function Config(json) {
|
function Config(json) {
|
||||||
json = JSON.parse( (json || "{}") );
|
json = JSON.parse( (json || '{}') );
|
||||||
this._config = mergeRecurse(defaults, json);
|
this._config = mergeRecurse(defaults, json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -79,7 +79,7 @@ function unwrap(docletSrc) {
|
|||||||
// use the /m flag on regex to avoid having to guess what this platform's newline is
|
// use the /m flag on regex to avoid having to guess what this platform's newline is
|
||||||
docletSrc =
|
docletSrc =
|
||||||
docletSrc.replace(/^\/\*\*+/, '') // remove opening slash+stars
|
docletSrc.replace(/^\/\*\*+/, '') // remove opening slash+stars
|
||||||
.replace(/\**\*\/$/, "\\Z") // replace closing star slash with end-marker
|
.replace(/\**\*\/$/, '\\Z') // replace closing star slash with end-marker
|
||||||
.replace(/^\s*(\* ?|\\Z)/gm, '') // remove left margin like: spaces+star or spaces+end-marker
|
.replace(/^\s*(\* ?|\\Z)/gm, '') // remove left margin like: spaces+star or spaces+end-marker
|
||||||
.replace(/\s*\\Z$/g, ''); // remove end-marker
|
.replace(/\s*\\Z$/g, ''); // remove end-marker
|
||||||
|
|
||||||
|
|||||||
@ -165,8 +165,8 @@ function quoteUnsafe(name, kind) { // docspaced names may have unsafe characters
|
|||||||
|
|
||||||
// TODO: make this a private method, or remove it if possible
|
// TODO: make this a private method, or remove it if possible
|
||||||
RegExp.escape = RegExp.escape || function(str) {
|
RegExp.escape = RegExp.escape || function(str) {
|
||||||
var specials = new RegExp("[.*+?|()\\[\\]{}\\\\]", "g"); // .*+?|()[]{}\
|
var specials = new RegExp('[.*+?|()\\[\\]{}\\\\]', 'g'); // .*+?|()[]{}\
|
||||||
return str.replace(specials, "\\$&");
|
return str.replace(specials, '\\$&');
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
@param {string} json - The contents of package.json.
|
@param {string} json - The contents of package.json.
|
||||||
*/
|
*/
|
||||||
exports.Package = function(json) {
|
exports.Package = function(json) {
|
||||||
json = json || "{}";
|
json = json || '{}';
|
||||||
|
|
||||||
/** The source files associated with this package.
|
/** The source files associated with this package.
|
||||||
@type {Array<String>}
|
@type {Array<String>}
|
||||||
|
|||||||
@ -18,16 +18,16 @@ var parserNames = {
|
|||||||
*
|
*
|
||||||
* @deprecated Replaced by "marked," as markdown-js does not support inline HTML.
|
* @deprecated Replaced by "marked," as markdown-js does not support inline HTML.
|
||||||
*/
|
*/
|
||||||
evilstreak: "marked",
|
evilstreak: 'marked',
|
||||||
/**
|
/**
|
||||||
* The "GitHub-flavored Markdown" parser.
|
* The "GitHub-flavored Markdown" parser.
|
||||||
* @deprecated Replaced by "marked."
|
* @deprecated Replaced by "marked."
|
||||||
*/
|
*/
|
||||||
gfm: "marked",
|
gfm: 'marked',
|
||||||
/**
|
/**
|
||||||
* The "[Marked](https://github.com/chjj/marked)" parser.
|
* The "[Marked](https://github.com/chjj/marked)" parser.
|
||||||
*/
|
*/
|
||||||
marked: "marked"
|
marked: 'marked'
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var conf = env.conf.markdown;
|
var conf = env.conf.markdown;
|
||||||
var defaultTags = [ "classdesc", "description", "params", "properties", "returns", "see"];
|
var defaultTags = [ 'classdesc', 'description', 'params', 'properties', 'returns', 'see'];
|
||||||
var hasOwnProp = Object.prototype.hasOwnProperty;
|
var hasOwnProp = Object.prototype.hasOwnProperty;
|
||||||
var parse = require('jsdoc/util/markdown').getParser();
|
var parse = require('jsdoc/util/markdown').getParser();
|
||||||
var tags = [];
|
var tags = [];
|
||||||
@ -40,7 +40,7 @@ function process(doclet) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof doclet[tag] === "string" && shouldProcessString(tag, doclet[tag]) ) {
|
if (typeof doclet[tag] === 'string' && shouldProcessString(tag, doclet[tag]) ) {
|
||||||
doclet[tag] = parse(doclet[tag]);
|
doclet[tag] = parse(doclet[tag]);
|
||||||
}
|
}
|
||||||
else if ( Array.isArray(doclet[tag]) ) {
|
else if ( Array.isArray(doclet[tag]) ) {
|
||||||
|
|||||||
@ -14,7 +14,7 @@ exports.handlers = {
|
|||||||
*/
|
*/
|
||||||
beforeParse: function(e) {
|
beforeParse: function(e) {
|
||||||
if (e.filename.match(/\.erb$/)) {
|
if (e.filename.match(/\.erb$/)) {
|
||||||
e.source = e.source.replace(/<%.*%>/g, "");
|
e.source = e.source.replace(/<%.*%>/g, '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Loading…
x
Reference in New Issue
Block a user