-
Notifications
You must be signed in to change notification settings - Fork 888
no-unbound-method
in Jasmine spy have been called test
#3755
Comments
The same happen on type detection. This code throws a const property = Object.getOwnPropertyDescriptor(target, propertyName);
if (typeof property === 'object' && typeof property.set === 'function') {
// ...
} |
Have the same issue, how do you use expect() actually with tslint 5.9.1 in jasmine? |
any update on this? |
same issue - same exact test code as the OP actually |
I have the same issues since I updated packages.json
|
Just to make what's expected here clear: the |
I will try to work on this issue and prepare a PR, but this will be my first contribution here, so it might take some time :). If you have any tips on where to start, please let me know. |
Awesome, thanks @piotrgajow! https://palantir.github.io/tslint/develop/custom-rules/walker-design.html is a good starting place. https://astexplorer.net with language set to TypeScript is really useful to explore what the AST looks like for code snippets. Feel free to ask for help on Gitter or Twitter if you have any questions! The docs are a little old and you definitely wouldn't be the only one to want to ask for clarifications! |
I am wondering how to pass the method/operator names that should be excluded in rule checking. Should the options be changed into an object (e.g. |
Great question... we can't break backwards compatibility for the rule, so it should always allow something like |
I have made a PR for this issue, please take a look in some spare time and let me know what do you think about it 😄. |
Fixed by #4472! 🙌 |
Bug Report
TypeScript code being linted
with
tslint.json
configuration:Actual behavior
tslint reports error in the expect line on
component.timerSubscription.unsubscribe
-Avoid referencing unbound methods which may cause unintentional scoping of 'this'
.Expected behavior
This only references the method to check if it has been called - it does not call it, nor it saves it into variable for later calls - so it should not report any errors.
The text was updated successfully, but these errors were encountered: