From c0ae4cb193f643b321329d008d4eff80d4ea485a Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Mon, 25 Jan 2021 17:33:17 +0800 Subject: [PATCH] fix(`check-line-alignment`): escape user tag name in regex --- src/rules/checkLineAlignment.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rules/checkLineAlignment.js b/src/rules/checkLineAlignment.js index af054e929..95fdb3091 100644 --- a/src/rules/checkLineAlignment.js +++ b/src/rules/checkLineAlignment.js @@ -1,5 +1,5 @@ import { - set, + set, escapeRegExp, } from 'lodash'; import iterateJsdoc from '../iterateJsdoc'; @@ -112,7 +112,7 @@ const createFixer = (comment, expectedPositions, partsMatrix, lineRegExp, tagInd * @param {Function} report Report function. */ const checkAlignedPerTag = (comment, tag, tagIndentation, report) => { - const lineRegExp = new RegExp(`.*@${tag}[\\s].*`, 'gm'); + const lineRegExp = new RegExp(`.*@${escapeRegExp(tag)}[\\s].*`, 'gm'); const lines = comment.value.match(lineRegExp); if (!lines) {