-
Notifications
You must be signed in to change notification settings - Fork 29
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
Add ESLint typescript configuration and address warnings in src folder #81
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great if we could have a shared linter config as a single source of truth and import it here and in the docs. I could stay under our k6/examples folder.
@@ -3,20 +3,22 @@ | |||
* @param value | |||
* @returns | |||
*/ | |||
export function isArrayBuffer(value: any): value is ArrayBuffer { | |||
export function isArrayBuffer(value: unknown): value is ArrayBuffer { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow 🤕
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, I'm sure there's something more clever to do there, but in the meantime, it will do.
What I learned in the process is that the unknown
type is less permissive than any
and will force you to do type assertions whenever you're using that value. See this article that I found useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm much more concerned about the current inability to make type checking on the crypto.hmac
calls though to be fair 👍🏻
(looking into switching to webcrypto there down the road)
Also, in some recent discussions, we questioned whether the |
This Pull Request adds a ESLint configuration to the
src
folder, specific to typescript, based on @EdvinasDaugirdas 's recommendation to use theeslint-typescript:recommended
plugin.This PR also addresses linter warnings in the
src/
folder, and adds a linting Github action.