UNPKG

monk-import-export

Version:

Simple import & export sorting ESLint plugin

12 lines (8 loc) 510 B
import { isExportFrom } from './isExportFrom'; export function isPartOfChunk(node: any, lastNode: any, sourceCode: any): 'PartOfNewChunk' | 'PartOfChunk' | 'NotPartOfChunk' { if (!isExportFrom(node)) return 'NotPartOfChunk'; const hasGroupingComment = sourceCode .getCommentsBefore(node) .some((comment: any) => (lastNode == null || comment.loc.start.line > lastNode.loc.end.line) && comment.loc.end.line < node.loc.start.line); return hasGroupingComment ? 'PartOfNewChunk' : 'PartOfChunk'; }