Skip to content
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

Drop @typescript-eslint/no-misused-promises #3741

Merged
merged 4 commits into from Mar 3, 2022

Conversation

mcollina
Copy link
Member

@mcollina mcollina commented Mar 3, 2022

Alternative to #3737.
I looked at the actual problem and the typescript rule has a serious bug.
Apparently it cannot figure out anymore that

server.addHook('onRequest', async function (request, reply) {
expectType<FastifyInstance>(this)
expectType<FastifyRequest>(request)
expectType<FastifyReply>(reply)
})
should lint against the async overload we had.

Given this is correct code and we should get the CI green again, I'll land this as soon as it pass. If somebody can open an issue against the typescript-eslint project, that would be awesome.

Checklist

Copy link
Contributor

@xtx1130 xtx1130 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tried

"@typescript-eslint/no-misused-promises": ["error", {
          "checksVoidReturn": false
  }]

But it doesn't work for github ci. So I think we need to update the package version for github ci

@mcollina mcollina merged commit 77841ea into main Mar 3, 2022
@mcollina mcollina deleted the remove-no-misused-promises branch March 3, 2022 08:55
@mcollina
Copy link
Member Author

mcollina commented Mar 3, 2022

I'm landing this as a I have a theory that the pull-request-target check is now run from the main branch

@@ -5,7 +5,7 @@ on:
paths-ignore:
- 'docs/**'
- '*.md'
pull_request_target:
pull_request:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use pull_request_target. It was added to avoid exposing secrets to forks:

https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target

This event runs in the context of the base of the pull request, rather than in the context of the merge commit, as the pull_request event does. This prevents execution of unsafe code from the head of the pull request that could alter your repository or steal any secrets you use in your workflow. This event allows your workflow to do things like label or comment on pull requests from forks. Avoid using this event if you need to build or run code from the pull request.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's broken. It's running the code from the main branch and not the target branch.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. The "base branch" is main. That's exactly what it is supposed to do.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The full code that it runs is main, there is nothing of the current PR that is checkout or run. The code and workflow is now identical to main so it's kind of useless for this specific job where we need the current code.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check out #3737, apparently the updates to package.json and config files where not picked up.

@@ -27,6 +27,7 @@ jobs:

- name: Lint code
run: |
echo 'this is an update'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@github-actions
Copy link

github-actions bot commented Mar 4, 2023

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants