-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: prevent removing decorators on classes #108
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the patch
lib/util/parseFile.ts
Outdated
const syntaxList = node?.getChildren()[syntaxListIndex]; | ||
|
||
if (!syntaxList) { | ||
throw new Error('Syntaxlist missing'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw new Error('Syntaxlist missing'); | |
throw new Error('sytaxList missing'); |
or maybe syntax list
[nit]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
lib/util/parseFile.ts
Outdated
const syntaxListIndex = node | ||
.getChildren() | ||
.findIndex((n) => n.kind === ts.SyntaxKind.SyntaxList); | ||
|
||
const syntaxList = node.getChildren()[syntaxListIndex]; | ||
const syntaxList = node?.getChildren()[syntaxListIndex]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const syntaxList = node?.getChildren()[syntaxListIndex]; | |
const syntaxList = node.getChildren()[syntaxListIndex]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good one, done
lib/util/edit.test.ts
Outdated
export class A {} | ||
const a = new A(); | ||
console.log(a);`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export class A {} | |
const a = new A(); | |
console.log(a);`, | |
export class A {} |
can you remove the class instance and console.log from the added test cases to keep it lean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah yes you're right, done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Prevents removing decorators on exported classes that won't be exported anymore
Case
Before
After