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

feat(contract): linting and typedefs #26

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ dist-ssr
*.njsproj
*.sln
*.sw?

_agstate/yarn-links
45 changes: 21 additions & 24 deletions contract/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,32 @@
"docker:make": "docker compose exec agd make -C /workspace/contract",
"make:help": "make list",
"start": "yarn docker:make clean start-contract print-key",
"build": "exit 0",
"build": "node_modules/agoric/bin/agoric run scripts/build-game1-start.js",
Copy link
Member

Choose a reason for hiding this comment

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

is node_modules/agoric/bin/agoric necessary? Doesn't yarn arrange for agoric to work?

Copy link
Member

Choose a reason for hiding this comment

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

The scope of this PR seems to be expanding :)

Do you plan to keep the commits separate or squash?

"test": "ava --verbose",
"lint": "eslint '**/*.{js,ts}'",
"lint-fix": "eslint --fix '**/*.{js,ts}'",
"lint-fix-jessie": "eslint -c '.eslintrc-jessie.js' --fix '**/*.js'",
"lint-jessie": "eslint -c '.eslintrc-jessie.js' '**/*.js'",
"typecheck": "tsc"
"lint": "yarn lint:eslint # && yarn lint:types",
"lint:eslint": "eslint '**/*.{js,ts}'",
"lint:fix": "eslint --fix '**/*.{js,ts}'",
"lint:types": "tsc"
},
"dependencies": {
Copy link
Member

Choose a reason for hiding this comment

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

moving the "dependencies" section makes this diff hard to read.

"@agoric/ertp": "0.16.3-u13.0",
"@agoric/zoe": "0.26.3-u13.0",
Comment on lines +22 to +23
Copy link
Member

Choose a reason for hiding this comment

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

Have you checked that the resulting bundle is a reasonable size? that we have just 1 version of each endo package?

"@endo/far": "0.2.18",
"@endo/marshal": "0.8.5",
"@endo/patterns": "0.2.2"
},
"devDependencies": {
"@agoric/deploy-script-support": "^0.10.4-u12.0",
"@agoric/deploy-script-support": "^0.10.4-u13.0",
"@agoric/eslint-config": "dev",
"@endo/bundle-source": "^2.8.0",
"@endo/bundle-source": "2.5.2-upstream-rollup",
"@endo/eslint-plugin": "^0.5.2",
"@endo/init": "^0.5.60",
"@endo/promise-kit": "^1.0.1",
"@endo/promise-kit": "0.2.56",
"@endo/ses-ava": "^0.2.44",
"@jessie.js/eslint-plugin": "^0.4.0",
"@typescript-eslint/eslint-plugin": "^6.7.0",
"@typescript-eslint/parser": "^6.7.0",
"agoric": "^0.21.2-u12.0",
"agoric": "^0.22.0-u13.0",
"ava": "^5.3.0",
"eslint": "^8.47.0",
"eslint-config-airbnb-base": "^15.0.0",
Expand All @@ -44,20 +50,8 @@
"import-meta-resolve": "^2.2.1",
"prettier": "^3.0.3",
"prettier-plugin-jsdoc": "^1.0.0",
"type-coverage": "^2.26.3",
"typescript": "~5.2.2"
},
"resolutions": {
"@babel/code-frame": "7.18.6",
"@babel/highlight": "7.22.5"
},
"dependencies": {
"@agoric/ertp": "^0.16.3-u12.0",
"@agoric/zoe": "^0.26.3-u12.0",
"@endo/far": "^0.2.22",
"@endo/marshal": "^0.8.9",
"@endo/patterns": "^0.2.5"
},
"ava": {
"files": [
"test/**/test-*.js"
Expand Down Expand Up @@ -112,11 +106,14 @@
"varsIgnorePattern": "^_"
}
]
}
},
"ignorePatterns": [
"bundles"
]
},
"prettier": {
"trailingComma": "all",
"arrowParens": "avoid",
"singleQuote": true
}
}
}
2 changes: 1 addition & 1 deletion contract/src/gameAssetContract.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const bagValueSize = amt => {
return total;
};

/** @typedef {StandardTerms & { joinPrice: Amount<'nat'> }} GamePlacesTerms */
/** @typedef {{joinPrice: Amount<'nat'>}} GamePlacesTerms */
/**
* @param {ZCF<GamePlacesTerms>} zcf
*/
Expand Down
5 changes: 3 additions & 2 deletions contract/src/start-game1-proposal.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @ts-check
import { E } from '@endo/eventual-send';
import { E } from '@endo/far';
import { makeMarshal } from '@endo/marshal';
import { AmountMath } from '@agoric/ertp/src/amountMath.js';
import '@agoric/zoe/exported.js';
Copy link
Member

Choose a reason for hiding this comment

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

These bloat bundles. Ugh. Please add an XXX comment referring to...

important

Expand Down Expand Up @@ -122,7 +122,8 @@ harden(gameManifest);

/**
* @param {{restoreRef: (ref: unknown) => Promise<unknown> }} r
* @param {{ game1Ref: unknown }} g */
* @param {{ game1Ref: unknown }} g
*/
export const getManifestForGame1 = ({ restoreRef }, { game1Ref }) => {
return harden({
manifest: gameManifest,
Expand Down
2 changes: 1 addition & 1 deletion contract/test/mintStable.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

// @ts-check
import { E } from '@endo/eventual-send';
import { E } from '@endo/far';
import { createRequire } from 'module';

const myRequire = createRequire(import.meta.url);
Expand Down
3 changes: 1 addition & 2 deletions contract/test/test-bundle-source.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import { test } from './prepare-test-env-ava.js';

import { createRequire } from 'module';
import bundleSource from '@endo/bundle-source';
import { E } from '@endo/eventual-send';
import { passStyleOf } from '@endo/far';
import { E, passStyleOf } from '@endo/far';
import { makeZoeKitForTest } from '@agoric/zoe/tools/setup-zoe.js';

const myRequire = createRequire(import.meta.url);
Expand Down
3 changes: 1 addition & 2 deletions contract/test/test-contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
import { test as anyTest } from './prepare-test-env-ava.js';

import { createRequire } from 'module';
import { E } from '@endo/eventual-send';
import { Far } from '@endo/far';
import { E, Far } from '@endo/far';
import { makePromiseKit } from '@endo/promise-kit';
0xpatrickdev marked this conversation as resolved.
Show resolved Hide resolved
import { makeCopyBag } from '@endo/patterns';
import { makeNodeBundleCache } from '@endo/bundle-source/cache.js';
Expand Down
3 changes: 2 additions & 1 deletion contract/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
"maxNodeModuleJsDepth": 2,
"strict": true
},
"include": ["**/*.js", "**/*.ts"]
"include": ["**/*.js", "**/*.ts"],
"exclude": ["bundles"]
}
4 changes: 0 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
"contract",
"ui"
],
"resolutions": {
"@babel/code-frame": "7.18.6",
"@babel/highlight": "7.22.5"
},
"scripts": {
"start:docker": "cd contract && docker compose up -d",
"docker:logs": "cd contract; docker compose logs --tail 200 -f",
Expand Down
4 changes: 3 additions & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
},
"resolutions": {
"**/ses": "^0.18.8",
"**/@agoric/xsnap": "0.14.3-dev-9f085d3.0"
"**/@agoric/xsnap": "0.14.3-dev-9f085d3.0",
"@babel/code-frame": "7.18.6",
"@babel/highlight": "7.22.5"
}
}
Loading