Skip to content

Commit

Permalink
Fix check comment block already exists (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
heavenshell authored Apr 12, 2020
1 parent b12de00 commit ed36e26
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/parsers/babel/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ArrowFunctionExpression, Node, VariableDeclarator } from '@babel/types'

import { getClassDoc } from './classes'
import { getFunctionDoc } from './functions'
import { getAst, getLocation } from './helper'
import { getAst, getLocation, isCommentBlock } from './helper'
import { getInterfaceDoc } from './interfaces'
import { getVariableDoc } from './variables'

Expand All @@ -13,6 +13,10 @@ export const parse = ({ code, lines, scriptKind }: ParseProps) => {

const docs: DocProps[] = []
const visit = (node: Node) => {
if (node.leadingComments && isCommentBlock(node.leadingComments)) {
return
}

const start = node.loc
? { line: node.loc.start.line - 1, column: node.loc.start.column }
: { line: 0, column: 0 }
Expand Down

0 comments on commit ed36e26

Please sign in to comment.