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-wrap-func": 2,
|
||||
"one-var": 0,
|
||||
"quotes": 0, // TODO: enable with "single", "avoid-escape"
|
||||
"quotes": [2, "single", "avoid-escape"],
|
||||
"quote-props": 0,
|
||||
"semi": [2, "always"],
|
||||
"sort-vars": 0, // TODO: enable
|
||||
|
||||
@ -9,7 +9,7 @@ function mapDependencies(index) {
|
||||
doclets = index[name];
|
||||
for (var i = 0, ii = doclets.length; i < ii; ++i) {
|
||||
doc = doclets[i];
|
||||
if (doc.kind === "class" || doc.kind === "external") {
|
||||
if (doc.kind === 'class' || doc.kind === 'external') {
|
||||
dependencies[name] = {};
|
||||
len = doc.augments && doc.augments.length || 0;
|
||||
for (var j = 0; j < len; ++j) {
|
||||
@ -63,7 +63,7 @@ function getMembers(longname, docs) {
|
||||
var candidate, members = [];
|
||||
for (var i = 0, ii = docs.length; i < ii; ++i) {
|
||||
candidate = docs[i];
|
||||
if (candidate.memberof === longname && candidate.scope === "instance") {
|
||||
if (candidate.memberof === longname && candidate.scope === 'instance') {
|
||||
members.push(candidate);
|
||||
}
|
||||
}
|
||||
@ -71,7 +71,7 @@ function getMembers(longname, docs) {
|
||||
}
|
||||
|
||||
function getAdditions(doclets, docs, longnames) {
|
||||
var doop = require("jsdoc/util/doop").doop;
|
||||
var doop = require('jsdoc/util/doop');
|
||||
|
||||
var additions = [];
|
||||
var doc;
|
||||
@ -86,7 +86,7 @@ function getAdditions(doclets, docs, longnames) {
|
||||
for (var i = 0, ii = doclets.length; i < ii; i++) {
|
||||
doc = doclets[i];
|
||||
parents = doc.augments;
|
||||
if (parents && doc.kind === "class") {
|
||||
if (parents && doc.kind === 'class') {
|
||||
for (var j = 0, jj = parents.length; j < jj; j++) {
|
||||
members = getMembers(parents[j], docs);
|
||||
for (var k = 0, kk = members.length; k < kk; k++) {
|
||||
@ -99,9 +99,9 @@ function getAdditions(doclets, docs, longnames) {
|
||||
member.inherited = true;
|
||||
|
||||
member.memberof = doc.longname;
|
||||
parts = member.longname.split("#");
|
||||
parts = member.longname.split('#');
|
||||
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 (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
|
||||
var defaults = {
|
||||
"tags": {
|
||||
"allowUnknownTags": true
|
||||
tags: {
|
||||
allowUnknownTags: true
|
||||
},
|
||||
"templates": {
|
||||
"monospaceLinks": false,
|
||||
"cleverLinks": false
|
||||
templates: {
|
||||
monospaceLinks: false,
|
||||
cleverLinks: false
|
||||
},
|
||||
"source": {
|
||||
"includePattern": ".+\\.js(doc)?$",
|
||||
"excludePattern": ""
|
||||
source: {
|
||||
includePattern: '.+\\.js(doc)?$',
|
||||
excludePattern: ''
|
||||
},
|
||||
"plugins": []
|
||||
plugins: []
|
||||
};
|
||||
|
||||
/**
|
||||
@ -45,7 +45,7 @@ var defaults = {
|
||||
@param {string} [json] - The contents of config.json.
|
||||
*/
|
||||
function Config(json) {
|
||||
json = JSON.parse( (json || "{}") );
|
||||
json = JSON.parse( (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
|
||||
docletSrc =
|
||||
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$/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
|
||||
RegExp.escape = RegExp.escape || function(str) {
|
||||
var specials = new RegExp("[.*+?|()\\[\\]{}\\\\]", "g"); // .*+?|()[]{}\
|
||||
return str.replace(specials, "\\$&");
|
||||
var specials = new RegExp('[.*+?|()\\[\\]{}\\\\]', 'g'); // .*+?|()[]{}\
|
||||
return str.replace(specials, '\\$&');
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
@param {string} json - The contents of package.json.
|
||||
*/
|
||||
exports.Package = function(json) {
|
||||
json = json || "{}";
|
||||
json = json || '{}';
|
||||
|
||||
/** The source files associated with this package.
|
||||
@type {Array<String>}
|
||||
|
||||
@ -18,16 +18,16 @@ var parserNames = {
|
||||
*
|
||||
* @deprecated Replaced by "marked," as markdown-js does not support inline HTML.
|
||||
*/
|
||||
evilstreak: "marked",
|
||||
evilstreak: 'marked',
|
||||
/**
|
||||
* The "GitHub-flavored Markdown" parser.
|
||||
* @deprecated Replaced by "marked."
|
||||
*/
|
||||
gfm: "marked",
|
||||
gfm: 'marked',
|
||||
/**
|
||||
* The "[Marked](https://github.com/chjj/marked)" parser.
|
||||
*/
|
||||
marked: "marked"
|
||||
marked: 'marked'
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
'use strict';
|
||||
|
||||
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 parse = require('jsdoc/util/markdown').getParser();
|
||||
var tags = [];
|
||||
@ -40,7 +40,7 @@ function process(doclet) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof doclet[tag] === "string" && shouldProcessString(tag, doclet[tag]) ) {
|
||||
if (typeof doclet[tag] === 'string' && shouldProcessString(tag, doclet[tag]) ) {
|
||||
doclet[tag] = parse(doclet[tag]);
|
||||
}
|
||||
else if ( Array.isArray(doclet[tag]) ) {
|
||||
|
||||
@ -14,7 +14,7 @@ exports.handlers = {
|
||||
*/
|
||||
beforeParse: function(e) {
|
||||
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