UNPKG

monk-import-export

Version:

Simple import & export sorting ESLint plugin

17 lines (16 loc) 849 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.maybeReportChunkSorting = void 0; const getSpecifiers_1 = require("./getSpecifiers"); const shared_1 = require("../../../utils/shared"); function maybeReportChunkSorting(chunk, context) { const isSideEffectImport = () => false; const sourceCode = context.getSourceCode(); const items = (0, shared_1.getImportExportItems)(chunk, sourceCode, isSideEffectImport, getSpecifiers_1.getSpecifiers); const sortedItems = [[(0, shared_1.sortImportExportItems)(items)]]; const sorted = (0, shared_1.printSortedItems)(sortedItems, items, sourceCode); const { start } = items[0]; const { end } = items[items.length - 1]; (0, shared_1.maybeReportSorting)(context, sorted, start, end); } exports.maybeReportChunkSorting = maybeReportChunkSorting;