Skip to content

Commit

Permalink
Merge 16d9dbe into 13296ad
Browse files Browse the repository at this point in the history
  • Loading branch information
GinMu committed Nov 20, 2023
2 parents 13296ad + 16d9dbe commit db9d41d
Show file tree
Hide file tree
Showing 18 changed files with 1,440 additions and 1,271 deletions.
186 changes: 186 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
/*
👋 Hi! This file was autogenerated by tslint-to-eslint-config.
https://github.com/typescript-eslint/tslint-to-eslint-config
It represents the closest reasonable ESLint configuration to this
project's original TSLint configuration.
We recommend eventually switching this configuration to extend from
the recommended rulesets in typescript-eslint.
https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md
Happy linting! 💖
*/
module.exports = {
env: {
node: true
},
extends: ["plugin:@typescript-eslint/recommended", "plugin:@typescript-eslint/recommended-requiring-type-checking"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: "tsconfig.json",
sourceType: "module"
},
plugins: ["eslint-plugin-prefer-arrow", "@typescript-eslint"],
root: true,
rules: {
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/array-type": [
"error",
{
default: "generic"
}
],
"@typescript-eslint/ban-types": [
"error",
{
types: {
Object: {
message: "Avoid using the `Object` type. Did you mean `object`?"
},
Function: {
message: "Avoid using the `Function` type. Prefer a specific function type, like `() => void`."
},
Boolean: {
message: "Avoid using the `Boolean` type. Did you mean `boolean`?"
},
Number: {
message: "Avoid using the `Number` type. Did you mean `number`?"
},
String: {
message: "Avoid using the `String` type. Did you mean `string`?"
},
Symbol: {
message: "Avoid using the `Symbol` type. Did you mean `symbol`?"
}
}
}
],
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/dot-notation": "error",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/member-ordering": "error",
"@typescript-eslint/naming-convention": [
"error",
{
selector: "variable",
format: ["camelCase", "UPPER_CASE", "PascalCase"],
leadingUnderscore: "allow",
trailingUnderscore: "forbid"
}
],
"@typescript-eslint/no-empty-function": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-parameter-properties": "off",
"@typescript-eslint/no-shadow": [
"off",
{
hoist: "all"
}
],
"@typescript-eslint/no-unused-expressions": "error",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/prefer-for-of": "error",
"@typescript-eslint/prefer-function-type": "error",
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/semi": ["error", "always"],
"@typescript-eslint/triple-slash-reference": [
"off",
{
path: "always",
types: "prefer-import",
lib: "always"
}
],
"@typescript-eslint/typedef": "off",
"@typescript-eslint/unified-signatures": "error",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/require-await": "off",
"@typescript-eslint/await-thenable": "off",
"comma-dangle": [
"error",
{
objects: "never",
arrays: "never",
functions: "never"
}
],
complexity: "off",
"constructor-super": "error",
"dot-notation": "off",
eqeqeq: ["error", "smart"],
"guard-for-in": "error",
"id-denylist": [
"error",
"any",
"Number",
"number",
"String",
"string",
"Boolean",
"boolean",
"Undefined",
"undefined"
],
"id-match": "error",
"max-classes-per-file": ["error", 1],
"max-len": [
"error",
{
code: 320
}
],
"new-parens": "error",
"no-bitwise": "error",
"no-caller": "error",
"no-cond-assign": "error",
"no-console": "off",
"no-debugger": "error",
"no-empty": "error",
"no-empty-function": "off",
"no-eval": "error",
"no-fallthrough": "off",
"no-invalid-this": "off",
"no-new-wrappers": "error",
"no-shadow": "off",
"no-throw-literal": "error",
"no-trailing-spaces": "error",
"no-undef-init": "error",
"no-underscore-dangle": "off",
"no-unsafe-finally": "error",
"no-unused-expressions": "off",
"no-unused-labels": "error",
"no-use-before-define": "off",
"no-var": "error",
"object-shorthand": "error",
"one-var": ["error", "never"],
"prefer-const": "error",
radix: "error",
semi: "off",
"space-before-function-paren": [
"error",
{
anonymous: "always",
named: "never",
asyncArrow: "always"
}
],
"spaced-comment": [
"error",
"always",
{
markers: ["/"]
}
],
"use-isnan": "error",
"valid-typeof": "off"
}
};
2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
cache: "npm"
- run: npm install
- run: npm run test:node
- run: npm run tslint
- run: npm run eslint

- name: Coveralls GitHub Action
uses: coverallsapp/github-action@1.1.3
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run pretty && npm run tslint
npm run pretty && npm run eslint
4 changes: 2 additions & 2 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ module.exports = function(config) {
"test/*.spec.js": ["webpack"]
},
singleRun: true,
browserDisconnectTimeout: 10000,
browserDisconnectTimeout: 60000,
browserDisconnectTolerance: 3,
client: {
mocha: {
timeout: 6000 // 6 seconds - upped from 2 seconds
timeout: 30000 // 6 seconds - upped from 2 seconds
}
},
plugins: [
Expand Down
15 changes: 10 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"test": "npm run test:node && npm run test:browser",
"test:node": "npm run build && nyc --extension=.ts --reporter=lcov --reporter=html --reporter=text mocha --timeout=6000 test/*.spec.js",
"test:browser": "npm run build && karma start karma.conf.js",
"tslint": "tslint --project tsconfig.json --config tslint.json",
"eslint": "./node_modules/.bin/eslint src",
"compile": "/compile.sh",
"pretty": "pretty-quick --staged"
},
Expand Down Expand Up @@ -49,12 +49,18 @@
"@babel/core": "^7.23.2",
"@babel/preset-env": "^7.23.2",
"@babel/preset-typescript": "^7.22.15",
"@types/eslint": "^8",
"@typescript-eslint/eslint-plugin": "^6.11.0",
"@typescript-eslint/parser": "^6.11.0",
"babel-loader": "^8.3.0",
"browserify": "^16.5.0",
"chai": "^4.2.0",
"coveralls": "^3.0.9",
"coveralls": "^3.1.1",
"cross-env": "^7.0.0",
"duplicate-package-checker-webpack-plugin": "^3.0.0",
"eslint": "^8.54.0",
"eslint-plugin-jsdoc": "^46.9.0",
"eslint-plugin-prefer-arrow": "^1.2.3",
"husky": "^7.0.4",
"jsdom": "^22.1.0",
"karma": "^6.4.2",
Expand All @@ -65,13 +71,12 @@
"karma-firefox-launcher": "^2.1.2",
"karma-mocha": "^2.0.1",
"karma-webpack": "^5.0.0",
"mocha": "^7.1.0",
"mocha": "^10.2.0",
"nyc": "^15.0.0",
"prettier": "^1.19.1",
"pretty-quick": "^2.0.1",
"sinon": "^9.0.0",
"sinon": "^17.0.1",
"ts-loader": "^6.2.1",
"tslint": "^6.0.0",
"typescript": "^5.2.2",
"webpack": "^5.89.0",
"webpack-bundle-analyzer": "^4.10.1",
Expand Down
1 change: 1 addition & 0 deletions src/eth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { filterOx, isEmptyObject } from "jcc_common";
import createKeccakHash from "keccak";
import scrypt from "scryptsy";
import { ETH_PASSWORD_IS_WRONG, KEYSTORE_IS_INVALID } from "../constant";
import { IWalletModel } from "../types";

const isObject = (obj: any): boolean => {
return Object.prototype.toString.call(obj) === "[object Object]";
Expand Down
1 change: 1 addition & 0 deletions src/hd/ethereum.plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Wallet } from "@ethereumjs/wallet";
import * as ethUtil from "@ethereumjs/util";
import { keccak256 } from "ethereum-cryptography/keccak.js";
import { filterOx } from "jcc_common";
import { IKeyPair, IHDPlugin } from "../types";

export interface IEthereumPlugin extends IHDPlugin {
checkPrivateKey(privateKey: string): string;
Expand Down

0 comments on commit db9d41d

Please sign in to comment.