Skip to content

Commit fbed3b6

Browse files
Prettier trailing commas
1 parent 66fd135 commit fbed3b6

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

index.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ const addInherited = require('jsdoc/augment').addInherited; // eslint-disable-li
77
const config = env.conf.typescript;
88
if (!config) {
99
throw new Error(
10-
'Configuration "typescript" for jsdoc-plugin-typescript missing.'
10+
'Configuration "typescript" for jsdoc-plugin-typescript missing.',
1111
);
1212
}
1313
if (!('moduleRoot' in config)) {
1414
throw new Error(
15-
'Configuration "typescript.moduleRoot" for jsdoc-plugin-typescript missing.'
15+
'Configuration "typescript.moduleRoot" for jsdoc-plugin-typescript missing.',
1616
);
1717
}
1818
const moduleRoot = config.moduleRoot;
@@ -21,7 +21,7 @@ if (!fs.existsSync(moduleRootAbsolute)) {
2121
throw new Error(
2222
'Directory "' +
2323
moduleRootAbsolute +
24-
'" does not exist. Check the "typescript.moduleRoot" config option for jsdoc-plugin-typescript'
24+
'" does not exist. Check the "typescript.moduleRoot" config option for jsdoc-plugin-typescript',
2525
);
2626
}
2727

@@ -47,7 +47,7 @@ function getModuleInfo(moduleId, extension, parser) {
4747
const absolutePath = path.join(
4848
process.cwd(),
4949
moduleRoot,
50-
moduleId + extension
50+
moduleId + extension,
5151
);
5252
if (!fs.existsSync(absolutePath)) {
5353
return null;
@@ -186,7 +186,7 @@ exports.defineTags = function (dictionary) {
186186
// Bracket notation to dot notation
187187
.replace(
188188
/(\w+|>|\)|\])\[(?:'([^']+)'|"([^"]+)")\]/g,
189-
'$1.$2$3'
189+
'$1.$2$3',
190190
);
191191

192192
return head + replaced + tail;
@@ -293,10 +293,10 @@ exports.astNodeVisitor = {
293293
if (
294294
leadingComments.length === 0 ||
295295
(leadingComments[leadingComments.length - 1].value.indexOf(
296-
'@classdesc'
296+
'@classdesc',
297297
) === -1 &&
298298
noClassdescRegEx.test(
299-
leadingComments[leadingComments.length - 1].value
299+
leadingComments[leadingComments.length - 1].value,
300300
))
301301
) {
302302
// Create a suitable comment node if we don't have one on the class yet
@@ -314,7 +314,7 @@ exports.astNodeVisitor = {
314314
if (node.superClass) {
315315
// Remove the `@extends` tag because JSDoc does not does not handle generic type. (`@extends {Base<Type>}`)
316316
const extendsIndex = lines.findIndex((line) =>
317-
line.includes('@extends')
317+
line.includes('@extends'),
318318
);
319319
if (extendsIndex !== -1) {
320320
lines.splice(extendsIndex, 1);
@@ -326,7 +326,7 @@ exports.astNodeVisitor = {
326326
if (identifier) {
327327
const absolutePath = path.resolve(
328328
path.dirname(currentSourceName),
329-
identifier.value
329+
identifier.value,
330330
);
331331
// default to js extension since .js extention is assumed implicitly
332332
const extension = getExtension(absolutePath);
@@ -359,7 +359,7 @@ exports.astNodeVisitor = {
359359
// Replace typeof Foo with Class<Foo>
360360
comment.value = comment.value.replace(
361361
/typeof ([^,\|\}\>]*)([,\|\}\>])/g,
362-
'Class<$1>$2'
362+
'Class<$1>$2',
363363
);
364364

365365
// Remove `@override` annotations to avoid JSDoc breaking the inheritance chain
@@ -387,7 +387,7 @@ exports.astNodeVisitor = {
387387
if (replaceAttempt > 100) {
388388
// infinite loop protection
389389
throw new Error(
390-
`Invalid docstring ${comment.value} in ${currentSourceName}.`
390+
`Invalid docstring ${comment.value} in ${currentSourceName}.`,
391391
);
392392
}
393393
} else {
@@ -396,7 +396,7 @@ exports.astNodeVisitor = {
396396
lastImportPath = importExpression;
397397
const rel = path.resolve(
398398
path.dirname(currentSourceName),
399-
importSource
399+
importSource,
400400
);
401401
// default to js extension since .js extention is assumed implicitly
402402
const extension = getExtension(rel);
@@ -420,7 +420,7 @@ exports.astNodeVisitor = {
420420
if (replacement) {
421421
comment.value = comment.value.replace(
422422
importExpression,
423-
replacement + remainder
423+
replacement + remainder,
424424
);
425425
}
426426
}
@@ -441,13 +441,13 @@ exports.astNodeVisitor = {
441441
Object.keys(identifiers).forEach((key) => {
442442
const eventRegex = new RegExp(
443443
`@(event |fires )${key}([^A-Za-z])`,
444-
'g'
444+
'g',
445445
);
446446
replace(eventRegex);
447447

448448
const typeRegex = new RegExp(
449449
`@(.*[{<|,(!?:]\\s*)${key}([^A-Za-z].*?\}|\})`,
450-
'g'
450+
'g',
451451
);
452452
replace(typeRegex);
453453

@@ -456,7 +456,7 @@ exports.astNodeVisitor = {
456456
const identifier = identifiers[key];
457457
const absolutePath = path.resolve(
458458
path.dirname(currentSourceName),
459-
identifier.value
459+
identifier.value,
460460
);
461461
// default to js extension since .js extention is assumed implicitly
462462
const extension = getExtension(absolutePath);
@@ -472,11 +472,11 @@ exports.astNodeVisitor = {
472472
: getDelimiter(moduleId, exportName, parser);
473473
const replacement = `module:${moduleId.replace(
474474
slashRegEx,
475-
'/'
475+
'/',
476476
)}${exportName ? delimiter + exportName : ''}`;
477477
comment.value = comment.value.replace(
478478
regex,
479-
'@$1' + replacement + '$2'
479+
'@$1' + replacement + '$2',
480480
);
481481
}
482482
}

0 commit comments

Comments
 (0)