File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change 43
43
"lint:prettier:fix" : " prettier --write ." ,
44
44
"lint:ts" : " tsc --noEmit" ,
45
45
"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" ,
47
46
"update-docs" : " codemod-cli update-docs"
48
47
},
49
48
"dependencies" : {
Original file line number Diff line number Diff line change @@ -252,12 +252,14 @@ export function createDecoratorImportDeclarations(
252
252
const existingImport = getExistingImportForPath ( root , decoratorPath ) ;
253
253
if ( existingImport ) {
254
254
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
+ ) ;
261
263
} else {
262
264
firstDeclaration . insertBefore (
263
265
createImportDeclaration ( specifiers , decoratorPath )
You can’t perform that action at this time.
0 commit comments