UNPKG

monk-import-export

Version:

Simple import & export sorting ESLint plugin

14 lines (13 loc) 620 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isPartOfChunk = void 0; const isExportFrom_1 = require("./isExportFrom"); function isPartOfChunk(node, lastNode, sourceCode) { if (!(0, isExportFrom_1.isExportFrom)(node)) return 'NotPartOfChunk'; const hasGroupingComment = sourceCode .getCommentsBefore(node) .some((comment) => (lastNode == null || comment.loc.start.line > lastNode.loc.end.line) && comment.loc.end.line < node.loc.start.line); return hasGroupingComment ? 'PartOfNewChunk' : 'PartOfChunk'; } exports.isPartOfChunk = isPartOfChunk;