Skip to content

Commit

Permalink
fix(parseComment): assume closing bracket of name is final instead …
Browse files Browse the repository at this point in the history
…of first one
  • Loading branch information
brettz9 committed Aug 13, 2024
1 parent e100846 commit a3bddeb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGES for `@es-joy/jsdoccomment`

## 0.47.0

- fix(`parseComment`): assume closing bracket of name is final instead of
first one
- chore: flat config/ESLint 9; change browser targets; lint; update devDeps.

## 0.46.0

- chore: update esquery, drop bundling of types, update devDeps
Expand Down
2 changes: 1 addition & 1 deletion dist/index.cjs.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -1218,7 +1218,7 @@ const getTokenizers = ({
const remainder = spec.source[0].tokens.description;
let pos;
if (remainder.startsWith('[') && remainder.includes(']')) {
const endingBracketPos = remainder.indexOf(']');
const endingBracketPos = remainder.lastIndexOf(']');
pos = remainder.slice(endingBracketPos).search(/(?<![\s,])\s/u);
if (pos > -1) {
// Add offset to starting point if space found
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@es-joy/jsdoccomment",
"version": "0.46.0",
"version": "0.47.0",
"author": "Brett Zamir <[email protected]>",
"contributors": [],
"description": "Maintained replacement for ESLint's deprecated SourceCode#getJSDocComment along with other jsdoc utilities",
Expand Down
2 changes: 1 addition & 1 deletion src/parseComment.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const getTokenizers = ({

let pos;
if (remainder.startsWith('[') && remainder.includes(']')) {
const endingBracketPos = remainder.indexOf(']');
const endingBracketPos = remainder.lastIndexOf(']');
pos = remainder.slice(endingBracketPos).search(/(?<![\s,])\s/u);
if (pos > -1) { // Add offset to starting point if space found
pos += endingBracketPos;
Expand Down

0 comments on commit a3bddeb

Please sign in to comment.