Skip to content

Commit

Permalink
fix: format all tags descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
hosseinmd committed Feb 18, 2021
1 parent 905f735 commit cb815f0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 24 deletions.
5 changes: 0 additions & 5 deletions src/descriptionFormatter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { format } from "prettier";
import { TAGS_NEED_FORMAT_DESCRIPTION } from "./roles";
import { DESCRIPTION, EXAMPLE, TODO } from "./tags";
import { JsdocOptions } from "./types";
import { capitalizer } from "./utils";
Expand Down Expand Up @@ -52,10 +51,6 @@ function formatDescription(
options: JsdocOptions,
formatOptions: FormatOptions = {},
): string {
if (!TAGS_NEED_FORMAT_DESCRIPTION.includes(tag)) {
return text;
}

if (!text) return text;

const { printWidth } = options;
Expand Down
16 changes: 1 addition & 15 deletions src/roles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,7 @@ const TAGS_TYPELESS = [
];

const TAGS_DESCRIPTION_NEEDED = [CATEGORY, DESCRIPTION, EXAMPLE, SINCE, TODO];
const TAGS_NEED_FORMAT_DESCRIPTION = [
CATEGORY,
DESCRIPTION,
PARAM,
PROPERTY,
RETURNS,
THROWS,
TODO,
TYPE,
TYPEDEF,
YIELDS,
DEPRECATED,
OVERRIDE,
];

const TAGS_TYPE_NEEDED = [
EXTENDS,
PARAM,
Expand Down Expand Up @@ -172,7 +159,6 @@ export {
TAGS_DESCRIPTION_NEEDED,
TAGS_IS_CAMEL_CASE,
TAGS_NAMELESS,
TAGS_NEED_FORMAT_DESCRIPTION,
TAGS_GROUP,
TAGS_ORDER,
TAGS_SYNONYMS,
Expand Down
4 changes: 2 additions & 2 deletions tests/__snapshots__/exampleTag.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ exports[`Example javascript code 1`] = `
* }
*
* @undefiendTag
* @undefiendTag {number} name des
* @undefiendTag {number} name Des
*/
const testFunction = (text, defaultValue, optionalNumber) => true;
"
Expand All @@ -42,7 +42,7 @@ exports[`Example javascript code 2`] = `
* }
*
* @undefiendTag
* @undefiendTag {number} name des
* @undefiendTag {number} name Des
*/
const testFunction = (text, defaultValue, optionalNumber) => true;
"
Expand Down
4 changes: 2 additions & 2 deletions tests/__snapshots__/main.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ exports[`Should format regular jsDoc 1`] = `
* @param {Number | Null} [optionalNumber]
* @returns {Boolean} Description for @returns with s
* @undefiendTag
* @undefiendTag {number} name des
* @undefiendTag {number} name Des
*/
const testFunction = (text, defaultValue, optionalNumber) => true;
"
Expand Down Expand Up @@ -238,7 +238,7 @@ exports[`Should format regular jsDoc 2`] = `
* @param {Number | Null} [optionalNumber]
* @returns {Boolean} Description for @returns with s
* @undefiendTag
* @undefiendTag {number} name des
* @undefiendTag {number} name Des
*/
const testFunction = (text, defaultValue, optionalNumber) => true;
"
Expand Down

0 comments on commit cb815f0

Please sign in to comment.