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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
ts-migration/no-test-callbacks #321
ts-migration/no-test-callbacks #321
Conversation
@SimenB this might now need rebasing? Not sure why it's got so many extra commits, when it was originally based off Let me know what you'd like to do about coverage - this is sort of the POC for a couple of rules that are in this boat. |
@G-Rath I think adding a "please file an issue" is fine if we're unable to figure out why it's That said, it might be worth an issue in https://github.com/typescript-eslint/typescript-eslint if you're unable to to reproduce what the type info tells you. Type comes from https://github.com/typescript-eslint/typescript-eslint/blob/807bc2d4f5dbd62aebfcbd01012d41c37066480f/packages/typescript-estree/src/ts-estree/ts-estree.ts#L485 |
@SimenB Awesome. Do you have any secret tips on how to quickly test out the new code? I imagine copying & pasting into |
I do |
I've rebased this. Are you able to verify the |
I tried to test it out against one of my repos, but for some reason eslint kept erroring with My IDE somehow was able to run it just fine (which I double checked a couple of times w/ some The rule worked fine, w/ this code being reported:
and "correctly" fixed:
The fixed code violates For now, I think I'm just going to open up an issue on the TSEslint repo :) |
Seems like I'll need to investigate #268 then... |
I can't confirm that my repo was using the latest code - I just fired from the hip by checking out this branch & copying the I played around w/ updating a few packages on my repo just to be sure. You can see the project structure I use in this repo, just in case it matters that I'm using an extending |
Cool thanks, pushed a fix to |
This is a bit of a tricky one, b/c it's got a bit of "hypothetical" nulls that I can't figure out how to reproduce in action.
As a result, coverage is currently failing, and I've stuck a "please file a github issue" throw as we could use that code to actually test those branches 馃槀
We could eliminate at least one check by having
isFunction
narrow toArrowFunctionExpression
rather thanArrowFunctionExpression | FunctionExpression
, as only the latter hasbody
defined as being nullable (for reasons I can't figure out - anything I try either has a body or gets thrown out as a syntax error).Personally, I think they might be typed like that for if you're constructing AST nodes? But I can't find anything solid explanation :/
The other alternative is to use
!
, but personally I'm not really a fan since it mainly means you'll just have messy errors if it ever isnull
.