Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

BREAKING: TS Refactor #202

Merged
merged 111 commits into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from 88 commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
aa6526d
Refactor to TS
gantunesr Feb 22, 2023
192c48a
Move files and update structure
gantunesr Feb 23, 2023
ae34346
Update dependencies and configuration
gantunesr Feb 23, 2023
4d8cf0d
Update test and mock files
gantunesr Feb 23, 2023
b7cc77c
Solve yarn issues
gantunesr Feb 23, 2023
7eae2b3
Update configuration and dependencies
gantunesr Feb 23, 2023
d014dbc
Bump jest
gantunesr Feb 23, 2023
98769cd
Create types file
gantunesr Feb 23, 2023
a605feb
Solve lint issues
gantunesr Feb 23, 2023
f51af43
Remove private member
gantunesr Feb 23, 2023
d9e1de5
Solve lint issues
gantunesr Feb 24, 2023
601cb3c
Add typings
gantunesr Feb 28, 2023
fd02507
Update mock-encryptor
gantunesr Feb 28, 2023
46bc491
Update types
gantunesr Feb 28, 2023
d1401a2
Update .eslintrc.js
gantunesr Feb 28, 2023
3ce7a6e
Update test
gantunesr Feb 28, 2023
6933b78
Update KeyringController
gantunesr Feb 28, 2023
3b5ea22
Add build command (not working properly)
gantunesr Mar 1, 2023
fdff1ec
Move declarations to new file
gantunesr Mar 1, 2023
ab03e00
Update jest.config
gantunesr Mar 1, 2023
734c7fb
Update TS config
gantunesr Mar 1, 2023
b90bb01
Fix tests
gantunesr Mar 1, 2023
41f4045
Remove log
gantunesr Mar 1, 2023
c9d7857
Disable TS warning
gantunesr Mar 1, 2023
c95429a
Remove forgetKeyring
gantunesr Mar 1, 2023
c833be6
Change type any to Json
gantunesr Mar 1, 2023
e7b8a5f
Prettier
gantunesr Mar 1, 2023
473c047
Remove log
gantunesr Mar 1, 2023
258c349
Typecast serialize result to any
gantunesr Mar 1, 2023
6fa1e73
Remove Json
gantunesr Mar 1, 2023
a7905a7
Rename privateKeyArray to privateKeys
gantunesr Mar 1, 2023
37f0d37
Update mocks dir structure
gantunesr Mar 1, 2023
1ba064e
Install depcheck and rv @metamask/eslint-config-commonjs
gantunesr Mar 1, 2023
4d8bb84
Revert "Install depcheck and rv @metamask/eslint-config-commonjs"
gantunesr Mar 1, 2023
d43832b
Revert "Update mocks dir structure"
gantunesr Mar 1, 2023
9fe79f0
Update mocks dir structure
gantunesr Mar 1, 2023
921bcb4
Install depcheck and rv @metamask/eslint-config-commonjs
gantunesr Mar 1, 2023
9ccd731
Update dependencies
gantunesr Mar 2, 2023
0dbb136
Update dependencies
gantunesr Mar 2, 2023
84b4e2e
Improve types
gantunesr Mar 2, 2023
a319df4
Improve types
gantunesr Mar 2, 2023
9dd451b
Update errors
gantunesr Mar 2, 2023
85aa914
Add constants file
gantunesr Mar 2, 2023
c80f3d3
Update error messages
gantunesr Mar 6, 2023
8b930ff
Update State
gantunesr Mar 6, 2023
4ed4fe2
Update types, constants, and errors
gantunesr Mar 6, 2023
2973637
Fix tests and lint
gantunesr Mar 6, 2023
e4898e4
Update dependencies
gantunesr Mar 7, 2023
5832e7d
Update types
gantunesr Mar 7, 2023
7d6a833
Rebase
gantunesr Mar 7, 2023
979774b
Lint
gantunesr Mar 7, 2023
2ec20ff
Update data type
gantunesr Mar 8, 2023
c85a7bd
Update syntax to arrow function
gantunesr Mar 8, 2023
0638515
Add KeyringControllerArgs
gantunesr Mar 9, 2023
526182c
Add default to opts arg in addNewKeyring
gantunesr Mar 9, 2023
acd549e
Remove string casting
gantunesr Mar 9, 2023
1d38cfc
Declare backfilled types
gantunesr Mar 9, 2023
8aa5ba0
Rename arg from _address to rawAddress
gantunesr Mar 9, 2023
c59a832
Remove noImplicitAny
gantunesr Mar 9, 2023
f609772
Remove unneed optionals
gantunesr Mar 9, 2023
17b6354
Update data type for arg in newKeyring method
gantunesr Mar 9, 2023
70d5d8c
Fix style
gantunesr Mar 9, 2023
d892064
Improve KeyringControllerArgs
gantunesr Mar 9, 2023
13240e6
Update logic in addNewKeyring for switch-case statement
gantunesr Mar 9, 2023
1b460f3
Update import
gantunesr Mar 9, 2023
05c1920
Update logic for newKeyring to throw an error instead of returning un…
gantunesr Mar 9, 2023
8915012
Update types in tests
gantunesr Mar 9, 2023
3550b93
Update KeyringControllerArgs in types file
gantunesr Mar 9, 2023
b257e31
Update mocks
gantunesr Mar 9, 2023
a96cbca
Add backfill for normalize method and remove type casting
gantunesr Mar 9, 2023
9b48af0
Fix data type
gantunesr Mar 9, 2023
ce7d126
Add SerializedKeyring
gantunesr Mar 9, 2023
b620d2a
Lint
gantunesr Mar 9, 2023
ded3cef
Move mocks to test dir
gantunesr Mar 9, 2023
352b11c
Update build config
gantunesr Mar 9, 2023
476124b
Improve keyring mock
gantunesr Mar 9, 2023
7f29186
Improve error messages
gantunesr Mar 12, 2023
c1843f5
Update tests
gantunesr Mar 12, 2023
5f4d845
Export KeyringControllerError enum
gantunesr Mar 12, 2023
2272c18
Update exports
gantunesr Mar 12, 2023
d0f6e63
Improve stripHexPrefix
gantunesr Mar 12, 2023
1b8c42b
Sort methods
gantunesr Mar 14, 2023
f054c3b
Replace State with Json
gantunesr Mar 14, 2023
5a1df64
Improve types
gantunesr Mar 14, 2023
b76b3db
Update dependencies
gantunesr Mar 17, 2023
850cb00
Bump @typescript-eslint/parser from 5.53.0 to 5.55.0 for TypeScript 5
leotm Mar 17, 2023
b4a3005
Upgrade TypeScript from 4.9.3-5 to 5.0.2 stable
leotm Mar 17, 2023
cfe3e44
Bump remaining harmless ESLint deps
leotm Mar 17, 2023
b618965
Add prettierignore and revert .yarnrc.yml file
gantunesr Mar 21, 2023
a12ce45
Update sinon import
gantunesr Mar 21, 2023
91fd437
Remove type cast in submitPassword test
gantunesr Mar 21, 2023
5b17f35
Remove type cast in persistAllKeyrings test
gantunesr Mar 21, 2023
5dc6cb0
Add @ts-expect-error to remove type casts
gantunesr Mar 21, 2023
9c59391
Set password to only string
gantunesr Mar 21, 2023
6eff4a1
Remove type from forEach
gantunesr Mar 21, 2023
e36c134
Update hex methods
gantunesr Mar 21, 2023
4fba438
Remove KeyringType as data type in methods
gantunesr Mar 22, 2023
7044d64
Move displayForKeyring outside class
gantunesr Mar 22, 2023
7c871f4
Merge branch 'refactor-typescript' of https://github.com/MetaMask/Key…
gantunesr Mar 22, 2023
f722305
Clean up code
gantunesr Mar 22, 2023
3edc176
Update @metamask/eth-sig-util type file
gantunesr Mar 23, 2023
10bb8c8
Validate that data is Json in newKeyring method
gantunesr Mar 23, 2023
a344342
Console.error in restoreKeyring
gantunesr Mar 23, 2023
1c76cf0
Remove unnecessary comment
gantunesr Mar 23, 2023
c87885c
Refactor removeAccount method
gantunesr Mar 23, 2023
ee755fd
Change data type from Hex to string
gantunesr Mar 23, 2023
c7afbff
Change data type from Hex to string
gantunesr Mar 23, 2023
ee12163
Update test name
gantunesr Mar 23, 2023
1ae48d3
Sort methods
gantunesr Mar 23, 2023
ea8dda7
Sort methods
gantunesr Mar 24, 2023
977facf
Improve data types in test suite
gantunesr Mar 27, 2023
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
10 changes: 10 additions & 0 deletions .depcheckrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"ignores": [
"@lavamoat/allow-scripts",
"@metamask/auto-changelog",
"@types/*",
"prettier-plugin-packagejson",
"ts-node",
"typedoc"
]
}
27 changes: 25 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,36 @@
module.exports = {
root: true,
extends: ['@metamask/eslint-config', '@metamask/eslint-config-commonjs'],

extends: ['@metamask/eslint-config'],

overrides: [
{
files: ['test/**/*.js'],
files: ['*.ts'],
extends: ['@metamask/eslint-config-typescript'],
},

{
files: ['*.js'],
parserOptions: {
sourceType: 'script',
},
extends: ['@metamask/eslint-config-nodejs'],
},

{
files: ['*.test.ts', '*.test.js'],
extends: [
'@metamask/eslint-config-jest',
'@metamask/eslint-config-nodejs',
],
},
],

ignorePatterns: [
'!.eslintrc.js',
'!.prettierrc.js',
'dist/',
'docs/',
'.yarn/',
],
};
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ coverage
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# distribution
dist
2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-allow-scripts.cjs
spec: "https://raw.githubusercontent.com/LavaMoat/LavaMoat/main/packages/yarn-plugin-allow-scripts/bundles/@yarnpkg/plugin-allow-scripts.js"
spec: 'https://raw.githubusercontent.com/LavaMoat/LavaMoat/main/packages/yarn-plugin-allow-scripts/bundles/@yarnpkg/plugin-allow-scripts.js'
gantunesr marked this conversation as resolved.
Show resolved Hide resolved

yarnPath: .yarn/releases/yarn-3.2.4.cjs
5 changes: 3 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
collectCoverage: true,
// Ensures that we collect coverage from all source files, not just tested
// ones.
collectCoverageFrom: ['./index.js'],
collectCoverageFrom: ['./src/*.ts'],
coverageReporters: ['text', 'html'],
coverageThreshold: {
global: {
Expand All @@ -13,6 +13,7 @@ module.exports = {
},
},
moduleFileExtensions: ['js', 'json', 'jsx', 'ts', 'tsx', 'node'],
preset: 'ts-jest',
// "resetMocks" resets all mocks, including mocked modules, to jest.fn(),
// between each test case.
resetMocks: true,
Expand All @@ -21,6 +22,6 @@ module.exports = {
// modules.
restoreMocks: true,
testEnvironment: 'node',
testMatch: ['**/test/index.js'],
testRegex: ['\\.test\\.(ts|js)$'],
testTimeout: 2500,
};
37 changes: 26 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,43 +18,58 @@
},
"license": "ISC",
"author": "Dan Finlay <[email protected]>",
"main": "index.js",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"index.js"
"dist/"
],
"scripts": {
"build": "tsc --project tsconfig.build.json",
"build:docs": "typedoc",
"lint": "yarn lint:eslint && yarn lint:misc --check",
"lint:dependencies": "depcheck",
"lint:eslint": "eslint . --cache --ext js,ts",
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write",
"lint:misc": "prettier '**/*.json' '**/*.md' '!CHANGELOG.md' '**/*.yml' '!.yarnrc.yml' --ignore-path .gitignore --no-error-on-unmatched-pattern",
"test": "jest"
},
"dependencies": {
"@metamask/browser-passworder": "^4.0.2",
"@ethereumjs/tx": "^4.1.1",
"@metamask/browser-passworder": "^4.1.0",
"@metamask/eth-hd-keyring": "^6.0.0",
"@metamask/eth-sig-util": "5.0.2",
"@metamask/eth-simple-keyring": "^5.0.0",
"@metamask/utils": "^5.0.0",
"obs-store": "^4.0.3"
},
"devDependencies": {
"@lavamoat/allow-scripts": "^2.1.0",
"@metamask/auto-changelog": "^3.0.0",
"@metamask/eslint-config": "^11.1.0",
"@metamask/eslint-config-commonjs": "^11.1.0",
"@metamask/eslint-config-jest": "^11.1.0",
"@metamask/eslint-config-nodejs": "^11.1.0",
"eslint": "^8.29.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^27.1.6",
"eslint-plugin-jsdoc": "^39.6.4",
"@metamask/eslint-config-typescript": "^11.1.0",
"@types/jest": "^29.4.0",
"@types/sinon": "^10.0.13",
"@typescript-eslint/eslint-plugin": "^5.55.0",
"@typescript-eslint/parser": "^5.55.0",
"depcheck": "^1.4.3",
"eslint": "^8.36.0",
"eslint-config-prettier": "^8.7.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^27.2.1",
"eslint-plugin-jsdoc": "^40.0.3",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.2.1",
"ethereumjs-wallet": "^1.0.1",
"jest": "^27.0.6",
"jest": "^29.0.0",
"prettier": "^2.8.1",
"prettier-plugin-packagejson": "^2.3.0",
"sinon": "^11.1.1"
"sinon": "^15.0.1",
"ts-jest": "^29.0.3",
"ts-node": "^10.7.0",
"typedoc": "^0.23.15",
"typescript": "~5.0.2"
},
"packageManager": "[email protected]",
"engines": {
Expand Down
Loading