This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Автоматическая группировка импортов в исходном коде typescript | |
### Для работы понадобится jscodeshift | |
``` | |
npm i -g jscodeshift | |
``` | |
### Скачиваем скрипт и кладем в корень проекта с исходным кодом | |
https://gist.github.com/NeoSimvolist/88511054aea3dbbf6c117c340b3fe484#file-no-duplicate-imports-ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright (c) 2019-present, ProductBoard, Inc. | |
* All rights reserved. | |
*/ | |
export default function transform(file, api) { | |
const j = api.jscodeshift; | |
const imports = j(file.source) | |
.find(j.ImportDeclaration) |