chore: fix linting errors

This commit is contained in:
kyranjamie
2021-06-23 14:16:56 +02:00
committed by Reed Rosenbluth
parent 49783f9713
commit a408ef78d0
13 changed files with 2547 additions and 59 deletions

View File

@@ -1,4 +1,3 @@
// @ts-ignore
import { Buffer } from '@stacks/common';
import {
AddressHashMode,

View File

@@ -62,7 +62,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/blockstack/blockstack.js.gi.git"
"url": "git+https://github.com/blockstack/blockstack.js.git"
},
"scripts": {
"start": "tsc -b tsconfig.build.json --watch --verbose",

View File

@@ -3,8 +3,5 @@
"compilerOptions": {
"target": "ES2020"
},
"include": [
"src/**/*",
"tests/**/*"
]
"include": ["src/**/*", "tests/**/*"]
}

2463
packages/wallet-sdk/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,22 +1,25 @@
{
"name": "@stacks/wallet-sdk",
"version": "1.0.0-beta.21",
"description": "A library for building Stacks blockchain wallets",
"description": "A library for generating Stacks blockchain wallets",
"main": "./dist/index.js",
"umd:main": "./dist/wallet-sdk.umd.production.js",
"module": "./dist/wallet-sdk.esm.js",
"author": "Hank Stoever",
"types": "./dist/wallet-sdk/src/index.d.ts",
"scripts": {
"clean": "shx rm -rf ./lib*/",
"start": "tsc -b tsconfig.build.json --watch --verbose",
"build": "npm run clean && npm run build:cjs && npm run build:esm",
"build:cjs": "tsc -b tsconfig.build.json",
"build:esm": "tsc -p tsconfig.build.json --module ES6 --outDir ./dist/esm",
"build:umd": "webpack --config webpack.config.js",
"clean": "rimraf dist && tsc -b tsconfig.build.json --clean",
"typecheck": "tsc --noEmit",
"typecheck:watch": "npm run typecheck -- --watch",
"test": "jest --coverage",
"dev": "cross-env NODE_ENV=development tsdx watch",
"build": "cross-env NODE_ENV=production tsdx build --format=cjs,esm,umd",
"build-all": "run-p build:*",
"build:cjs": "tsc --outDir ./lib -m commonjs -t es2017",
"build:esm": "tsc --outDir ./lib-esm -m es6 -t es2017",
"build:cjs:watch": "tsc --outDir ./lib -m commonjs -t es2017 --watch",
"build:esm:watch": "tsc --outDir ./lib-esm -m es6 -t es2017 --watch",
"test": "jest",
"test:watch": "jest --watch --coverage=false",
"lint": "yarn lint:eslint && yarn lint:prettier",
"lint:eslint": "eslint \"src/**/*.{ts,tsx}\"",
@@ -24,8 +27,7 @@
"lint:prettier": "prettier --check \"src/**/*.{ts,tsx}\" *.js",
"lint:prettier:fix": "prettier --write \"src/**/*.{ts,tsx}\" *.js",
"depcheck": "depcheck --ignores='@types/*,eslint*,safe-buffer,codecov,@typescript-eslint/*,@blockstack/*'",
"typecheck": "tsc --noEmit",
"prepublishOnly": "yarn build"
"prepublishOnly": "npm run test && npm run build && npm run build:umd"
},
"unpkg": "./dist/wallet-sdk.cjs.production.min.js",
"license": "MIT",
@@ -37,6 +39,8 @@
"yalc": "1.0.0-pre.49"
},
"dependencies": {
"@stacks/auth": "^1.2.3",
"@stacks/common": "^1.2.2",
"@stacks/encryption": "^1.0.1",
"@stacks/profile": "^1.1.1-alpha.0",
"@stacks/storage": "^1.1.1-alpha.0",
@@ -47,6 +51,7 @@
"bn.js": "^5.1.1",
"c32check": "^1.0.1",
"jsontokens": "^3.0.0",
"randombytes": "^2.1.0",
"triplesec": "^3.0.27",
"zone-file": "^1.0.0"
},

View File

@@ -1,7 +1,9 @@
import { BIP32Interface } from 'bip32';
import { createSha2Hash, ecPairToHexString } from '@stacks/encryption';
import { assertIsTruthy } from './utils';
import { Buffer } from 'buffer';
import { ECPair } from 'bitcoinjs-lib';
import { createSha2Hash, ecPairToHexString } from '@stacks/encryption';
import { assertIsTruthy } from './utils';
import { Account } from './models/account';
import { WalletKeys } from './models/wallet';

View File

@@ -8,6 +8,7 @@ import { decrypt as triplesecDecrypt } from 'triplesec';
* @param password - Password for data
* @return the raw mnemonic phrase
*/
// eslint-disable-next-line node/prefer-global/buffer
export function decrypt(dataBuffer: Buffer | string, password: string): Promise<string> {
return decryptMnemonic(dataBuffer, password, triplesecDecrypt);
}
@@ -18,6 +19,7 @@ export function decrypt(dataBuffer: Buffer | string, password: string): Promise<
* @param password - Password to encrypt mnemonic with
* @return The encrypted phrase
* */
// eslint-disable-next-line node/prefer-global/buffer
export function encrypt(phrase: string, password: string): Promise<Buffer> {
return encryptMnemonic(phrase, password);
}

View File

@@ -17,6 +17,7 @@ import {
} from './profile';
import { ECPair } from 'bitcoinjs-lib';
import { connectToGaiaHubWithConfig, getHubInfo, makeGaiaAssociationToken } from '../utils';
import { Buffer } from 'buffer';
export interface Account {
/** The private key used for STX payments */

View File

@@ -0,0 +1,16 @@
{
"extends": "../../tsconfig.build.json",
"compilerOptions": {
"noEmit": false,
"outDir": "./dist",
"rootDir": "./src",
"tsBuildInfoFile": "./tsconfig.build.tsbuildinfo",
"composite": true
},
"references": [
{
"path": "../common/tsconfig.build.json"
}
],
"include": ["src/**/*"]
}

View File

@@ -1,26 +1,4 @@
{
"compilerOptions": {
"target": "es6",
"module": "es2015",
"moduleResolution": "node",
"declaration": true,
"outDir": "./lib",
"strict": true,
"skipLibCheck": true,
"baseUrl": "./src",
"allowSyntheticDefaultImports": true,
"lib": ["es2017", "dom"],
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noImplicitAny": true,
"noImplicitThis": true,
"alwaysStrict": true,
"sourceMap": true,
"paths": {
"@stacks/encryption": ["../../encryption/src"],
"@stacks/transactions": ["../../transactions/src"]
}
},
"include": ["./src/**/*"]
"extends": "../../tsconfig.json",
"include": ["src/**/*"]
}

View File

@@ -1,16 +0,0 @@
{
"compilerOptions": {
"target": "es6",
"module": "es2015",
"moduleResolution": "node",
"declaration": true,
"outDir": "./lib",
"strict": true,
"skipLibCheck": true,
"baseUrl": "./src",
"allowSyntheticDefaultImports": true,
"lib": ["es2017", "dom"],
"sourceMap": true
},
"include": ["./src/**/*"]
}

View File

@@ -0,0 +1,41 @@
const path = require('path');
const webpack = require('webpack');
module.exports = {
mode: 'production',
entry: './src/index.ts',
output: {
library: 'StacksWalletSdk',
libraryTarget: 'umd',
filename: 'index.umd.js',
path: path.resolve(__dirname, 'dist'),
},
resolve: {
extensions: ['.ts', '.js'],
fallback: {
crypto: false,
events: false,
stream: false,
},
},
plugins: [
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
}),
],
module: {
rules: [
{
test: /\.tsx?$/,
use: [
{
loader: 'ts-loader',
options: {
transpileOnly: true,
configFile: 'tsconfig.build.json',
},
},
],
},
],
},
};

View File

@@ -3,7 +3,6 @@
"compilerOptions": {
"baseUrl": ".",
"paths": {
// "@stacks/*": ["./packages/*/src"],
"@stacks/auth": ["packages/auth/src"],
"@stacks/bns": ["packages/bns/src"],
"@stacks/cli": ["packages/cli/src"],
@@ -14,7 +13,8 @@
"@stacks/profile": ["packages/profile/src"],
"@stacks/stacking": ["packages/stacking/src"],
"@stacks/storage": ["packages/storage/src"],
"@stacks/transactions": ["packages/transactions/src"]
"@stacks/transactions": ["packages/transactions/src"],
"@stacks/wallet-sdk": ["packages/wallet-sdk/src"]
}
}
}