File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4343 "lint:prettier:fix" : " prettier --write ." ,
4444 "lint:ts" : " tsc --noEmit" ,
4545 "test" : " yarn build && codemod-cli test && node ./test/run-test.js && yarn clean" ,
46- "fixme" : " rm codemods.log && yarn build && codemod-cli test; yarn clean" ,
4746 "update-docs" : " codemod-cli update-docs"
4847 },
4948 "dependencies" : {
Original file line number Diff line number Diff line change @@ -252,12 +252,14 @@ export function createDecoratorImportDeclarations(
252252 const existingImport = getExistingImportForPath ( root , decoratorPath ) ;
253253 if ( existingImport ) {
254254 const existingSpecifiers = existingImport . value . specifiers ;
255- if ( existingSpecifiers ) {
256- existingImport . value . specifiers = [
257- ...existingSpecifiers ,
258- ...specifiers ,
259- ] ;
260- }
255+ existingImport . value . specifiers = [
256+ ...( existingSpecifiers ?? [ ] ) ,
257+ ...specifiers ,
258+ ] . filter (
259+ ( current , i , array ) =>
260+ // Ensure unique specifiers
261+ array . findIndex ( ( s ) => s . local ?. name === current . local ?. name ) === i
262+ ) ;
261263 } else {
262264 firstDeclaration . insertBefore (
263265 createImportDeclaration ( specifiers , decoratorPath )
You can’t perform that action at this time.
0 commit comments