Skip to content

Commit

Permalink
fix(prettier-plugin-jsdoc): preserve case when adding/removing dot
Browse files Browse the repository at this point in the history
  • Loading branch information
homer0 committed Oct 26, 2020
1 parent 7b6ded3 commit 8b71413
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/fns/formatObjects.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const processType = R.curry((options, type) => R.when(
* @type {FormatObjectsFn}
*/
const formatObjects = R.curry((type, options) => R.when(
isMatch(/Object\s*\.?\s*</),
isMatch(/Object\s*\.?\s*</i),
processType(options),
)(type));

Expand Down
4 changes: 2 additions & 2 deletions src/fns/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ const replaceAdjacent = R.curry((expression, replacement, text) => {
*/
const replaceDotOnTypeGeneric = R.curry((targetType, useDot, type) => R.ifElse(
R.always(useDot),
replaceAdjacent(new RegExp(`([^\\w]|^)${targetType}\\s*<`), `$1${targetType}.<`),
replaceAdjacent(new RegExp(`([^\\w]|^)${targetType}\\s*\\.\\s*<`), `$1${targetType}<`),
replaceAdjacent(new RegExp(`([^\\w]|^)(${targetType})\\s*<`, 'i'), '$1$2.<'),
replaceAdjacent(new RegExp(`([^\\w]|^)(${targetType})\\s*\\.\\s*<`, 'i'), '$1$2<'),
)(type));

/**
Expand Down

0 comments on commit 8b71413

Please sign in to comment.