Closed danfinlay closed 4 years ago
i am working on transaction controller and all it's sub controllers transactions tx-state-manager tx-gas-utils pending-tx-tracker nonce-tracker
Here is a checklist with assignees, so that we can track who is working on docs for which file:
For now, I will take the following: app/scripts/notice-controller.js app/scripts/ui.js app/scripts/controllers/address-book.js app/scripts/controllers/currency.js app/scripts/controllers/preferences.js app/scripts/controllers/shapeshift.js app/scripts/lib/buy-eth-url.js app/scripts/lib/environment-type.js app/scripts/lib/get-first-preferred-lang-code.js app/scripts/lib/is-popup-or-notification.js app/scripts/lib/nodeify.js app/scripts/lib/util.js
Something to keep in mind, if we're interested, we can use the TypeScript type signatures in the docblocks we add (e.g. in @param
s) and run the TypeScript compiler against them file by file. For example, in #3984 I was working locally with this config:
{
"compileOnSave": true,
"compilerOptions": {
"allowJs": true,
"alwaysStrict": true,
"allowSyntheticDefaultImports": true,
"checkJs": true,
"jsx": "preserve",
"lib": [
"dom",
"dom.iterable",
"es7"
],
"moduleResolution": "node",
"noEmit": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strictNullChecks": true,
"target": "es6",
"typeRoots": [
"node_modules/@types/",
"types/"
]
},
"include": [
"app/scripts/lib/migrator/*",
"app/scripts/lib/createLoggerMiddleware.js",
"app/scripts/lib/createOriginMiddleware.js",
"app/scripts/lib/events-proxy.js",
"app/scripts/lib/hex-to-bn.js",
"app/scripts/lib/local-store.js",
"app/scripts/lib/random-id.js",
"app/scripts/lib/stream-utils.js",
"app/scripts/platforms/sw.js",
"app/scripts/platforms/window.js"
]
}
The process for running TypeScript against the docs we write would be:
tsconfig.json
(as shown above) to the project roottsc --project .
to check the filesI both think that this is just a useful approach locally when writing JSDocs to make sure that I've covered everything, as well as a desirable check to add to CI (though I won't necessarily push for that).
@bitpshr might have thoughts on this option and whether or not it's a good idea/useful. There are a lot of Salsa bugs but it does work for enough cases that I think it's worthwhile.
That's an interesting idea, @whymarrh, I'd be open to trying that out.
Files which no one is yet assigned to document:
I will start with the following:
app/scripts/config.js
app/scripts/contentscript.js
app/scripts/edge-encryptor.js
app/scripts/first-time-state.js
app/scripts/inpage.js
app/scripts/popup-core.js
I'll take these:
I will take these:
app/scripts/controllers/computed-balances.js
app/scripts/lib/createProviderMiddleware.js
app/scripts/lib/port-stream.js
app/scripts/lib/setupMetamaskMeshMetrics.js
Team is this still in play? Looks like a bunch of pieces have been merged, any outstanding?
I think everything in Dan's comment above https://github.com/MetaMask/metamask-extension/issues/3941#issuecomment-380497049 has been done
nice! are we exporting the summary documentation? if not, we should 😄
Multiple bugs were shipped last week, in part because interfaces to some files were not clear/understood.
Long term, this looks like a good case for strong types, but in the short term, strong documentation is something our codebase lacks, and could help alleviate this kind of issue.
JSDoc can generate nice readable documentation for a codebase, here is some docs added to our
KeyringController
(here calledmm-vault
): https://github.com/lazaridiscom/mm-vaultShould be added to all scripts in
app/scripts
, especiallyapp/scripts/controllers
andapp/scripts/lib
.