Skip to content

Commit c64b097

Browse files
committed
remove unused scripts
removed unused plugins and added useful scripts performed lint & formatting
1 parent d155a0b commit c64b097

File tree

4 files changed

+740
-37
lines changed

4 files changed

+740
-37
lines changed

package.json

+21-8
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,10 @@
1313
"node": ">=8.0.0"
1414
},
1515
"scripts": {
16-
"dev": "webpack --mode development",
17-
"build": "npm run build:node && npm run build:webpack",
18-
"build:node": "babel src --out-dir lib",
19-
"build:webpack": "webpack --mode production",
20-
"lint": "eslint --cache --fix .",
21-
"format": "prettier --config ./.prettierrc --write ./src/{*.js,**/*.js}"
16+
"build": "./node_module/.bin/babel src --out-dir lib",
17+
"lint": "./node_module/.bin/eslint .",
18+
"lint:fix": "./node_module/.bin/eslint --fix .",
19+
"format": "./node_module/.bin/prettier --ignore-path .gitignore --write ./{*.json,**/*.json}"
2220
},
2321
"repository": {
2422
"type": "git",
@@ -50,6 +48,8 @@
5048
"dependencies": {
5149
"bip39": "^3.0.2",
5250
"ethereumjs-wallet": "^0.6.3",
51+
"husky": "^3.1.0",
52+
"lint-staged": "^9.5.0",
5353
"sweetalert2": "^8.15.2",
5454
"web3-provider-engine": "^15.0.3"
5555
},
@@ -65,14 +65,27 @@
6565
"babel-loader": "^8.0.6",
6666
"eslint": "^6.3.0",
6767
"eslint-config-prettier": "^6.2.0",
68-
"eslint-config-standard": "^14.1.0",
6968
"eslint-plugin-import": "^2.18.2",
7069
"eslint-plugin-node": "^10.0.0",
7170
"eslint-plugin-prettier": "^3.1.0",
7271
"eslint-plugin-promise": "^4.2.1",
73-
"eslint-plugin-standard": "^4.0.1",
7472
"prettier": "^1.18.2",
7573
"webpack": "^4.39.1",
7674
"webpack-cli": "^3.3.6"
75+
},
76+
"husky": {
77+
"hooks": {
78+
"pre-commit": "lint-staged"
79+
}
80+
},
81+
"lint-staged": {
82+
"*.js": [
83+
"./node_modules/.bin/eslint --ignore-pattern '!.eslintrc.js --fix",
84+
"git add"
85+
],
86+
"*.{json,css,md}": [
87+
"./node_modules/.bin/prettier --write",
88+
"git add"
89+
]
7790
}
7891
}

src/index.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import FixtureSubprovider from 'web3-provider-engine/subproviders/fixture.js';
77
import RpcSubprovider from 'web3-provider-engine/subproviders/rpc.js';
88
import HookedWalletSubprovider from 'web3-provider-engine/subproviders/hooked-wallet-ethtx.js';
99
import networkConfig from './networkConfig';
10-
import {encryptMnemonic, encryptSecret, decryptMnemonic, decryptSecret} from './utils/encryption';
10+
import { encryptMnemonic, encryptSecret, decryptMnemonic, decryptSecret } from './utils/encryption';
1111

1212
const STORAGE_SESSION_KEY = 'wallet-session';
1313
const MNEMONIC_PATH = "m/44'/60'/0'/0/0";
@@ -23,7 +23,7 @@ function getEncryptedMnemonic() {
2323
return Error('User not logged in');
2424
}
2525

26-
const {encryptedMnemonic} = JSON.parse(data);
26+
const { encryptedMnemonic } = JSON.parse(data);
2727
return encryptedMnemonic;
2828
}
2929

@@ -33,7 +33,7 @@ function getEncryptedMnemonic() {
3333
* @returns {Promise<String>} password
3434
*/
3535
async function promptPassword() {
36-
const {value: password} = await Swal.fire({
36+
const { value: password } = await Swal.fire({
3737
title: 'Enter your password',
3838
input: 'password',
3939
inputPlaceholder: 'Enter your password',
@@ -160,7 +160,7 @@ export default class SpringWallet {
160160
.deriveChild(0)
161161
.getWallet();
162162
const address = wallet.getChecksumAddressString();
163-
return {address, encryptedMnemonic};
163+
return { address, encryptedMnemonic };
164164
}
165165

166166
/**
@@ -181,7 +181,7 @@ export default class SpringWallet {
181181
* @param {String} encryptedMnemonic
182182
*/
183183
static setWalletSession(address, encryptedMnemonic) {
184-
localStorage.setItem(STORAGE_SESSION_KEY, JSON.stringify({address, encryptedMnemonic}));
184+
localStorage.setItem(STORAGE_SESSION_KEY, JSON.stringify({ address, encryptedMnemonic }));
185185
}
186186

187187
/**
@@ -240,4 +240,4 @@ export default class SpringWallet {
240240
}
241241
}
242242

243-
export {decryptMnemonic};
243+
export { decryptMnemonic };

webpack.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const webConfig = {
1414
umdNamedDefine: true
1515
},
1616
module: {
17-
rules: [{test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader'}]
17+
rules: [{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' }]
1818
},
1919
resolve: {
2020
alias: {

0 commit comments

Comments
 (0)