Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
6
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
P
prettier-plugin-jsdoc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gumen
prettier-plugin-jsdoc
Commits
0989611f
Commit
0989611f
authored
Jan 23, 2020
by
Wiktor Walasek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CR fixes
parent
9048c3b7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
+8
-5
jsdoc_parser.js
jsdoc_parser.js
+6
-4
tests/main.js
tests/main.js
+2
-1
No files found.
jsdoc_parser.js
View file @
0989611f
...
...
@@ -39,13 +39,15 @@ const tagSynonyms = {
}
/**
* Trim, make single line with capitalized text
* Trim, make single line with capitalized text. Insert dot if flag for it is
* set to true and last character is a word character
* @param {String} text
* @param {Boolean} insertDot flag for dot at the end of text
* @return {String}
*/
function
formatDescription
(
text
,
insertDot
)
{
if
(
!
text
)
return
''
text
=
text
.
trim
()
if
(
!
text
)
return
''
text
=
text
.
replace
(
/
\s\s
+/g
,
'
'
)
// Avoid multiple spaces
text
=
text
.
replace
(
/
\n
/g
,
'
'
)
// Make single line
if
(
insertDot
)
text
=
text
.
replace
(
/
(\w)(?=
$
)
/g
,
'
$1.
'
)
// Insert dot if needed
...
...
@@ -127,7 +129,7 @@ function jsdocParser(text, parsers, options) {
}
}
if
([
'
description
'
,
'
param
'
,
'
return
'
,
'
todo
'
].
includes
(
tag
.
title
))
if
(
tag
.
description
&&
[
'
description
'
,
'
param
'
,
'
return
'
,
'
todo
'
].
includes
(
tag
.
title
))
tag
.
description
=
formatDescription
(
tag
.
description
,
options
.
jsdocAddDotToDescription
)
if
(
!
tag
.
description
&&
[
'
description
'
,
'
param
'
,
'
return
'
,
'
todo
'
,
'
memberof
'
].
includes
(
tag
.
title
)
&&
...
...
@@ -247,7 +249,7 @@ module.exports = {
jsdocAddDotToDescription
:
{
type
:
'
boolean
'
,
category
:
'
Global
'
,
default
:
tru
e
,
default
:
fals
e
,
description
:
'
Punctuation, is: a. key?
'
},
jsdocDescriptionTag
:
{
...
...
tests/main.js
View file @
0989611f
...
...
@@ -8,7 +8,8 @@ function subject(code, options = {}) {
parser
:
'
jsdoc-parser
'
,
plugins
:
[
'
.
'
],
jsdocSpaces
:
1
,
jsdocPrintWidth
:
80
jsdocPrintWidth
:
80
,
jsdocAddDotToDescription
:
true
});
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment