Skip to content

chore: add type-safe ESLint #119

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

Merged
merged 4 commits into from
Apr 25, 2025
Merged

chore: add type-safe ESLint #119

merged 4 commits into from
Apr 25, 2025

Conversation

gagik
Copy link
Collaborator

@gagik gagik commented Apr 25, 2025

Fixes #113

Largely did the minimum viable actions needed to get the linting to pass.

Also added expectDefined so we don't need to keep asserting our types manually.

@gagik gagik force-pushed the gagik/eslint-type branch from 1631038 to 003fe9c Compare April 25, 2025 01:29
@gagik gagik marked this pull request as draft April 25, 2025 08:15
@gagik gagik force-pushed the gagik/eslint-type branch from 003fe9c to 7164709 Compare April 25, 2025 10:32
@gagik gagik marked this pull request as ready for review April 25, 2025 10:33
@@ -203,8 +203,9 @@ export function validateThrowsForInvalidArguments(
it(`throws a schema error for: ${JSON.stringify(arg)}`, async () => {
try {
await integration.mcpClient().callTool({ name, arguments: arg });
expect.fail("Expected an error to be thrown");
throw new Error("Expected an error to be thrown");
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this was not working correctly so we had the false impression that extra fields are problematic with our zod setup; they're not so I removed places where we were using that as an invalid arg scenario

@@ -8,7 +8,7 @@
"strict": true,
"strictNullChecks": true,
"esModuleInterop": true,
"types": ["node"],
"types": ["node", "jest"],
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This just seems to be the best way to get VSCode to stop complaining about the types once in a while but I think can work without too as long as others are represented

@gagik gagik requested a review from nirinchev April 25, 2025 10:35
@coveralls
Copy link
Collaborator

coveralls commented Apr 25, 2025

Pull Request Test Coverage Report for Build 14665235990

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 81.696%

Totals Coverage Status
Change from base Build 14662876403: 0.0%
Covered Lines: 720
Relevant Lines: 830

💛 - Coveralls

Copy link
Collaborator

@nirinchev nirinchev left a comment

Choose a reason for hiding this comment

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

Nice!

} catch (error) {
expect((error as Error).message).not.toEqual("Expected an error to be thrown");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't the assertion just below sufficient? I don't imagine Error is an instance of McpError.

Copy link
Collaborator Author

@gagik gagik Apr 25, 2025

Choose a reason for hiding this comment

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

it is but then the error message is more confusing (it just says expected McpError got Error which originally made me think it was erroring differently instead of not erroring at all). I want to differentiate an external error from the intentional "did not end up erroring" error

@gagik gagik force-pushed the gagik/eslint-type branch from c239276 to 140830c Compare April 25, 2025 12:59
@gagik gagik merged commit 1d65e0b into main Apr 25, 2025
8 checks passed
@gagik gagik deleted the gagik/eslint-type branch April 25, 2025 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable eslint on tests and scripts
3 participants