-
Notifications
You must be signed in to change notification settings - Fork 5
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
Contract Linting #103
Contract Linting #103
Conversation
f1f8501
to
c4430ad
Compare
80e8adb
to
28d5872
Compare
contract/package.json
Outdated
"@typescript-eslint/eslint-plugin": "^7.0.2", | ||
"@typescript-eslint/parser": "^7.15.0", |
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 believe the typescript-eslint
dep suffices.
"@typescript-eslint/eslint-plugin": "^7.0.2", | |
"@typescript-eslint/parser": "^7.15.0", |
contract/test/test-build-proposal.js
Outdated
|
||
/** | ||
* @param {ExecutionContext<TestContext>} t | ||
*/ | ||
|
||
test.only('proposal builder generates compressed bundles less than 1MB', async t => { |
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.
drive-by, but please take .only
out of the above test. It's already the only test in this module.
contract/test/test-build-proposal.js
Outdated
@@ -17,7 +38,9 @@ test.only('proposal builder generates compressed bundles less than 1MB', async t | |||
|
|||
for (const bundle of bundles) { | |||
// eslint-disable-next-line @jessie.js/safe-await-separator | |||
const buffer = await t.context.compressFile(bundle); | |||
const buffer = await /** @type {TestContext} */ (t.context).compressFile( |
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.
t.context
type should be implied by the type of t
. What happens without this cast?
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's implied to be undefined
. And says t.context is of type unknown
/ava/types/test-fn.d.cts
/** The `t` value passed to test & hook implementations. */
export type ExecutionContext<Context = unknown> = {
/** Test context, shared with hooks. */
context: Context;
/** Title of the test or hook. */
readonly title: string;
...
}
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.
That's because test
wasn't typed. See 064eb83
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.
neat. thanks for this! 🚀
contract/test/test-build-proposal.js
Outdated
/** | ||
* @param {ExecutionContext<TestContext>} t | ||
*/ |
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.
please just type test
. the rest will fall out of that.
https://github.com/Agoric/agoric-sdk/blob/136f1caa919428684a88f2213d0cd9b3185f8a33/packages/boot/test/configs.test.js#L20-L24
const test =
/** @type {import('ava').TestFn<Awaited<ReturnType<typeof makeTestContext>>>}} */ (
anyTest
);
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.
Trusting you'll remove the t.context
casts
contract/test/test-contract.js
Outdated
@@ -59,7 +69,7 @@ test('Install the contract', async t => { | |||
}); | |||
|
|||
test('Start the contract', async t => { | |||
const { zoe, bundle } = t.context; | |||
const { zoe, bundle } = /** @type {TestContext} */ (t.context); |
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.
now that test
is typed, all these casts of t.context
are redundant.
please remove
288727b
to
cfc2b77
Compare
Closes: #35
Description
This PR enables typechecking via tsc and fixes lint errors