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

more ts syntax #8335

Merged
merged 10 commits into from
Sep 16, 2023
14 changes: 14 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -164,5 +164,19 @@ module.exports = {
'@jessie.js/safe-await-separator': 'off',
},
},
{
// Types files have no promises to lint and that linter chokes on the .d.ts twin.
// Maybe due to https://github.com/typescript-eslint/typescript-eslint/issues/7435
files: ['types*.js'],
rules: {
// Disabled to prevent:
// Error: Error while loading rule '@typescript-eslint/no-floating-promises': You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.
// Occurred while linting ~agoric-sdk/packages/vats/src/core/types.js
// at Object.getParserServices (~agoric-sdk/node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.js:24:15)
// at create (~agoric-sdk/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-floating-promises.js:77:31)
// at Object.create (~agoric-sdk/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleCreator.js:38:20)
'@typescript-eslint/no-floating-promises': 'off',
},
},
],
};
2 changes: 1 addition & 1 deletion packages/boot/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// @ts-check
// Ambient types
import '@agoric/vats/src/core/types.js';
import '@agoric/vats/src/core/types-ambient.js';
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js';

import { E } from '@endo/far';
import '@agoric/vats/src/core/types.js';
import '@agoric/vats/src/core/types-ambient.js';
import {
makeAgoricNamesAccess,
runModuleBehaviors,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const { Fail } = assert;
export const noop = () => {};

/** @type {DProxy} */
// @ts-expect-error cast
export const mockDProxy = d => d;

export const makeMock = log =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import '@agoric/vats/src/core/types.js';
import '@agoric/vats/src/core/types-ambient.js';

import { test as anyTest } from '@agoric/zoe/tools/prepare-test-env-ava.js';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test as anyTest } from '@agoric/zoe/tools/prepare-test-env-ava.js';

import { AmountMath, makeIssuerKit } from '@agoric/ertp';
import '@agoric/vats/src/core/types.js';
import '@agoric/vats/src/core/types-ambient.js';
import { eventLoopIteration } from '@agoric/internal/src/testing-utils.js';
import { E } from '@endo/far';
import { NonNullish } from '@agoric/assert';
Expand Down
2 changes: 1 addition & 1 deletion packages/smart-wallet/src/invitations.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const MAX_PIPE_LENGTH = 2;

/**
* @param {ERef<ZoeService>} zoe
* @param {ERef<NameHub>} agoricNames
* @param {ERef<import('@agoric/vats').NameHub>} agoricNames
* @param {Brand<'set'>} invitationBrand
* @param {Purse<'set'>} invitationsPurse
* @param {(fromOfferId: string) => import('./types').InvitationMakers} getInvitationContinuation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const publishAgoricBrandsDisplayInfo = async ({
await E(node).setValue(JSON.stringify(aux));
};

/** @type {ERef<NameHub>} */
/** @type {ERef<import('@agoric/vats').NameHub>} */
const brandHub = E(agoricNames).lookup('brand');
const brands = await E(brandHub).values();
// tolerate failure; in particular, for the timer brand
Expand Down
4 changes: 2 additions & 2 deletions packages/smart-wallet/src/smartWallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ const trace = makeTracer('SmrtWlt');
* TODO: consider moving to nameHub.js?
*
* @param {unknown} target - passable Key
* @param {ERef<NameHub>} nameHub
* @param {ERef<import('@agoric/vats').NameHub>} nameHub
*/
const namesOf = async (target, nameHub) => {
const entries = await E(nameHub).entries();
Expand Down Expand Up @@ -447,7 +447,7 @@ export const prepareSmartWallet = (baggage, shared) => {
* to facilitate a transition to decentralized introductions.
*
* @param {Brand} brand
* @param {ERef<NameHub>} known - namehub with brand, issuer branches
* @param {ERef<import('@agoric/vats').NameHub>} known - namehub with brand, issuer branches
* @returns {Promise<Purse | undefined>} undefined if brand is not known
*/
async getPurseIfKnownBrand(brand, known) {
Expand Down
2 changes: 1 addition & 1 deletion packages/smart-wallet/test/supports.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
makeBoard,
} from '@agoric/vats/src/core/basic-behaviors.js';
import { setupClientManager } from '@agoric/vats/src/core/chain-behaviors.js';
import '@agoric/vats/src/core/types.js';
import '@agoric/vats/src/core/types-ambient.js';
import { buildRootObject as boardRoot } from '@agoric/vats/src/vat-board.js';
import { buildRootObject as mintsRoot } from '@agoric/vats/src/vat-mints.js';
import { makeFakeBankKit } from '@agoric/vats/tools/bank-utils.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/smart-wallet/test/test-startWalletFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { E } from '@endo/far';
import path from 'path';
import { makeMockTestSpace } from './supports.js';

import '@agoric/vats/src/core/types.js';
import '@agoric/vats/src/core/types-ambient.js';

/** @type {import('ava').TestFn<Awaited<ReturnType<typeof makeTestContext>>>} */
const test = anyTest;
Expand Down
2 changes: 1 addition & 1 deletion packages/smart-wallet/test/test-walletFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
topicPath,
} from './supports.js';

import '@agoric/vats/src/core/types.js';
import '@agoric/vats/src/core/types-ambient.js';

/** @type {import('ava').TestFn<Awaited<ReturnType<makeDefaultTestContext>>>} */
const test = anyTest;
Expand Down
2 changes: 1 addition & 1 deletion packages/vats/exported.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import './src/core/types.js';
import './src/core/types-ambient.js';
2 changes: 1 addition & 1 deletion packages/vats/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check
// Ambient types
import '@agoric/zoe/exported.js';
import './src/core/types.js';
import './src/core/types-ambient.js';

// eslint-disable-next-line import/export -- no named exports
export * from './src/types.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/vats/src/bridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { M } from '@agoric/store';
import '@agoric/store/exported.js';
import { E } from '@endo/far';
import './core/types.js';
import './core/types-ambient.js';

const { Fail, details: X } = assert;

Expand Down
1 change: 1 addition & 0 deletions packages/vats/src/core/chain-behaviors.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ export const makeChainStorage = async ({
if (!bridgeManager) {
console.warn('Cannot support chainStorage without an actual chain.');
chainStorageP.resolve(null);
// @ts-expect-error expects value or undefined
storageBridgeManagerP.resolve(null);
return;
}
Expand Down
Loading