diff --git a/package.json b/package.json index c2b165d31a6..7b9d80a8ea1 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "packages/xs-vat-worker" ], "devDependencies": { + "@typescript-eslint/parser": "^4.1.0", "ava": "^3.12.1", "eslint": "^6.8.0", "eslint-config-airbnb": "^18.0.1", @@ -49,6 +50,7 @@ "eslint-config-jessie": "^0.0.4", "eslint-config-prettier": "^6.9.0", "eslint-plugin-import": "^2.20.0", + "eslint-plugin-jsdoc": "^30.4.2", "eslint-plugin-jsx-a11y": "^6.2.3", "eslint-plugin-prettier": "^3.1.2", "lerna": "^3.20.2", diff --git a/packages/ERTP/package.json b/packages/ERTP/package.json index a03b2723352..2486b8e398f 100644 --- a/packages/ERTP/package.json +++ b/packages/ERTP/package.json @@ -14,7 +14,8 @@ "pretty-check": "prettier --check '**/*.js'", "lint-fix": "yarn lint --fix", "lint-check": "yarn lint", - "lint": "yarn lint:types && eslint '**/*.js'", + "lint": "yarn lint:types && yarn lint:eslint", + "lint:eslint": "eslint '**/*.js'", "lint:types": "tsc -p jsconfig.json", "lint-fix-jessie": "eslint -c '.eslintrc-jessie.js' --fix '**/*.js'", "lint-check-jessie": "eslint -c '.eslintrc-jessie.js' '**/*.js'" @@ -71,8 +72,10 @@ "eslintConfig": { "extends": [ "airbnb-base", - "plugin:prettier/recommended" + "plugin:prettier/recommended", + "plugin:jsdoc/recommended" ], + "parser": "@typescript-eslint/parser", "env": { "es6": true }, @@ -103,7 +106,13 @@ "no-unused-expressions": "off", "no-loop-func": "off", "no-inner-declarations": "off", - "import/prefer-default-export": "off" + "import/prefer-default-export": "off", + "jsdoc/no-undefined-types": "off", + "jsdoc/require-jsdoc": "off", + "jsdoc/require-property-description": "off", + "jsdoc/require-param-description": "off", + "jsdoc/require-returns": "off", + "jsdoc/require-returns-description": "off" } }, "prettier": { diff --git a/packages/ERTP/src/amountMath.js b/packages/ERTP/src/amountMath.js index 0ddfaa08a76..665f0185ae8 100644 --- a/packages/ERTP/src/amountMath.js +++ b/packages/ERTP/src/amountMath.js @@ -12,6 +12,7 @@ import setMathHelpers from './mathHelpers/setMathHelpers'; // We want an enum, but narrowed to the AmountMathKind type. /** * Constants for the kinds of amountMath we support. + * * @type {{ NAT: 'nat', SET: 'set', STRING_SET: 'strSet' }} */ const MathKind = { @@ -99,6 +100,7 @@ function makeAmountMath(brand, amountMathKind) { /** * Make an amount from a value by adding the brand. + * * @param {Value} allegedValue * @returns {Amount} */ @@ -111,6 +113,7 @@ function makeAmountMath(brand, amountMathKind) { /** * Make sure this amount is valid and return it if so, throwing if invalid. + * * @param {Amount} allegedAmount * @returns {Amount} or throws if invalid */ diff --git a/packages/ERTP/src/mathHelpers/natMathHelpers.js b/packages/ERTP/src/mathHelpers/natMathHelpers.js index 0695f22abb7..16611189819 100644 --- a/packages/ERTP/src/mathHelpers/natMathHelpers.js +++ b/packages/ERTP/src/mathHelpers/natMathHelpers.js @@ -15,6 +15,7 @@ const identity = 0; * rounding issues make floats problematic. All operations should be * done with the smallest whole unit such that the NatMathHelpers never * deals with fractional parts. + * * @type {MathHelpers} */ const natMathHelpers = harden({ diff --git a/packages/ERTP/src/types.js b/packages/ERTP/src/types.js index 2d807856a26..12dfb77533c 100644 --- a/packages/ERTP/src/types.js +++ b/packages/ERTP/src/types.js @@ -144,7 +144,7 @@ * * If the payment is a promise, the operation will proceed upon resolution. * - * @property {(payment: PaymentP, optAmount?: Amount) => Promise} burn + * @property {(payment: PaymentP, optAmount: Amount=) => Promise} burn * Burn all of the digital assets in the payment. `optAmount` is optional. * If `optAmount` is present, the code will insist that the amount of * the digital assets in the payment is equal to `optAmount`, to @@ -152,7 +152,7 @@ * * If the payment is a promise, the operation will proceed upon resolution. * - * @property {(payment: PaymentP, optAmount?: Amount) => Promise} claim + * @property {(payment: PaymentP, optAmount: Amount=) => Promise} claim * Transfer all digital assets from the payment to a new payment and * delete the original. `optAmount` is optional. * If `optAmount` is present, the code will insist that the amount of @@ -216,7 +216,7 @@ /** * @typedef {Object} DepositFacet - * @property {(payment: Payment, optAmount?: Amount) => Amount} receive + * @property {(payment: Payment, optAmount: Amount=) => Amount} receive * Deposit all the contents of payment into the purse that made this facet, * returning the amount. If the optional argument `optAmount` does not equal the * amount of digital assets in the payment, throw an error. @@ -240,7 +240,7 @@ * @property {() => Amount} getCurrentAmount * Get the amount contained in this purse. * - * @property {(payment: Payment, optAmount?: Amount) => Amount} deposit + * @property {(payment: Payment, optAmount: Amount=) => Amount} deposit * Deposit all the contents of payment into this purse, returning the * amount. If the optional argument `optAmount` does not equal the * amount of digital assets in the payment, throw an error. diff --git a/packages/assert/package.json b/packages/assert/package.json index bbeb72c42f4..5c0caa76d90 100755 --- a/packages/assert/package.json +++ b/packages/assert/package.json @@ -12,7 +12,8 @@ "test:nyc": "nyc ava", "lint-fix": "yarn lint --fix", "lint-check": "yarn lint", - "lint": "yarn lint:types && eslint '**/*.js'", + "lint": "yarn lint:types && yarn lint:eslint", + "lint:eslint": "eslint '**/*.js'", "lint:types": "tsc -p jsconfig.json", "lint-fix-jessie": "eslint -c '.eslintrc-jessie.js' --fix '**/*.js'", "lint-check-jessie": "eslint -c '.eslintrc-jessie.js' '**/*.js'" @@ -52,8 +53,10 @@ "eslintConfig": { "extends": [ "airbnb-base", - "plugin:prettier/recommended" + "plugin:prettier/recommended", + "plugin:jsdoc/recommended" ], + "parser": "@typescript-eslint/parser", "env": { "es6": true }, @@ -84,7 +87,14 @@ "no-unused-expressions": "off", "no-loop-func": "off", "no-inner-declarations": "off", - "import/prefer-default-export": "off" + "import/prefer-default-export": "off", + "import/no-extraneous-dependencies": "off", + "jsdoc/no-undefined-types": "off", + "jsdoc/require-jsdoc": "off", + "jsdoc/require-property-description": "off", + "jsdoc/require-param-description": "off", + "jsdoc/require-returns": "off", + "jsdoc/require-returns-description": "off" } }, "eslintIgnore": [ diff --git a/packages/assert/src/assert.js b/packages/assert/src/assert.js index dd2a3b22cb6..7a9383bc3af 100644 --- a/packages/assert/src/assert.js +++ b/packages/assert/src/assert.js @@ -35,6 +35,8 @@ harden(an); * The current `cycleTolerantStringify` possibly emits too many "seen" * markings: Not only for cycles, but also for repeated subtrees by * object identity. + * + * @param {any} payload */ function cycleTolerantStringify(payload) { const seenSet = new Set(); @@ -177,8 +179,8 @@ harden(details); * * The optional `optDetails` can be a string for backwards compatibility * with the nodejs assertion library. + * * @param {Details} [optDetails] The details of what was asserted - * @returns {never} */ function fail(optDetails = details`Assert failed`) { if (typeof optDetails === 'string') { @@ -189,11 +191,13 @@ function fail(optDetails = details`Assert failed`) { throw optDetails.complain(); } +/* eslint-disable jsdoc/require-returns-check,jsdoc/valid-types */ /** * @param {*} flag The truthy/falsy value * @param {Details} [optDetails] The details to throw * @returns {asserts flag} */ +/* eslint-enable jsdoc/require-returns-check,jsdoc/valid-types */ function assert(flag, optDetails = details`Check failed`) { if (!flag) { throw fail(optDetails); @@ -202,6 +206,7 @@ function assert(flag, optDetails = details`Check failed`) { /** * Assert that two values must be `Object.is`. + * * @param {*} actual The value we received * @param {*} expected What we wanted * @param {Details} [optDetails] The details to throw @@ -217,6 +222,7 @@ function equal( /** * Assert an expected typeof result. + * * @type {AssertTypeof} * @param {any} specimen The value to get the typeof * @param {string} typename The expected name @@ -239,6 +245,7 @@ const assertTypeof = (specimen, typename, optDetails) => { equal(typeof specimen, typename, optDetails); }; +/* eslint-disable jsdoc/valid-types */ /** * assert that expr is truthy, with an optional details to describe * the assertion. It is a tagged template literal like @@ -258,8 +265,10 @@ const assertTypeof = (specimen, typename, optDetails) => { * * The optional `optDetails` can be a string for backwards compatibility * with the nodejs assertion library. + * * @type {typeof assert & { typeof: AssertTypeof, fail: typeof fail, equal: typeof equal }} */ +/* eslint-enable jsdoc/valid-types */ const assertCombined = Object.assign(assert, { equal, fail, diff --git a/packages/assert/src/types.js b/packages/assert/src/types.js index a12c896b24a..b5ee760332e 100644 --- a/packages/assert/src/types.js +++ b/packages/assert/src/types.js @@ -4,6 +4,7 @@ // Type all the overloads of the assertTypeof function. // There may eventually be a better way to do this, but // thems the breaks with Typescript 4.0. +/* eslint-disable jsdoc/valid-types */ /** * @callback AssertTypeofBigint * @param {any} specimen @@ -53,6 +54,7 @@ * @param {Details} [optDetails] * @returns {asserts specimen is undefined} */ +/* eslint-enable jsdoc/valid-types */ /** * @typedef {AssertTypeofBigint & AssertTypeofBoolean & AssertTypeofFunction & AssertTypeofNumber & AssertTypeofObject & AssertTypeofString & AssertTypeofSymbol & AssertTypeofUndefined} AssertTypeof diff --git a/packages/cosmic-swingset/.eslintrc.js b/packages/cosmic-swingset/.eslintrc.js deleted file mode 100644 index 128816de880..00000000000 --- a/packages/cosmic-swingset/.eslintrc.js +++ /dev/null @@ -1,27 +0,0 @@ -/* global module */ -module.exports = { - extends: ['airbnb-base', 'plugin:prettier/recommended'], - env: { - es6: true, // supports new ES6 globals (e.g., new types such as Set) - }, - rules: { - 'implicit-arrow-linebreak': 'off', - 'function-paren-newline': 'off', - 'arrow-parens': 'off', - strict: 'off', - 'prefer-destructuring': 'off', - 'no-else-return': 'off', - 'no-console': 'off', - 'no-unused-vars': ['error', { - argsIgnorePattern: '^_', - varsIgnorePattern: '^_', - }], - 'no-return-assign': 'off', - 'no-param-reassign': 'off', - 'no-restricted-syntax': ['off', 'ForOfStatement'], - 'no-unused-expressions': 'off', - 'no-loop-func': 'off', - 'no-inner-declarations': 'off', - 'import/prefer-default-export': 'off', - }, -}; diff --git a/packages/cosmic-swingset/lib/ag-solo/chain-cosmos-sdk.js b/packages/cosmic-swingset/lib/ag-solo/chain-cosmos-sdk.js index b8644bde150..7578675f018 100644 --- a/packages/cosmic-swingset/lib/ag-solo/chain-cosmos-sdk.js +++ b/packages/cosmic-swingset/lib/ag-solo/chain-cosmos-sdk.js @@ -317,6 +317,7 @@ ${chainID} chain does not yet know of address ${myAddr}${adviseProvision( /** * Get a notifier that announces every time a block lands. + * * @returns {Notifier} */ const getBlockNotifier = () => { diff --git a/packages/cosmic-swingset/lib/ag-solo/vats/bootstrap.js b/packages/cosmic-swingset/lib/ag-solo/vats/bootstrap.js index a81453c44fd..6f001a778cb 100644 --- a/packages/cosmic-swingset/lib/ag-solo/vats/bootstrap.js +++ b/packages/cosmic-swingset/lib/ag-solo/vats/bootstrap.js @@ -1,5 +1,3 @@ -/* global harden */ - import { allComparable } from '@agoric/same-structure'; import { makeLoopbackProtocolHandler, diff --git a/packages/cosmic-swingset/lib/ag-solo/vats/bridge.js b/packages/cosmic-swingset/lib/ag-solo/vats/bridge.js index da1e7d593aa..f8598862fa1 100644 --- a/packages/cosmic-swingset/lib/ag-solo/vats/bridge.js +++ b/packages/cosmic-swingset/lib/ag-solo/vats/bridge.js @@ -1,11 +1,10 @@ -/* global harden */ // @ts-check import makeStore from '@agoric/store'; /** * @template T - * @typedef {Object} Device + * @typedef {'Device' & { __deviceType__: T }} Device */ /** @@ -25,6 +24,7 @@ import makeStore from '@agoric/store'; * @property {(srcID: string, handler: BridgeHandler) => void} unregister */ +/* eslint-disable jsdoc/valid-types */ /** * Create a handler that demuxes/muxes the bridge device by its first argument. * @@ -33,6 +33,7 @@ import makeStore from '@agoric/store'; * @param {Device} bridgeDevice The bridge to manage * @returns {BridgeManager} admin facet for this handler */ +/* eslint-enable jsdoc/valid-types */ export function makeBridgeManager(E, D, bridgeDevice) { /** * @type {import('@agoric/store').Store} diff --git a/packages/cosmic-swingset/lib/ag-solo/vats/captp.js b/packages/cosmic-swingset/lib/ag-solo/vats/captp.js index a59cefd1a2e..18c5682e977 100644 --- a/packages/cosmic-swingset/lib/ag-solo/vats/captp.js +++ b/packages/cosmic-swingset/lib/ag-solo/vats/captp.js @@ -1,5 +1,3 @@ -/* global harden */ - // Avoid importing the full captp bundle, which would carry // in its own makeHardener, etc. import { makeCapTP } from '@agoric/captp/lib/captp'; diff --git a/packages/cosmic-swingset/lib/ag-solo/vats/ibc.js b/packages/cosmic-swingset/lib/ag-solo/vats/ibc.js index 749e3a90d2f..90b92f725b0 100644 --- a/packages/cosmic-swingset/lib/ag-solo/vats/ibc.js +++ b/packages/cosmic-swingset/lib/ag-solo/vats/ibc.js @@ -1,4 +1,3 @@ -/* global harden */ // @ts-check import { @@ -55,6 +54,7 @@ const FIXME_ALLOW_NAIVE_RELAYS = true; const goodLetters = 'abcdefghijklmnopqrstuvwxyz'; /** * Get a sequence of letters chosen from `goodLetters`. + * * @param {number} n */ function getGoodLetters(n) { @@ -145,6 +145,7 @@ export function makeIBCProtocolHandler(E, callIBCDevice) { /** * Send a packet out via the IBC device. + * * @param {IBCPacket} packet * @param {Store>} seqToAck */ diff --git a/packages/cosmic-swingset/lib/ag-solo/vats/lib-board.js b/packages/cosmic-swingset/lib/ag-solo/vats/lib-board.js index 8da8e0f4959..06f733e0b9c 100644 --- a/packages/cosmic-swingset/lib/ag-solo/vats/lib-board.js +++ b/packages/cosmic-swingset/lib/ag-solo/vats/lib-board.js @@ -1,5 +1,4 @@ // @ts-check -/* global harden */ import { generateSparseInts } from '@agoric/sparse-ints'; import { assert, details, q } from '@agoric/assert'; @@ -11,8 +10,9 @@ const ID_REGEXP = new RegExp(`^[0-9]{${CRC_NUM_DIGITS + 1},}$`); /** * We calculate a CRC, ensuring it's of CRC_NUM_DIGITS length. + * * @param {number} num - * @return {string} + * @returns {string} */ const calcCrc = num => { // The explicit use of crcmodels is to avoid a typing error. @@ -31,11 +31,12 @@ const calcCrc = num => { * @property {(id: string) => any} getValue * @property {(value: any) => string} getId * @property {(value: any) => boolean} has - * @property {() => string[]} ids``` + * @property {() => string[]} ids */ /** * Create a board to post things on. + * * @param {number} [seed=0] * @returns {Board} */ diff --git a/packages/cosmic-swingset/lib/ag-solo/vats/repl.js b/packages/cosmic-swingset/lib/ag-solo/vats/repl.js index 8e1b4eb371b..320b7067763 100644 --- a/packages/cosmic-swingset/lib/ag-solo/vats/repl.js +++ b/packages/cosmic-swingset/lib/ag-solo/vats/repl.js @@ -1,4 +1,4 @@ -/* global harden Compartment */ +/* global Compartment */ import { isPromise } from '@agoric/promise-kit'; import { E } from '@agoric/eventual-send'; diff --git a/packages/cosmic-swingset/lib/ag-solo/vats/scratch.js b/packages/cosmic-swingset/lib/ag-solo/vats/scratch.js index 27fde828f4f..48e3d5cf91d 100644 --- a/packages/cosmic-swingset/lib/ag-solo/vats/scratch.js +++ b/packages/cosmic-swingset/lib/ag-solo/vats/scratch.js @@ -1,5 +1,3 @@ -/* global harden */ - export default function makeScratchPad() { const map = new Map(); async function get(idP) { diff --git a/packages/cosmic-swingset/lib/ag-solo/vats/ui-agent.js b/packages/cosmic-swingset/lib/ag-solo/vats/ui-agent.js index 2418cf14f8a..5c694618902 100644 --- a/packages/cosmic-swingset/lib/ag-solo/vats/ui-agent.js +++ b/packages/cosmic-swingset/lib/ag-solo/vats/ui-agent.js @@ -1,4 +1,3 @@ -/* global harden */ // @ts-check /** @@ -11,16 +10,21 @@ * @property {typeof console} console */ +/* eslint-disable jsdoc/valid-types */ /** * Create a set of UI agent makers. * * @param {UIAgentEndowments} param0 * @returns {{[maker: string]: (petname: string, ext = {}) => UIAgent}} */ +/* eslint-enable jsdoc/valid-types */ export default function makeAgentMakers({ console: agentConsole }) { return harden({ /** * Create an agent that prints to the console with a petname. + * + * @param {string} petname + * @param {Record} [ext={}] */ text(petname, ext = {}) { if (petname === undefined) { @@ -37,6 +41,9 @@ export default function makeAgentMakers({ console: agentConsole }) { }, /** * Create a silent agent. + * + * @param {string} _petname + * @param {Record} [ext={}] */ silent(_petname, ext = {}) { return harden({ diff --git a/packages/cosmic-swingset/lib/ag-solo/vats/vat-board.js b/packages/cosmic-swingset/lib/ag-solo/vats/vat-board.js index b1de0e2bcfd..3f5031bcad8 100644 --- a/packages/cosmic-swingset/lib/ag-solo/vats/vat-board.js +++ b/packages/cosmic-swingset/lib/ag-solo/vats/vat-board.js @@ -1,5 +1,3 @@ -/* global harden */ - import { makeBoard } from './lib-board'; export function buildRootObject(_vatPowers) { diff --git a/packages/cosmic-swingset/lib/ag-solo/vats/vat-host.js b/packages/cosmic-swingset/lib/ag-solo/vats/vat-host.js index 3171bf80cfa..f43b82a9811 100644 --- a/packages/cosmic-swingset/lib/ag-solo/vats/vat-host.js +++ b/packages/cosmic-swingset/lib/ag-solo/vats/vat-host.js @@ -1,7 +1,5 @@ // Copyright (C) 2018 Agoric, under Apache License 2.0 -/* global harden */ - import { makeContractHost } from '@agoric/spawner'; export function buildRootObject(vatPowers) { diff --git a/packages/cosmic-swingset/lib/ag-solo/vats/vat-http.js b/packages/cosmic-swingset/lib/ag-solo/vats/vat-http.js index d3525dd50ad..91751002e68 100644 --- a/packages/cosmic-swingset/lib/ag-solo/vats/vat-http.js +++ b/packages/cosmic-swingset/lib/ag-solo/vats/vat-http.js @@ -1,4 +1,3 @@ -/* global harden */ import { makeNotifierKit } from '@agoric/notifier'; import { E } from '@agoric/eventual-send'; import { getReplHandler } from './repl'; diff --git a/packages/cosmic-swingset/lib/ag-solo/vats/vat-ibc.js b/packages/cosmic-swingset/lib/ag-solo/vats/vat-ibc.js index 53bf43aec0c..d2d1704d683 100644 --- a/packages/cosmic-swingset/lib/ag-solo/vats/vat-ibc.js +++ b/packages/cosmic-swingset/lib/ag-solo/vats/vat-ibc.js @@ -1,4 +1,3 @@ -/* global harden */ import { E } from '@agoric/eventual-send'; import { makeIBCProtocolHandler } from './ibc'; diff --git a/packages/cosmic-swingset/lib/ag-solo/vats/vat-mints.js b/packages/cosmic-swingset/lib/ag-solo/vats/vat-mints.js index d1633c6d17f..02633209bd6 100644 --- a/packages/cosmic-swingset/lib/ag-solo/vats/vat-mints.js +++ b/packages/cosmic-swingset/lib/ag-solo/vats/vat-mints.js @@ -1,5 +1,3 @@ -/* global harden */ - import { makeIssuerKit } from '@agoric/ertp'; import makeStore from '@agoric/store'; diff --git a/packages/cosmic-swingset/lib/ag-solo/vats/vat-network.js b/packages/cosmic-swingset/lib/ag-solo/vats/vat-network.js index 43dc9693af8..139346c1b43 100644 --- a/packages/cosmic-swingset/lib/ag-solo/vats/vat-network.js +++ b/packages/cosmic-swingset/lib/ag-solo/vats/vat-network.js @@ -1,4 +1,3 @@ -/* global harden */ // @ts-check import { E } from '@agoric/eventual-send'; import { makeRouterProtocol } from '@agoric/swingset-vat/src/vats/network/router'; diff --git a/packages/cosmic-swingset/lib/ag-solo/vats/vat-provisioning.js b/packages/cosmic-swingset/lib/ag-solo/vats/vat-provisioning.js index a3f4813f531..c5db6234ba8 100644 --- a/packages/cosmic-swingset/lib/ag-solo/vats/vat-provisioning.js +++ b/packages/cosmic-swingset/lib/ag-solo/vats/vat-provisioning.js @@ -1,4 +1,3 @@ -/* global harden */ import { E } from '@agoric/eventual-send'; // This vat contains the controller-side provisioning service. To enable local diff --git a/packages/cosmic-swingset/lib/ag-solo/vats/vat-registrar.js b/packages/cosmic-swingset/lib/ag-solo/vats/vat-registrar.js index c7780edac1b..16da2ea41ed 100644 --- a/packages/cosmic-swingset/lib/ag-solo/vats/vat-registrar.js +++ b/packages/cosmic-swingset/lib/ag-solo/vats/vat-registrar.js @@ -1,5 +1,3 @@ -/* global harden */ - import { makeRegistrar } from '@agoric/registrar'; // This vat contains the registrar for the demo. diff --git a/packages/cosmic-swingset/lib/ag-solo/vats/vat-sharing.js b/packages/cosmic-swingset/lib/ag-solo/vats/vat-sharing.js index ac9e49ff906..3c714ddf107 100644 --- a/packages/cosmic-swingset/lib/ag-solo/vats/vat-sharing.js +++ b/packages/cosmic-swingset/lib/ag-solo/vats/vat-sharing.js @@ -1,5 +1,3 @@ -/* global harden */ - import { makeSharingService } from '@agoric/sharing-service'; // This vat contains the sharing service for the demo. diff --git a/packages/cosmic-swingset/lib/ag-solo/vats/vat-uploads.js b/packages/cosmic-swingset/lib/ag-solo/vats/vat-uploads.js index 0c3d39912ad..3be4ba64433 100644 --- a/packages/cosmic-swingset/lib/ag-solo/vats/vat-uploads.js +++ b/packages/cosmic-swingset/lib/ag-solo/vats/vat-uploads.js @@ -1,5 +1,3 @@ -/* global harden */ - import makeScratchPad from './scratch'; // This vat contains the private upload scratch pad. diff --git a/packages/cosmic-swingset/lib/ag-solo/vats/vat-zoe.js b/packages/cosmic-swingset/lib/ag-solo/vats/vat-zoe.js index 07d3a60c134..f07315dd0c6 100644 --- a/packages/cosmic-swingset/lib/ag-solo/vats/vat-zoe.js +++ b/packages/cosmic-swingset/lib/ag-solo/vats/vat-zoe.js @@ -1,5 +1,3 @@ -/* global harden */ - import { makeZoe } from '@agoric/zoe'; export function buildRootObject(_vatPowers, vatParameters) { diff --git a/packages/cosmic-swingset/package.json b/packages/cosmic-swingset/package.json index 9774e100474..78383fbeca8 100644 --- a/packages/cosmic-swingset/package.json +++ b/packages/cosmic-swingset/package.json @@ -14,8 +14,9 @@ "pretty-check": "prettier --check '**/*.js'", "lint-fix": "yarn lint --fix", "lint-check": "yarn lint", - "lint": "yarn lint:types && eslint '**/*.js'", - "lint:types": "tsc -p jsconfig.json" + "lint": "yarn lint:types && yarn lint:eslint", + "lint:types": "tsc -p jsconfig.json", + "lint:eslint": "eslint '**/*.js'" }, "keywords": [], "author": "Agoric", @@ -72,6 +73,52 @@ "node-addon-api": "^1.7.1", "nyc": "^15.1.0" }, + "eslintConfig": { + "extends": [ + "airbnb-base", + "plugin:prettier/recommended", + "plugin:jsdoc/recommended" + ], + "parser": "@typescript-eslint/parser", + "env": { + "es6": true + }, + "globals": { + "harden": "readonly" + }, + "rules": { + "implicit-arrow-linebreak": "off", + "function-paren-newline": "off", + "arrow-parens": "off", + "strict": "off", + "prefer-destructuring": "off", + "no-else-return": "off", + "no-console": "off", + "no-unused-vars": [ + "error", + { + "argsIgnorePattern": "^_", + "varsIgnorePattern": "^_" + } + ], + "no-return-assign": "off", + "no-param-reassign": "off", + "no-restricted-syntax": [ + "off", + "ForOfStatement" + ], + "no-unused-expressions": "off", + "no-loop-func": "off", + "no-inner-declarations": "off", + "import/prefer-default-export": "off", + "jsdoc/no-undefined-types": "off", + "jsdoc/require-jsdoc": "off", + "jsdoc/require-property-description": "off", + "jsdoc/require-param-description": "off", + "jsdoc/require-returns": "off", + "jsdoc/require-returns-description": "off" + } + }, "publishConfig": { "access": "public" }, diff --git a/packages/cosmic-swingset/test/unitTests/test-lib-board.js b/packages/cosmic-swingset/test/unitTests/test-lib-board.js index 11eeccaba95..e7b30f05352 100644 --- a/packages/cosmic-swingset/test/unitTests/test-lib-board.js +++ b/packages/cosmic-swingset/test/unitTests/test-lib-board.js @@ -1,4 +1,3 @@ -/* global harden */ // eslint-disable-next-line import/no-extraneous-dependencies import '@agoric/install-ses'; diff --git a/packages/dapp-svelte-wallet/api/package.json b/packages/dapp-svelte-wallet/api/package.json index 42d55e7ffa3..e5fdb3c04fc 100644 --- a/packages/dapp-svelte-wallet/api/package.json +++ b/packages/dapp-svelte-wallet/api/package.json @@ -6,10 +6,11 @@ "scripts": { "build": "exit 0", "test": "ava", - "lint": "yarn lint:types && eslint '**/*.js'", + "lint": "yarn lint:types && yarn lint:eslint", "lint-fix": "yarn lint --fix", "lint-check": "yarn lint", "lint:types": "tsc -p jsconfig.json", + "lint:eslint": "eslint '**/*.js'", "lint-fix-jessie": "eslint -c '.eslintrc-jessie.js' --fix '**/*.{js,jsx}'", "lint-check-jessie": "eslint -c '.eslintrc-jessie.js' '**/*.{js,jsx}'" }, @@ -30,8 +31,10 @@ "eslintConfig": { "extends": [ "airbnb-base", - "plugin:prettier/recommended" + "plugin:prettier/recommended", + "plugin:jsdoc/recommended" ], + "parser": "@typescript-eslint/parser", "env": { "es6": true }, @@ -63,7 +66,13 @@ "no-loop-func": "off", "no-inner-declarations": "off", "import/prefer-default-export": "off", - "import/no-extraneous-dependencies": "off" + "import/no-extraneous-dependencies": "off", + "jsdoc/no-undefined-types": "off", + "jsdoc/require-jsdoc": "off", + "jsdoc/require-property-description": "off", + "jsdoc/require-param-description": "off", + "jsdoc/require-returns": "off", + "jsdoc/require-returns-description": "off" } }, "keywords": [], diff --git a/packages/dapp-svelte-wallet/api/src/lib-dehydrate.js b/packages/dapp-svelte-wallet/api/src/lib-dehydrate.js index 2953c002216..65a464d1280 100644 --- a/packages/dapp-svelte-wallet/api/src/lib-dehydrate.js +++ b/packages/dapp-svelte-wallet/api/src/lib-dehydrate.js @@ -4,12 +4,14 @@ import { makeMarshal } from '@agoric/marshal'; import makeStore from '@agoric/store'; import { assert, details, q } from '@agoric/assert'; +/* eslint-disable jsdoc/valid-types */ /** * @typedef {string[]} Path * @typedef {{} & 'Strongname'} Strongname * @param {any} x * @returns {x is Path} */ +/* eslint-enable jsdoc/valid-types */ export const isPath = x => { if (!Array.isArray(x)) { return false; diff --git a/packages/dapp-svelte-wallet/api/src/lib-wallet.js b/packages/dapp-svelte-wallet/api/src/lib-wallet.js index c36b49d9711..cd6ed3fcf06 100644 --- a/packages/dapp-svelte-wallet/api/src/lib-wallet.js +++ b/packages/dapp-svelte-wallet/api/src/lib-wallet.js @@ -88,6 +88,7 @@ export async function makeWallet({ /** * The default Zoe invite purse is used to make an offer. + * * @type {Purse} */ let zoeInvitePurse; @@ -288,7 +289,7 @@ export async function makeWallet({ const { updater: issuersUpdater, notifier: issuersNotifier, - } = /** @type {NotifierRecord<[Petname, BrandRecord][]>} */ (makeNotifierKit( + } = /** @type {NotifierRecord>} */ (makeNotifierKit( [], )); @@ -474,7 +475,9 @@ export async function makeWallet({ const { updater: contactsUpdater, notifier: contactsNotifier, - } = /** @type {NotifierRecord<[Petname, Contact][]>} */ (makeNotifierKit([])); + } = /** @type {NotifierRecord>} */ (makeNotifierKit( + [], + )); const addContact = async (petname, actions) => { const already = await E(board).has(actions); diff --git a/packages/dapp-svelte-wallet/api/src/observable.js b/packages/dapp-svelte-wallet/api/src/observable.js index 2d107f780b2..6f6152dd5c6 100644 --- a/packages/dapp-svelte-wallet/api/src/observable.js +++ b/packages/dapp-svelte-wallet/api/src/observable.js @@ -2,7 +2,7 @@ * @param {import("@agoric/eventual-send").EProxy} E * @param {Purse} purse * @param {() => void} onFulfilled - * @return {Purse} + * @returns {Purse} */ export default function makeObservablePurse(E, purse, onFulfilled) { return { diff --git a/packages/dapp-svelte-wallet/api/src/types.js b/packages/dapp-svelte-wallet/api/src/types.js index 3c831d6007d..11e12422503 100644 --- a/packages/dapp-svelte-wallet/api/src/types.js +++ b/packages/dapp-svelte-wallet/api/src/types.js @@ -36,7 +36,7 @@ * @typedef {Object} PurseActions * @property {(receiverP: ERef<{ receive: (payment: Payment) => void }>, valueToSend: Value) => Promise} send * @property {(payment: Payment) => Promise} receive - * @property {(payment: Payment, amount?: Amount) => Promise} deposit + * @property {(payment: Payment, amount: Amount=) => Promise} deposit */ /** @@ -94,7 +94,7 @@ * @property {string=} issuerBoardId * * @typedef {Object} PaymentActions - * @property {(purseOrPetname?: Purse | Petname) => Promise} deposit + * @property {(purseOrPetname: (Purse | Petname)=) => Promise} deposit * @property {() => Promise} refresh * @property {() => Promise} getAmountOf */ diff --git a/packages/dapp-svelte-wallet/api/test/test-lib-wallet.js b/packages/dapp-svelte-wallet/api/test/test-lib-wallet.js index d2a5c14531e..125d07dfbc0 100644 --- a/packages/dapp-svelte-wallet/api/test/test-lib-wallet.js +++ b/packages/dapp-svelte-wallet/api/test/test-lib-wallet.js @@ -265,7 +265,7 @@ test('lib-wallet dapp suggests issuer, instance, installation petnames', async t // invite purse balance is rendered with petnames. We should see // unnamed first, then the petnames after those are suggested by // the dapp. - /** @type {{ makeInvitation(): Invitation }} */ + /** @type {{ makeInvitation: () => Invitation }} */ const publicAPI = await E(zoe).getPublicFacet(instance); const invite2 = await E(publicAPI).makeInvitation(); const { @@ -620,7 +620,7 @@ test('lib-wallet offer methods', async t => { ); const rawId2 = '1588645230204'; const id2 = `unknown#${rawId2}`; - /** @type {{ makeInvitation(): Invitation}} */ + /** @type {{ makeInvitation: () => Invitation}} */ const publicAPI = await E(zoe).getPublicFacet(instance); const invite2 = await E(publicAPI).makeInvitation(); const { @@ -774,7 +774,7 @@ test('lib-wallet addOffer for autoswap swap', async t => { simoleanBundle.mint.mintPayment(simoleanBundle.amountMath.make(1000)), ); - /** @type {{ getLiquidityIssuer(): Issuer, makeSwapInvitation(): Invitation }} */ + /** @type {{ getLiquidityIssuer: () => Issuer, makeSwapInvitation: () => Invitation }} */ const publicAPI = await E(zoe).getPublicFacet(autoswapInstanceHandle); const liquidityIssuer = await E(publicAPI).getLiquidityIssuer(); diff --git a/packages/marshal/.eslintrc.js b/packages/marshal/.eslintrc.js deleted file mode 100644 index 128816de880..00000000000 --- a/packages/marshal/.eslintrc.js +++ /dev/null @@ -1,27 +0,0 @@ -/* global module */ -module.exports = { - extends: ['airbnb-base', 'plugin:prettier/recommended'], - env: { - es6: true, // supports new ES6 globals (e.g., new types such as Set) - }, - rules: { - 'implicit-arrow-linebreak': 'off', - 'function-paren-newline': 'off', - 'arrow-parens': 'off', - strict: 'off', - 'prefer-destructuring': 'off', - 'no-else-return': 'off', - 'no-console': 'off', - 'no-unused-vars': ['error', { - argsIgnorePattern: '^_', - varsIgnorePattern: '^_', - }], - 'no-return-assign': 'off', - 'no-param-reassign': 'off', - 'no-restricted-syntax': ['off', 'ForOfStatement'], - 'no-unused-expressions': 'off', - 'no-loop-func': 'off', - 'no-inner-declarations': 'off', - 'import/prefer-default-export': 'off', - }, -}; diff --git a/packages/marshal/marshal.js b/packages/marshal/marshal.js index 4a226ed0a7d..da2d224cbef 100644 --- a/packages/marshal/marshal.js +++ b/packages/marshal/marshal.js @@ -1,4 +1,3 @@ -/* global harden */ // @ts-check // eslint-disable-next-line spaced-comment @@ -19,6 +18,7 @@ export { mustPassByRemote as mustPassByPresence }; * This is an interface specification. * For now, it is just a string, but will eventually become something * much richer (anything that pureCopy accepts). + * * @typedef {string} InterfaceSpec */ @@ -45,6 +45,7 @@ export function getInterfaceOf(maybeRemotable) { * * @template T * @param {T} val input value. NOTE: Must be hardened! + * @param {WeakMap} [already=new WeakMap()] * @returns {T} pure, hardened copy */ function pureCopy(val, already = new WeakMap()) { diff --git a/packages/marshal/package.json b/packages/marshal/package.json index 35c8ab7cf30..1800e93e30c 100644 --- a/packages/marshal/package.json +++ b/packages/marshal/package.json @@ -14,8 +14,9 @@ "pretty-check": "prettier --check '**/*.js'", "lint-fix": "yarn lint --fix", "lint-check": "yarn lint", - "lint": "yarn lint:types && eslint '**/*.js'", - "lint:types": "tsc -p jsconfig.json" + "lint": "yarn lint:types && yarn lint:eslint", + "lint:types": "tsc -p jsconfig.json", + "lint:eslint": "eslint '**/*.js'" }, "repository": { "type": "git", @@ -42,6 +43,53 @@ "esm": "^3.2.25", "nyc": "^15.1.0" }, + "eslintConfig": { + "extends": [ + "airbnb-base", + "plugin:prettier/recommended", + "plugin:jsdoc/recommended" + ], + "parser": "@typescript-eslint/parser", + "env": { + "es6": true + }, + "globals": { + "harden": "readonly" + }, + "rules": { + "implicit-arrow-linebreak": "off", + "function-paren-newline": "off", + "arrow-parens": "off", + "strict": "off", + "prefer-destructuring": "off", + "no-else-return": "off", + "no-console": "off", + "no-unused-vars": [ + "error", + { + "argsIgnorePattern": "^_", + "varsIgnorePattern": "^_" + } + ], + "no-return-assign": "off", + "no-param-reassign": "off", + "no-restricted-syntax": [ + "off", + "ForOfStatement" + ], + "no-unused-expressions": "off", + "no-loop-func": "off", + "no-inner-declarations": "off", + "import/prefer-default-export": "off", + "import/no-extraneous-dependencies": "off", + "jsdoc/no-undefined-types": "off", + "jsdoc/require-jsdoc": "off", + "jsdoc/require-property-description": "off", + "jsdoc/require-param-description": "off", + "jsdoc/require-returns": "off", + "jsdoc/require-returns-description": "off" + } + }, "publishConfig": { "access": "public" }, diff --git a/packages/marshal/test/test-marshal.js b/packages/marshal/test/test-marshal.js index 1e495991ffd..a32ae979c5e 100644 --- a/packages/marshal/test/test-marshal.js +++ b/packages/marshal/test/test-marshal.js @@ -1,4 +1,4 @@ -/* global harden BigInt */ +/* global BigInt */ import '@agoric/install-ses'; import test from 'ava'; diff --git a/packages/notifier/package.json b/packages/notifier/package.json index bb6086a2ea3..d085d25cde7 100644 --- a/packages/notifier/package.json +++ b/packages/notifier/package.json @@ -12,7 +12,8 @@ "test:nyc": "nyc ava", "lint-fix": "yarn lint --fix", "lint-check": "yarn lint", - "lint": "yarn lint:types && eslint '**/*.js'", + "lint": "yarn lint:types && yarn lint:eslint", + "lint:eslint": "eslint '**/*.js'", "lint:types": "tsc -p jsconfig.json", "lint-fix-jessie": "eslint -c '.eslintrc-jessie.js' --fix '**/*.js'", "lint-check-jessie": "eslint -c '.eslintrc-jessie.js' '**/*.js'" @@ -48,8 +49,10 @@ "eslintConfig": { "extends": [ "airbnb-base", - "plugin:prettier/recommended" + "plugin:prettier/recommended", + "plugin:jsdoc/recommended" ], + "parser": "@typescript-eslint/parser", "env": { "es6": true }, @@ -81,7 +84,13 @@ "no-loop-func": "off", "no-inner-declarations": "off", "import/prefer-default-export": "off", - "import/no-extraneous-dependencies": "off" + "import/no-extraneous-dependencies": "off", + "jsdoc/no-undefined-types": "off", + "jsdoc/require-jsdoc": "off", + "jsdoc/require-property-description": "off", + "jsdoc/require-param-description": "off", + "jsdoc/require-returns": "off", + "jsdoc/require-returns-description": "off" } }, "eslintIgnore": [ diff --git a/packages/notifier/src/notifier.js b/packages/notifier/src/notifier.js index 221bb0a4b41..590509179ea 100644 --- a/packages/notifier/src/notifier.js +++ b/packages/notifier/src/notifier.js @@ -24,7 +24,7 @@ import './types'; * an initial state. Its initial state will instead be the state of the first * update. * - * @template T the type of the notifier state + * @template T * @param {[] | [T]} args the first state to be returned * @returns {NotifierRecord} the notifier and updater */ diff --git a/packages/notifier/src/types.js b/packages/notifier/src/types.js index d40a7aa0e44..4f84d552eed 100644 --- a/packages/notifier/src/types.js +++ b/packages/notifier/src/types.js @@ -14,14 +14,14 @@ */ /** - * @template T the type of the state value + * @template T * @typedef {Object} UpdateRecord * @property {T} value is whatever state the service wants to publish * @property {UpdateCount} updateCount is a value that identifies the update */ /** - * @template T the type of the notifier state + * @template T * @callback GetUpdateSince Can be called repeatedly to get a sequence of * update records * @param {UpdateCount} [updateCount] return update record as of an update @@ -34,7 +34,7 @@ */ /** - * @template T the type of the notifier state + * @template T * @typedef {Object} BaseNotifier an object that can be used to get the current * state or updates * @property {GetUpdateSince} getUpdateSince return update record as of an @@ -42,13 +42,13 @@ */ /** - * @template T the type of the notifier state + * @template T * @typedef {BaseNotifier & AsyncIterable} Notifier an object that can * be used to get the current state or updates */ /** - * @template T the type of the notifier state + * @template T * @typedef {Object} Updater an object that should be closely held, as * anyone with access to * it can provide updates @@ -63,7 +63,7 @@ */ /** - * @template T the type of the notifier state + * @template T * @typedef {Object} NotifierRecord the produced notifier/updater pair * @property {Notifier} notifier the (widely-held) notifier consumer * @property {Updater} updater the (closely-held) notifier producer diff --git a/packages/promise-kit/package.json b/packages/promise-kit/package.json index c49651b9ef9..b972fd5249a 100644 --- a/packages/promise-kit/package.json +++ b/packages/promise-kit/package.json @@ -11,7 +11,8 @@ "test": "exit 0", "lint-fix": "yarn lint --fix", "lint-check": "yarn lint", - "lint": "yarn lint:types && eslint '**/*.js'", + "lint": "yarn lint:types && yarn lint:eslint", + "lint:eslint": "eslint '**/*.js'", "lint:types": "tsc -p jsconfig.json", "lint-fix-jessie": "eslint -c '.eslintrc-jessie.js' --fix '**/*.js'", "lint-check-jessie": "eslint -c '.eslintrc-jessie.js' '**/*.js'" @@ -44,8 +45,10 @@ "eslintConfig": { "extends": [ "airbnb-base", - "plugin:prettier/recommended" + "plugin:prettier/recommended", + "plugin:jsdoc/recommended" ], + "parser": "@typescript-eslint/parser", "env": { "es6": true }, @@ -73,7 +76,14 @@ "no-unused-expressions": "off", "no-loop-func": "off", "no-inner-declarations": "off", - "import/prefer-default-export": "off" + "import/prefer-default-export": "off", + "import/no-extraneous-dependencies": "off", + "jsdoc/no-undefined-types": "off", + "jsdoc/require-jsdoc": "off", + "jsdoc/require-property-description": "off", + "jsdoc/require-param-description": "off", + "jsdoc/require-returns": "off", + "jsdoc/require-returns-description": "off" } }, "eslintIgnore": [ diff --git a/packages/promise-kit/src/promiseKit.js b/packages/promise-kit/src/promiseKit.js index adf85fcf41b..bc5dce9921e 100644 --- a/packages/promise-kit/src/promiseKit.js +++ b/packages/promise-kit/src/promiseKit.js @@ -68,12 +68,14 @@ export function makePromiseKit() { } harden(makePromiseKit); +/* eslint-disable jsdoc/valid-types */ /** * Determine if the argument is a Promise. * * @param {any} maybePromise The value to examine * @returns {maybePromise is Promise} Whether it is a promise */ +/* eslint-enable jsdoc/valid-types */ export function isPromise(maybePromise) { return Promise.resolve(maybePromise) === maybePromise; } diff --git a/packages/zoe/jsconfig.json b/packages/zoe/jsconfig.json index 654a5ba02d0..62af51492cf 100644 --- a/packages/zoe/jsconfig.json +++ b/packages/zoe/jsconfig.json @@ -1,7 +1,7 @@ // This file can contain .js-specific Typescript compiler config. { "compilerOptions": { - "target": "es2020", + "target": "esnext", "noEmit": true, /* diff --git a/packages/zoe/package.json b/packages/zoe/package.json index 93620a1173c..f35f224dbf8 100644 --- a/packages/zoe/package.json +++ b/packages/zoe/package.json @@ -13,7 +13,8 @@ "build-zcfBundle": "node -r esm scripts/build-zcfBundle.js", "lint-fix": "yarn lint --fix", "lint-check": "yarn lint", - "lint": "yarn lint:types && eslint '**/*.js'", + "lint": "yarn lint:types && yarn lint:eslint", + "lint:eslint": "eslint '**/*.js'", "lint:types": "tsc -p jsconfig.json", "lint-fix-jessie": "eslint -c '.eslintrc-jessie.js' --fix '**/*.js'", "lint-check-jessie": "eslint -c '.eslintrc-jessie.js' '**/*.js'" @@ -75,8 +76,10 @@ "eslintConfig": { "extends": [ "airbnb-base", - "plugin:prettier/recommended" + "plugin:prettier/recommended", + "plugin:jsdoc/recommended" ], + "parser": "@typescript-eslint/parser", "env": { "es6": true }, @@ -107,7 +110,13 @@ "no-unused-expressions": "off", "no-loop-func": "off", "no-inner-declarations": "off", - "import/prefer-default-export": "off" + "import/prefer-default-export": "off", + "jsdoc/no-undefined-types": "off", + "jsdoc/require-jsdoc": "off", + "jsdoc/require-property-description": "off", + "jsdoc/require-param-description": "off", + "jsdoc/require-returns": "off", + "jsdoc/require-returns-description": "off" } }, "eslintIgnore": [ diff --git a/packages/zoe/src/cleanProposal.js b/packages/zoe/src/cleanProposal.js index 8dc4abaf8cf..7a48bd139cc 100644 --- a/packages/zoe/src/cleanProposal.js +++ b/packages/zoe/src/cleanProposal.js @@ -98,6 +98,7 @@ export const cleanKeywords = keywordRecord => { * `exit`, if present, must be a record of one of the following forms: * `{ waived: null }` `{ onDemand: null }` `{ afterDeadline: { timer * :Timer, deadline :Number } } + * * @param {(brand: Brand) => AmountMath} getAmountMath * @param {Proposal} proposal * @returns {ProposalRecord} diff --git a/packages/zoe/src/contractFacet/contractFacet.js b/packages/zoe/src/contractFacet/contractFacet.js index 942b81bb018..3a50c13d787 100644 --- a/packages/zoe/src/contractFacet/contractFacet.js +++ b/packages/zoe/src/contractFacet/contractFacet.js @@ -31,7 +31,7 @@ import '../../exported'; import '../internal-types'; export function buildRootObject(_powers, _params, testJigSetter = undefined) { - /** @type ExecuteContract */ + /** @type {ExecuteContract} */ const executeContract = async ( bundle, zoeService, @@ -39,15 +39,15 @@ export function buildRootObject(_powers, _params, testJigSetter = undefined) { zoeInstanceAdmin, instanceRecord, ) => { - /** @type IssuerTable */ + /** @type {IssuerTable} */ const issuerTable = makeIssuerTable(); const getAmountMath = brand => issuerTable.getByBrand(brand).amountMath; const invitationHandleToHandler = makeWeakStore('invitationHandle'); - /** @type WeakStore */ + /** @type {WeakStore} */ const zcfSeatToZCFSeatAdmin = makeWeakStore('zcfSeat'); - /** @type WeakStore */ + /** @type {WeakStore} */ const zcfSeatToSeatHandle = makeWeakStore('zcfSeat'); const keywords = Object.keys(instanceRecord.terms.issuers); @@ -56,7 +56,7 @@ export function buildRootObject(_powers, _params, testJigSetter = undefined) { const initIssuers = issuersP => Promise.all(issuersP.map(issuerTable.initIssuer)); - /** @type RegisterIssuerRecord */ + /** @type {RegisterIssuerRecord} */ const registerIssuerRecord = (keyword, issuerRecord) => { instanceRecord = { ...instanceRecord, @@ -80,7 +80,7 @@ export function buildRootObject(_powers, _params, testJigSetter = undefined) { return issuerRecord; }; - /** @type RegisterIssuerRecordWithKeyword */ + /** @type {RegisterIssuerRecordWithKeyword} */ const registerIssuerRecordWithKeyword = (keyword, issuerRecord) => { assertKeywordName(keyword); assert( @@ -101,6 +101,8 @@ export function buildRootObject(_powers, _params, testJigSetter = undefined) { * Unlike the zcf.reallocate method, this one does not check conservation, * and so can be used internally for reallocations that violate * conservation. + * + * @param {SeatStaging[]} seatStagings */ const reallocateInternal = seatStagings => { // Keep track of seats used so far in this call, to prevent aliasing. @@ -143,7 +145,7 @@ export function buildRootObject(_powers, _params, testJigSetter = undefined) { E(zoeInstanceAdmin).replaceAllocations(seatHandleAllocations); }; - /** @type MakeZCFMint */ + /** @type {MakeZCFMint} */ const makeZCFMint = async (keyword, amountMathKind = MathKind.NAT) => { assert( !(keyword in instanceRecord.terms.issuers), @@ -164,7 +166,7 @@ export function buildRootObject(_powers, _params, testJigSetter = undefined) { registerIssuerRecordWithKeyword(keyword, mintyIssuerRecord); issuerTable.initIssuerByRecord(mintyIssuerRecord); - /** @type ZCFMint */ + /** @type {ZCFMint} */ const zcfMint = harden({ getIssuerRecord: () => { return mintyIssuerRecord; @@ -232,9 +234,9 @@ export function buildRootObject(_powers, _params, testJigSetter = undefined) { return zcfMint; }; - /** @type ContractFacet */ + /** @type {ContractFacet} */ const zcf = { - reallocate: (/** @type SeatStaging[] */ ...seatStagings) => { + reallocate: (/** @type {SeatStaging[]} */ ...seatStagings) => { // We may want to handle this with static checking instead. // Discussion at: https://github.com/Agoric/agoric-sdk/issues/1017 assert( @@ -364,7 +366,7 @@ export function buildRootObject(_powers, _params, testJigSetter = undefined) { * will be appended to the returned jig object (overriding any * provided by the `testFn`). * - * @type SetTestJig + * @type {SetTestJig} */ setTestJig: (testFn = () => ({})) => { if (testJigSetter) { @@ -377,7 +379,7 @@ export function buildRootObject(_powers, _params, testJigSetter = undefined) { // addSeatObject gives Zoe the ability to notify ZCF when a new seat is // added in offer(). ZCF responds with the exitObj and offerResult. - /** @type AddSeatObj */ + /** @type {AddSeatObj} */ const addSeatObj = { addSeat: (invitationHandle, zoeSeatAdmin, seatData, seatHandle) => { const { zcfSeatAdmin, zcfSeat } = makeZcfSeatAdminKit( @@ -398,7 +400,7 @@ export function buildRootObject(_powers, _params, testJigSetter = undefined) { zoeSeatAdmin, zcfSeatAdmin, ); - /** @type AddSeatResult */ + /** @type {AddSeatResult} */ return harden({ offerResultP, exitObj }); }, }; diff --git a/packages/zoe/src/contractFacet/exit.js b/packages/zoe/src/contractFacet/exit.js index 208819ca2c0..a60aaa3bc94 100644 --- a/packages/zoe/src/contractFacet/exit.js +++ b/packages/zoe/src/contractFacet/exit.js @@ -6,7 +6,7 @@ import { E } from '@agoric/eventual-send'; * to request the position be exited. */ -/** @type MakeExitObj */ +/** @type {MakeExitObj} */ export const makeExitObj = (proposal, zoeSeatAdmin, zcfSeatAdmin) => { const [exitKind] = Object.getOwnPropertyNames(proposal.exit); diff --git a/packages/zoe/src/contractFacet/offerSafety.js b/packages/zoe/src/contractFacet/offerSafety.js index 0685619c4df..69152a72bc2 100644 --- a/packages/zoe/src/contractFacet/offerSafety.js +++ b/packages/zoe/src/contractFacet/offerSafety.js @@ -4,6 +4,7 @@ * Helper to perform satisfiesWant and satisfiesGive. Is * allocationAmount greater than or equal to requiredAmount for every * keyword of giveOrWant? + * * @param {(brand: Brand) => AmountMath} getAmountMath * @param {AmountKeywordRecord} giveOrWant * @param {AmountKeywordRecord} allocation @@ -25,6 +26,7 @@ const satisfiesInternal = (getAmountMath, giveOrWant = {}, allocation) => { /** * For this allocation to satisfy what the user wanted, their * allocated amounts must be greater than or equal to proposal.want. + * * @param {(brand: Brand) => AmountMath} getAmountMath - a * function that takes a brand and returns the appropriate amountMath. * The function must have an amountMath for every brand in @@ -46,6 +48,7 @@ const satisfiesWant = (getAmountMath, proposal, allocation) => * For this allocation to count as a full refund, the allocated * amounts must be greater than or equal to what was originally * offered (proposal.give). + * * @param {(brand: Brand) => AmountMath} getAmountMath - a * function that takes a brand and returns the appropriate amountMath. * The function must have an amountMath for every brand in diff --git a/packages/zoe/src/contractFacet/rightsConservation.js b/packages/zoe/src/contractFacet/rightsConservation.js index a94922c0e3c..d2ce2114baa 100644 --- a/packages/zoe/src/contractFacet/rightsConservation.js +++ b/packages/zoe/src/contractFacet/rightsConservation.js @@ -9,6 +9,7 @@ import '../internal-types'; /** * Iterate over the amounts and sum, storing the sums in a * map by brand. + * * @param {(brand: Brand) => AmountMath} getAmountMath - a function * to get amountMath given a brand. * @param {Amount[]} amounts - an array of amounts @@ -31,6 +32,7 @@ const sumByBrand = (getAmountMath, amounts) => { /** * Assert that the left sums by brand equal the right sums by brand + * * @param {(brand: Brand) => AmountMath} getAmountMath - a function * to get amountMath given a brand. * @param {Store} leftSumsByBrand - a map of brands to sums @@ -65,6 +67,7 @@ const assertEqualPerBrand = ( /** * `assertRightsConserved` checks that the total amount per brand is * equal to the total amount per brand in the proposed reallocation + * * @param {(brand: Brand) => AmountMath} getAmountMath - a function * to get amountMath given a brand. * @param {Amount[]} previousAmounts - an array of the amounts before the diff --git a/packages/zoe/src/contractFacet/types.js b/packages/zoe/src/contractFacet/types.js index d31137c2b21..72bc8e153c9 100644 --- a/packages/zoe/src/contractFacet/types.js +++ b/packages/zoe/src/contractFacet/types.js @@ -26,7 +26,7 @@ * @property {(brand: Brand) => Issuer} getIssuerForBrand * @property {GetAmountMath} getAmountMath * @property {MakeZCFMint} makeZCFMint - * @property {(exit?: ExitRule) => ZcfSeatKit} makeEmptySeatKit + * @property {(exit: ExitRule=) => ZcfSeatKit} makeEmptySeatKit * @property {SetTestJig} setTestJig */ @@ -102,7 +102,7 @@ /** * @callback SetTestJig - * @param {() => any=() => {}} testFn + * @param {() => any} testFn * @returns {void} */ @@ -110,7 +110,7 @@ * @typedef {Object} ZCFMint * @property {() => IssuerRecord} getIssuerRecord * @property {(gains: AmountKeywordRecord, - * zcfSeat?: ZCFSeat, + * zcfSeat: ZCFSeat=, * ) => ZCFSeat} mintGains * All the amounts in gains must be of this ZCFMint's brand. * The gains' keywords are in the namespace of that seat. @@ -138,7 +138,7 @@ /** * @typedef {Object} ZCFSeat * @property {() => void} exit - * @property {(reason?: Error) => Error} kickOut called with the reason this + * @property {(reason: Error=) => Error} kickOut called with the reason this * seat is being kicked out, where reason is normally an instanceof Error. * @property {() => Notifier} getNotifier * @property {() => boolean} hasExited @@ -147,7 +147,7 @@ * The brand is used for filling in an empty amount if the `keyword` * is not present in the allocation * @property {() => Allocation} getCurrentAllocation - * @property {(newAllocation: Allocation) => Boolean} isOfferSafe + * @property {(newAllocation: Allocation) => boolean} isOfferSafe * @property {(newAllocation: Allocation) => SeatStaging} stage */ diff --git a/packages/zoe/src/contractSupport/bondingCurves.js b/packages/zoe/src/contractSupport/bondingCurves.js index ff83123049a..7e318bd0c4b 100644 --- a/packages/zoe/src/contractSupport/bondingCurves.js +++ b/packages/zoe/src/contractSupport/bondingCurves.js @@ -14,6 +14,7 @@ const { add, subtract, multiply, floorDivide } = natSafeMath; * is valid, getting the current price for an asset on user * request, and to do the actual reallocation after an offer has * been made. + * * @param {Object} params * @param {number} params.inputValue - the value of the asset sent * in to be swapped @@ -47,6 +48,7 @@ export const getInputPrice = ({ * is valid, getting the current price for an asset on user * request, and to do the actual reallocation after an offer has * been made. + * * @param {Object} params * @param {number} params.outputValue - the value of the asset the user wants * to get @@ -106,10 +108,10 @@ export const calcLiqValueToMint = ({ * match the current ratio of holdings in the pool. * * @param {Object} params - * @param params.centralIn - The value of central assets being deposited - * @param params.centralPool - The value of central assets in the pool - * @param params.secondaryPool - The value of secondary assets in the pool - * @param params.secondaryIn - The value of secondary assets provided. If + * @param {number} params.centralIn - The value of central assets being deposited + * @param {number} params.centralPool - The value of central assets in the pool + * @param {number} params.secondaryPool - The value of secondary assets in the pool + * @param {number} params.secondaryIn - The value of secondary assets provided. If * the pool is empty, the entire amount will be accepted * @returns {number} - the amount of secondary required */ diff --git a/packages/zoe/src/contractSupport/zoeHelpers.js b/packages/zoe/src/contractSupport/zoeHelpers.js index 62879dd6ce2..2c8b8082f57 100644 --- a/packages/zoe/src/contractSupport/zoeHelpers.js +++ b/packages/zoe/src/contractSupport/zoeHelpers.js @@ -20,6 +20,7 @@ const getKeysSorted = obj => * toGains will be added to 'to'. If fromLosses is defined, all the * entries in fromLosses are subtracted from 'from'. (If fromLosses * is not defined, toGains is subtracted from 'from'.) + * * @param {ContractFacet} zcf * @param {FromToAllocations} allocations - the 'to' and 'from' * allocations @@ -100,6 +101,7 @@ export const assertIssuerKeywords = (zcf, expected) => { * checked. The update is merged with currentAllocation * (update's values prevailing if the keywords are the same) * to produce the newAllocation. + * * @param {ContractFacet} zcf * @param {ZCFSeat} seat * @param {AmountKeywordRecord} update @@ -186,7 +188,7 @@ export const trade = ( } }; -/** @type Swap */ +/** @type {Swap} */ export const swap = ( zcf, leftSeat, @@ -220,7 +222,7 @@ export const swap = ( }; /** - * @type Swap + * @type {Swap} * Swap such that both seats gain what they want and lose everything * that they gave. Only good for exact and entire swaps where each * seat wants everything that the other seat has. The benefit of using @@ -260,12 +262,14 @@ export const swapExact = ( return defaultAcceptanceMsg; }; +/* eslint-disable jsdoc/valid-types */ /** * @typedef ExpectedRecord * @property {Record} [want] * @property {Record} [give] * @property {Partial>} [exit] */ +/* eslint-enable jsdoc/valid-types */ /** * Check the seat's proposal against an `expected` record that says @@ -374,6 +378,7 @@ export async function withdrawFromSeat(zcf, seat, amounts) { * Save all of the issuers in an issuersKeywordRecord to ZCF, using * the method `zcf.saveIssuer`. This does not error if any of the keywords * already exist. If the keyword is already present, it is ignored. + * * @param {ContractFacet} zcf * @param {IssuerKeywordRecord} issuerKeywordRecord Issuers to save to * ZCF diff --git a/packages/zoe/src/contracts/automaticRefund.js b/packages/zoe/src/contracts/automaticRefund.js index b11069ca211..290494c32c1 100644 --- a/packages/zoe/src/contracts/automaticRefund.js +++ b/packages/zoe/src/contracts/automaticRefund.js @@ -13,6 +13,7 @@ import '../../exported'; * Since the contract doesn't attempt any reallocation, the offer can contain * anything in `give` and `want`. The amount in `give` will be returned, and * `want` will be ignored. + * * @type {ContractStartFn} * @param {ContractFacet} zcf */ diff --git a/packages/zoe/src/contracts/autoswap.js b/packages/zoe/src/contracts/autoswap.js index 81866ccff8e..940db33b93c 100644 --- a/packages/zoe/src/contracts/autoswap.js +++ b/packages/zoe/src/contracts/autoswap.js @@ -73,11 +73,14 @@ const start = async zcf => { maths: { Central: centralMath, Secondary: secondaryMath }, } = zcf.getTerms(); Object.values(brands).forEach(brand => assertUsesNatMath(zcf, brand)); - /** @typedef {Map} */ + /** @type {Map} */ const brandToKeyword = new Map( Object.entries(brands).map(([keyword, brand]) => [brand, keyword]), ); - /** @return {string} */ + /** + * @param {Brand} brand + * @returns {string} + */ const getPoolKeyword = brand => { assert(brandToKeyword.has(brand), 'getPoolKeyword: brand not found'); // @ts-ignore @@ -327,9 +330,10 @@ const start = async zcf => { /** * `getOutputForGivenInput` calculates the result of a trade, given a certain * amount of digital assets in. + * * @param {Amount} amountIn - the amount of digital * assets to be sent in - * @param brandOut - The brand of asset desired + * @param {Brand} brandOut - The brand of asset desired */ const getOutputForGivenInput = (amountIn, brandOut) => { const inputReserve = getPoolAmount(amountIn.brand).value; @@ -347,8 +351,9 @@ const start = async zcf => { /** * `getInputForGivenOutput` calculates the amount of assets required to be * provided in order to obtain a specified gain. + * * @param {Amount} amountOut - the amount of digital assets desired - * @param brandIn - The brand of asset desired + * @param {Brand} brandIn - The brand of asset desired */ const getInputForGivenOutput = (amountOut, brandIn) => { const inputReserve = getPoolAmount(brandIn).value; diff --git a/packages/zoe/src/contracts/multipoolAutoswap/getCurrentPrice.js b/packages/zoe/src/contracts/multipoolAutoswap/getCurrentPrice.js index 39a925361c8..a021e76933e 100644 --- a/packages/zoe/src/contracts/multipoolAutoswap/getCurrentPrice.js +++ b/packages/zoe/src/contracts/multipoolAutoswap/getCurrentPrice.js @@ -14,10 +14,11 @@ export const makeGetCurrentPrice = (isSecondary, isCentral, getPool) => { /** * `getOutputForGivenInput` calculates the result of a trade, given a certain * amount of digital assets in. + * * @param {Amount} amountIn - the amount of digital * assets to be sent in * @param {Brand} brandOut - The brand of asset desired - * @return {Amount} the amount that would be paid out at the current price. + * @returns {Amount} the amount that would be paid out at the current price. */ const getOutputForGivenInput = (amountIn, brandOut) => { const { brand: brandIn, value: inputValue } = amountIn; @@ -48,9 +49,10 @@ export const makeGetCurrentPrice = (isSecondary, isCentral, getPool) => { /** * `getInputForGivenOutput` calculates the amount of assets required to be * provided in order to obtain a specified gain. + * * @param {Amount} amountOut - the amount of digital assets desired * @param {Brand} brandIn - The brand of asset desired - * @return {Amount} The amount required to be paid in order to gain amountOut + * @returns {Amount} The amount required to be paid in order to gain amountOut */ const getInputForGivenOutput = (amountOut, brandIn) => { const { brand: brandOut, value: outputValue } = amountOut; diff --git a/packages/zoe/src/contracts/multipoolAutoswap/pool.js b/packages/zoe/src/contracts/multipoolAutoswap/pool.js index 38710412a32..8f2e7f000ff 100644 --- a/packages/zoe/src/contracts/multipoolAutoswap/pool.js +++ b/packages/zoe/src/contracts/multipoolAutoswap/pool.js @@ -193,6 +193,7 @@ export const makeAddPool = (zcf, isSecondary, initPool, centralBrand) => { /** * Allows users to add new liquidity pools. `secondaryIssuer` and * its keyword must not have been already used + * * @param {Issuer} secondaryIssuer * @param {Keyword} keyword - will be used in the * terms.issuers for the contract, but not used otherwise diff --git a/packages/zoe/src/contracts/otcDesk.js b/packages/zoe/src/contracts/otcDesk.js index d79d36a2f58..b33885ee12b 100644 --- a/packages/zoe/src/contracts/otcDesk.js +++ b/packages/zoe/src/contracts/otcDesk.js @@ -126,6 +126,7 @@ const start = zcf => { /** * The inventory can be added in bulk before any quotes are made * or can be added immediately before a quote. + * * @param {IssuerKeywordRecord=} issuerKeywordRecord * @returns {Promise} */ @@ -137,6 +138,7 @@ const start = zcf => { * The inventory can be removed at any time, since the inventory * used for active quotes is escrowed separately within the coveredCall * instance. + * * @returns {Promise} */ makeRemoveInventoryInvitation: () => { diff --git a/packages/zoe/src/internal-types.js b/packages/zoe/src/internal-types.js index 86333cc7129..f3102dba3ce 100644 --- a/packages/zoe/src/internal-types.js +++ b/packages/zoe/src/internal-types.js @@ -115,7 +115,7 @@ * @typedef {Object} ZoeInstanceAdmin * @property {(invitationHandle: InvitationHandle, * description: string, - * customProperties?: {}, + * customProperties: Record=, * ) => Payment} makeInvitation * @property {() => void} shutdown * @property {(issuerP: ERef, diff --git a/packages/zoe/src/objArrayConversion.js b/packages/zoe/src/objArrayConversion.js index cad2f73f1d2..8315d6121da 100644 --- a/packages/zoe/src/objArrayConversion.js +++ b/packages/zoe/src/objArrayConversion.js @@ -27,6 +27,7 @@ export const arrayToObj = (array, keys) => { /** * Assert all values from `part` appear in `whole`. + * * @param {string[]} whole * @param {string[]} part */ diff --git a/packages/zoe/src/types.js b/packages/zoe/src/types.js index 03b9b7a52b2..c128875f6b8 100644 --- a/packages/zoe/src/types.js +++ b/packages/zoe/src/types.js @@ -1,6 +1,7 @@ // eslint-disable-next-line spaced-comment /// +// eslint-disable-next-line jsdoc/valid-types /** * @template {string} H - the name of the handle * @typedef {H & {}} Handle A type constructor for an opaque type @@ -30,7 +31,7 @@ * @typedef {object} InstanceRecord * @property {Installation} installation * @property {Terms} terms - contract parameters - + * * @typedef {Object} IssuerRecord * @property {Brand} brand diff --git a/packages/zoe/src/zoeService/types.js b/packages/zoe/src/zoeService/types.js index 76cfb1d4192..b3f51a461df 100644 --- a/packages/zoe/src/zoeService/types.js +++ b/packages/zoe/src/zoeService/types.js @@ -175,7 +175,7 @@ */ /** - * @typedef {Object} SourceBundle Opaque type for a JSONable source bundle + * @typedef {Record} SourceBundle Opaque type for a JSONable source bundle */ /** diff --git a/packages/zoe/src/zoeService/zoe.js b/packages/zoe/src/zoeService/zoe.js index a9f6fe62f44..6d985a8aacf 100644 --- a/packages/zoe/src/zoeService/zoe.js +++ b/packages/zoe/src/zoeService/zoe.js @@ -163,7 +163,7 @@ function makeZoe(vatAdminSvc, zcfBundleName = undefined) { }; }; - /** @type MakeZoeMint */ + /** @type {MakeZoeMint} */ const makeZoeMint = (keyword, amountMathKind = MathKind.NAT) => { // Local indicates one that zoe itself makes from vetted code, // and so can be assumed correct and fresh by zoe. @@ -183,7 +183,7 @@ function makeZoe(vatAdminSvc, zcfBundleName = undefined) { const localPooledPurse = localIssuer.makeEmptyPurse(); brandToPurse.init(localBrand, localPooledPurse); - /** @type ZoeMint */ + /** @type {ZoeMint} */ const zoeMint = harden({ getIssuerRecord: () => { return localIssuerRecord; @@ -222,7 +222,7 @@ function makeZoe(vatAdminSvc, zcfBundleName = undefined) { seatHandle, ) => { return E( - /** @type Promise */ (addSeatObjPromiseKit.promise), + /** @type {Promise} */ (addSeatObjPromiseKit.promise), ).addSeat(invitationHandle, zoeSeatAdmin, seatData, seatHandle); }, hasZoeSeatAdmin: zoeSeatAdmin => zoeSeatAdmins.has(zoeSeatAdmin), diff --git a/packages/zoe/test/unitTests/contractSupport/test-depositTo.js b/packages/zoe/test/unitTests/contractSupport/test-depositTo.js index 2ecc45e73e1..91fc7a2de2a 100644 --- a/packages/zoe/test/unitTests/contractSupport/test-depositTo.js +++ b/packages/zoe/test/unitTests/contractSupport/test-depositTo.js @@ -43,7 +43,7 @@ async function setupContract(moolaIssuer, bucksIssuer) { await E(zoe).startInstance(installation, issuerKeywordRecord); - /** @type ContractFacet */ + /** @type {ContractFacet} */ const zcf = testJig.zcf; return { zoe, zcf }; } diff --git a/packages/zoe/test/unitTests/contracts/brokenAutoRefund.js b/packages/zoe/test/unitTests/contracts/brokenAutoRefund.js index 56c3720aa79..48cad735241 100644 --- a/packages/zoe/test/unitTests/contracts/brokenAutoRefund.js +++ b/packages/zoe/test/unitTests/contracts/brokenAutoRefund.js @@ -2,6 +2,7 @@ /** * This is a a broken contact to test zoe's error handling + * * @type {ContractStartFn} */ const start = zcf => { diff --git a/packages/zoe/test/unitTests/contracts/escrowToVote.js b/packages/zoe/test/unitTests/contracts/escrowToVote.js index 54e28da68e1..460aeb99326 100644 --- a/packages/zoe/test/unitTests/contracts/escrowToVote.js +++ b/packages/zoe/test/unitTests/contracts/escrowToVote.js @@ -53,6 +53,7 @@ const start = zcf => { const voter = harden({ /** * Vote on a particular issue + * * @param {string} response - 'YES' || 'NO' */ vote: response => { diff --git a/packages/zoe/test/unitTests/contracts/useObjExample.js b/packages/zoe/test/unitTests/contracts/useObjExample.js index 69d90ad9006..250957d0d6c 100644 --- a/packages/zoe/test/unitTests/contracts/useObjExample.js +++ b/packages/zoe/test/unitTests/contracts/useObjExample.js @@ -9,6 +9,7 @@ import { /** * Give a use object when a payment is escrowed + * * @type {ContractStartFn} */ const start = zcf => { @@ -25,6 +26,7 @@ const start = zcf => { const useObj = harden({ /** * (Pretend to) color some pixels. + * * @param {string} color * @param {Amount} amountToColor */ diff --git a/packages/zoe/test/unitTests/installFromSource.js b/packages/zoe/test/unitTests/installFromSource.js index 9b6376b68c6..ae4f9f4c397 100644 --- a/packages/zoe/test/unitTests/installFromSource.js +++ b/packages/zoe/test/unitTests/installFromSource.js @@ -1,4 +1,5 @@ import bundleSource from '@agoric/bundle-source'; + /** * @param {ZoeService} zoe * @param {string} path diff --git a/packages/zoe/test/unitTests/zcf/test-zcf.js b/packages/zoe/test/unitTests/zcf/test-zcf.js index c592f5ef997..31899268a62 100644 --- a/packages/zoe/test/unitTests/zcf/test-zcf.js +++ b/packages/zoe/test/unitTests/zcf/test-zcf.js @@ -16,7 +16,7 @@ import buildManualTimer from '../../../tools/manualTimer'; const contractRoot = `${__dirname}/zcfTesterContract`; const setupZCFTest = async (issuerKeywordRecord, terms) => { - /** @type ContractFacet */ + /** @type {ContractFacet} */ let zcf; const setZCF = jig => { zcf = jig.zcf; diff --git a/packages/zoe/test/unitTests/zcf/test-zcfSeat.js b/packages/zoe/test/unitTests/zcf/test-zcfSeat.js index d99ddaef68e..3411a82d090 100644 --- a/packages/zoe/test/unitTests/zcf/test-zcfSeat.js +++ b/packages/zoe/test/unitTests/zcf/test-zcfSeat.js @@ -11,6 +11,8 @@ import { makeZoe } from '../../../src/zoeService/zoe'; import { setup } from '../setupBasicMints'; import { makeFakeVatAdmin } from '../contracts/fakeVatAdmin'; +import '../../../exported'; + const contractRoot = `${__dirname}/zcfTesterContract`; test(`zoe - zcfSeat.kickOut() doesn't throw`, async t => { @@ -40,7 +42,7 @@ test(`zoe - zcfSeat.kickOut() doesn't throw`, async t => { // The contract uses the testJig so the contractFacet // is available here for testing purposes - /** @type ContractFacet */ + /** @type {ContractFacet} */ const zcf = testJig.zcf; let firstSeat; diff --git a/packages/zoe/test/unitTests/zcf/zcfTesterContract.js b/packages/zoe/test/unitTests/zcf/zcfTesterContract.js index bbaf54048a5..4f494ab839a 100644 --- a/packages/zoe/test/unitTests/zcf/zcfTesterContract.js +++ b/packages/zoe/test/unitTests/zcf/zcfTesterContract.js @@ -4,6 +4,7 @@ import '../../../exported'; /** * Tests ZCF + * * @type {ContractStartFn} */ const start = zcf => { diff --git a/yarn.lock b/yarn.lock index d1ab6c64127..ee8b6f532f3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1654,6 +1654,51 @@ dependencies: "@types/node" "*" +"@typescript-eslint/parser@^4.1.0": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.1.0.tgz#9b0409411725f14cd7faa81a664e5051225961db" + integrity sha512-hM/WNCQTzDHgS0Ke3cR9zPndL3OTKr9OoN9CL3UqulsAjYDrglSwIIgswSmHBcSbOzLmgaMARwrQEbIumIglvQ== + dependencies: + "@typescript-eslint/scope-manager" "4.1.0" + "@typescript-eslint/types" "4.1.0" + "@typescript-eslint/typescript-estree" "4.1.0" + debug "^4.1.1" + +"@typescript-eslint/scope-manager@4.1.0": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.1.0.tgz#9e389745ee9cfe12252ed1e9958808abd6b3a683" + integrity sha512-HD1/u8vFNnxwiHqlWKC/Pigdn0Mvxi84Y6GzbZ5f5sbLrFKu0al02573Er+D63Sw67IffVUXR0uR8rpdfdk+vA== + dependencies: + "@typescript-eslint/types" "4.1.0" + "@typescript-eslint/visitor-keys" "4.1.0" + +"@typescript-eslint/types@4.1.0": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.1.0.tgz#edbd3fec346f34e13ce7aa176b03b497a32c496a" + integrity sha512-rkBqWsO7m01XckP9R2YHVN8mySOKKY2cophGM8K5uDK89ArCgahItQYdbg/3n8xMxzu2elss+an1TphlUpDuJw== + +"@typescript-eslint/typescript-estree@4.1.0": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.1.0.tgz#394046ead25164494218c0e3d6b960695ea967f6" + integrity sha512-r6et57qqKAWU173nWyw31x7OfgmKfMEcjJl9vlJEzS+kf9uKNRr4AVTRXfTCwebr7bdiVEkfRY5xGnpPaNPe4Q== + dependencies: + "@typescript-eslint/types" "4.1.0" + "@typescript-eslint/visitor-keys" "4.1.0" + debug "^4.1.1" + globby "^11.0.1" + is-glob "^4.0.1" + lodash "^4.17.15" + semver "^7.3.2" + tsutils "^3.17.1" + +"@typescript-eslint/visitor-keys@4.1.0": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.1.0.tgz#b2d528c9484e7eda1aa4f86ccf0432fb16e4d545" + integrity sha512-+taO0IZGCtCEsuNTTF2Q/5o8+fHrlml8i9YsZt2AiDCdYEJzYlsmRY991l/6f3jNXFyAWepdQj7n8Na6URiDRQ== + dependencies: + "@typescript-eslint/types" "4.1.0" + eslint-visitor-keys "^2.0.0" + "@yarnpkg/lockfile@^1.1.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31" @@ -2816,6 +2861,11 @@ commander@^5.0.0: resolved "https://registry.yarnpkg.com/commander/-/commander-5.0.0.tgz#dbf1909b49e5044f8fdaf0adc809f0c0722bdfd0" integrity sha512-JrDGPAKjMGSP1G0DUoaceEJ3DZgAfr/q6X7FVk4+U5KxUSKviYGM2k6zWkfyyBHy5rAtzgYJFa1ro2O9PtoxwQ== +comment-parser@^0.7.6: + version "0.7.6" + resolved "https://registry.yarnpkg.com/comment-parser/-/comment-parser-0.7.6.tgz#0e743a53c8e646c899a1323db31f6cd337b10f12" + integrity sha512-GKNxVA7/iuTnAqGADlTWX4tkhzxZKXp5fLJqKTlQLHkE65XDUKutZ3BHaJC5IGcper2tT3QRD1xr4o3jNpgXXg== + common-path-prefix@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/common-path-prefix/-/common-path-prefix-3.0.0.tgz#7d007a7e07c58c4b4d5f433131a19141b29f11e0" @@ -4103,6 +4153,19 @@ eslint-plugin-import@^2.20.0: read-pkg-up "^2.0.0" resolve "^1.12.0" +eslint-plugin-jsdoc@^30.4.2: + version "30.4.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-30.4.2.tgz#d3113442a2b285e902903d91b987e2d6d4409006" + integrity sha512-Czm3gXyP1Ztibyh+J3t7osQ+AUrXhJp9CQfpo6cME8LwrlDpl2newDL18UO1Yk+TngcLKUyMt0byfpHjwhqNBg== + dependencies: + comment-parser "^0.7.6" + debug "^4.1.1" + jsdoctypeparser "^9.0.0" + lodash "^4.17.20" + regextras "^0.7.1" + semver "^7.3.2" + spdx-expression-parse "^3.0.1" + eslint-plugin-jsx-a11y@^6.2.3: version "6.2.3" resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.2.3.tgz#b872a09d5de51af70a97db1eea7dc933043708aa" @@ -4152,6 +4215,11 @@ eslint-visitor-keys@^1.1.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2" integrity sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A== +eslint-visitor-keys@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8" + integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ== + eslint@^6.1.0, eslint@^6.8.0: version "6.8.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.8.0.tgz#62262d6729739f9275723824302fb227c8c93ffb" @@ -5965,6 +6033,11 @@ jsbn@~0.1.0: resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= +jsdoctypeparser@^9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/jsdoctypeparser/-/jsdoctypeparser-9.0.0.tgz#8c97e2fb69315eb274b0f01377eaa5c940bd7b26" + integrity sha512-jrTA2jJIL6/DAEILBEh2/w9QxCuwmvNXIry39Ay/HVfhE3o2yVV0U44blYkqdHA/OKloJEqvJy0xU+GSdE2SIw== + jsesc@^2.5.1: version "2.5.2" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" @@ -8727,6 +8800,11 @@ regexpp@^2.0.1: resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw== +regextras@^0.7.1: + version "0.7.1" + resolved "https://registry.yarnpkg.com/regextras/-/regextras-0.7.1.tgz#be95719d5f43f9ef0b9fa07ad89b7c606995a3b2" + integrity sha512-9YXf6xtW+qzQ+hcMQXx95MOvfqXFgsKDZodX3qZB0x2n5Z94ioetIITsBtvJbiOyxa/6s9AtyweBLCdPmPko/w== + registry-auth-token@^4.0.0: version "4.2.0" resolved "https://registry.yarnpkg.com/registry-auth-token/-/registry-auth-token-4.2.0.tgz#1d37dffda72bbecd0f581e4715540213a65eb7da" @@ -9530,6 +9608,14 @@ spdx-expression-parse@^3.0.0: spdx-exceptions "^2.1.0" spdx-license-ids "^3.0.0" +spdx-expression-parse@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz#cf70f50482eefdc98e3ce0a6833e4a53ceeba679" + integrity sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q== + dependencies: + spdx-exceptions "^2.1.0" + spdx-license-ids "^3.0.0" + spdx-license-ids@^3.0.0: version "3.0.5" resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz#3694b5804567a458d3c8045842a6358632f62654" @@ -10241,11 +10327,23 @@ tsconfig-paths@^3.9.0: minimist "^1.2.0" strip-bom "^3.0.0" +tslib@^1.8.1: + version "1.13.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043" + integrity sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q== + tslib@^1.9.0: version "1.10.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== +tsutils@^3.17.1: + version "3.17.1" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759" + integrity sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g== + dependencies: + tslib "^1.8.1" + tunnel-agent@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd"