UNPKG

eslint-plugin-import-sorting

Version:

ESLint plugin to group and sort imports by module, à la Python isort

10 lines (9 loc) 289 B
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); } export { rangeToDiff };