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

chore: Stricter ESLint config #383

Merged
merged 2 commits into from
Dec 18, 2024
Merged

chore: Stricter ESLint config #383

merged 2 commits into from
Dec 18, 2024

Conversation

going-confetti
Copy link
Collaborator

@going-confetti going-confetti commented Dec 17, 2024

Relevant issue: #277

@going-confetti going-confetti requested a review from a team as a code owner December 17, 2024 10:36
@going-confetti going-confetti requested review from e-fisher and Llandy3d and removed request for a team December 17, 2024 10:36
.eslintrc.cjs Outdated
Comment on lines 50 to 51
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-misused-promises': 'off',
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I suggest turning those on later. It highlighted some cases where we pass async functions as e.g. click handlers

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe add them as warnings?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Initially, I was reluctant to do this, as the number of warning seemed to be too high with quite a few of them not being useful. I then discussed possible solutions with @e-fisher and we found a way to enable these rules with a few tweaks.

@@ -24,6 +24,8 @@ export function stringify(value: unknown): string {
return `{${properties}}`
}

// TODO: https://github.com/grafana/k6-studio/issues/277
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Marked ignore comments with a link to the issue (I'll update the issue description once this PR is merged).
While it does look annoying, the pros of enabling stricter rules for everything else outweigh the cons

Comment on lines +5 to +6
// TODO(router): useLocation is not type-safe. Refactor this route to avoid using it.
const { state } = useLocation() as { state: { externalScriptPath: string } }
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@allansson now I see what you meant, and I barely scratched the surface...

Copy link
Collaborator

Choose a reason for hiding this comment

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

The same goes for getting route params via useParams or search params via useSearchParams. You're just casting things hoping that your routes are structured in a certain way.

e-fisher
e-fisher previously approved these changes Dec 17, 2024
.eslintrc.cjs Outdated
Comment on lines 50 to 51
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-misused-promises': 'off',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe add them as warnings?

@going-confetti going-confetti merged commit 2287eb6 into main Dec 18, 2024
2 checks passed
@going-confetti going-confetti deleted the chore/stricter-eslint branch December 18, 2024 11:22
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.

3 participants