eslint-plugin-import-sorting
Version:
ESLint plugin to group and sort imports by module, à la Python isort
10 lines (9 loc) • 385 B
JavaScript
;
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
function rangeToDiff(node, sourceCode) {
let nodeText = sourceCode.getText(node);
let hasTrailingCommaOrSemicolon = nodeText.endsWith(";") || nodeText.endsWith(",");
let [from, to] = node.range;
return to - from - (hasTrailingCommaOrSemicolon ? 1 : 0);
}
exports.rangeToDiff = rangeToDiff;