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

Fix lint and add lint + prettier to CI #461

Merged
merged 7 commits into from
Dec 20, 2024
Merged

Conversation

ZhangYiJiang
Copy link
Contributor

I've noticed while there is a lint and prettier command configured, they are not actually enforced by CI, so some of the code has drifted. Most can be automatically or manually fixed but a few places where the linter has picked up genuine bugs has been left due to lack of context needed to fix them.

This PR tries to bring the code up to lint as much as possible conservatively and add them to CI so they don't drift in the future.

The one big bug that it found is an import cycle between RunGraphNode and the globalRivetNodeRegistry global. There's no easy way to reconcile this other than making the global registry lazy by putting it behind a getter, but that's more code alteration than seems good for a lint fix PR so I'll delegate that to a future PR to fix.

@@ -4,7 +4,7 @@ module.exports = {
es2021: true,
},
root: true,
extends: ['standard-with-typescript', 'plugin:react/recommended'],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This plugin only appears to be used in app, so configuring it here seems to be a mistake

Copy link
Collaborator

Choose a reason for hiding this comment

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

It was intentional I think, because it didn't harm anything, but can't remember much beyond that

@@ -211,7 +211,9 @@ export class HttpCallNodeImpl extends NodeImpl<HttpCallNode> {
const method = getInputOrData(this.data, inputs, 'method', 'string');
const url = getInputOrData(this.data, inputs, 'url', 'string');

// TODO: Use URL.canParse when we drop support for Node 18
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if we have an official Node support policy

@@ -74,6 +74,7 @@ export type ChatCompletionChunk = {
model: string;
};

/* eslint-disable @typescript-eslint/naming-convention */
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if it is better to leave this to match API naming convention or rename to match Rivet/JS naming convention

@ZhangYiJiang ZhangYiJiang marked this pull request as ready for review December 11, 2024 23:50
@ZhangYiJiang
Copy link
Contributor Author

The new checks thingy is pretty nice although it does mean the existing warnings will appear on every PR until they are resolved (but it also means new warnings will show up more prominently which is nice)

@ZhangYiJiang
Copy link
Contributor Author

I'll merge this for now so we can also run lint on the new PRs coming in, the warnings should be fixed later

@ZhangYiJiang ZhangYiJiang merged commit c61c710 into main Dec 20, 2024
2 checks passed
@ZhangYiJiang ZhangYiJiang deleted the lint-and-prettier-action branch December 20, 2024 00:12
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.

2 participants