OPS: update eslint packages and config

This commit is contained in:
Ivan Vershigora 2022-10-31 12:25:26 +00:00
parent 3e6d8db542
commit ecb12d9832
No known key found for this signature in database
GPG Key ID: DCCF7FB5ED2CEBD7
29 changed files with 1595 additions and 3231 deletions

View File

@ -68,5 +68,10 @@
"env": {
"es6": true
},
"globals": { "fetch": false }
"globals": { "fetch": false },
"settings": {
"react": { // this is for eslint-plugin-react
"version": "detect" // React version. "detect" automatically picks the version you have installed.
}
}
}

View File

@ -53,7 +53,7 @@ export const BlueButton = props => {
style={{
borderWidth: 0.7,
borderColor: 'transparent',
backgroundColor: backgroundColor,
backgroundColor,
minHeight: 45,
height: 45,
maxHeight: 45,
@ -89,7 +89,7 @@ export const SecondButton = forwardRef((props, ref) => {
style={{
borderWidth: 0.7,
borderColor: 'transparent',
backgroundColor: backgroundColor,
backgroundColor,
minHeight: 45,
height: 45,
maxHeight: 45,

View File

@ -208,7 +208,7 @@ function WatchConnectivity() {
balance: formatBalance(Number(wallet.getBalance()), wallet.getPreferredBalanceUnit(), true),
type: wallet.type,
preferredBalanceUnit: wallet.getPreferredBalanceUnit(),
receiveAddress: receiveAddress,
receiveAddress,
transactions: watchTransactions,
hideBalance: wallet.hideBalance,
};

View File

@ -69,7 +69,7 @@ function Notifications(props) {
// if user is staring at the app when he receives the notification we process it instantly
// so app refetches related wallet
if (payload.foreground) props.onProcessNotifications();
if (payload.foreground) props.onProcessNotifications(); // eslint-disable-line react/prop-types
},
// (optional) Called when Registered Action is pressed and invokeApp is false, if true onNotification will be called (Android)

View File

@ -289,8 +289,8 @@ export class AppStorage {
realmkeyValue.create(
'KeyValue',
{
key: key,
value: value,
key,
value,
},
Realm.UpdateMode.Modified,
);

View File

@ -29,7 +29,7 @@ export default class Azteco {
}
static getParamsFromUrl(u) {
const urlObject = url.parse(u, true); // eslint-disable-line node/no-deprecated-api
const urlObject = url.parse(u, true); // eslint-disable-line n/no-deprecated-api
return {
uri: u,
c1: urlObject.query.c1,

View File

@ -184,7 +184,7 @@ class DeeplinkSchemaMatch {
},
]);
} else {
const urlObject = url.parse(event.url, true); // eslint-disable-line node/no-deprecated-api
const urlObject = url.parse(event.url, true); // eslint-disable-line n/no-deprecated-api
(async () => {
if (urlObject.protocol === 'bluewallet:' || urlObject.protocol === 'lapp:' || urlObject.protocol === 'blue:') {
switch (urlObject.host) {

View File

@ -168,7 +168,7 @@ export class HDSegwitBech32Transaction {
value = new BigNumber(value).multipliedBy(100000000).toNumber();
wentIn += value;
const address = SegwitBech32Wallet.witnessToAddress(inp.witness[inp.witness.length - 1]);
utxos.push({ vout: inp.index, value: value, txId: reversedHash, address: address });
utxos.push({ vout: inp.index, value, txId: reversedHash, address });
}
}
@ -193,7 +193,7 @@ export class HDSegwitBech32Transaction {
changeAmount += value;
} else {
// this is target
targets.push({ value: value, address: address });
targets.push({ value, address });
}
}
@ -205,9 +205,9 @@ export class HDSegwitBech32Transaction {
if (this._wallet.weOwnAddress(address)) {
unconfirmedUtxos.push({
vout: outp.n,
value: value,
value,
txId: this._txid || this._txDecoded.getId(),
address: address,
address,
});
}
}

View File

@ -1,7 +1,7 @@
import { bech32 } from 'bech32';
import bolt11 from 'bolt11';
import { isTorDaemonDisabled } from '../blue_modules/environment';
import { parse } from 'url'; // eslint-disable-line node/no-deprecated-api
import { parse } from 'url'; // eslint-disable-line n/no-deprecated-api
import { createHmac } from 'crypto';
import secp256k1 from 'secp256k1';
const CryptoJS = require('crypto-js');
@ -305,7 +305,7 @@ export default class Lnurl {
return new Promise((resolve, reject) => {
if (!this._lnurl) throw new Error('this._lnurl is not set');
const url = parse(Lnurl.getUrlFromLnurl(this._lnurl), true); // eslint-disable-line node/no-deprecated-api
const url = parse(Lnurl.getUrlFromLnurl(this._lnurl), true);
const hmac = createHmac('sha256', secret);
hmac.on('readable', async () => {

View File

@ -140,9 +140,9 @@ export class MultisigCosigner {
static exportToJson(xfp, xpub, path) {
return JSON.stringify({
xfp: xfp,
xpub: xpub,
path: path,
xfp,
xpub,
path,
});
}

View File

@ -217,7 +217,7 @@ const startImport = (importTextOrig, askPassphrase = false, searchAccounts = fal
wallet.setDerivationPath(path);
yield { progress: `bip39 ${i.script_type} ${path}` };
if (await wallet.wasEverUsed()) {
yield { wallet: wallet };
yield { wallet };
walletFound = true;
} else {
break; // don't check second account if first one is empty

View File

@ -115,7 +115,7 @@ export class LightningCustodianWallet extends LegacyWallet {
async payInvoice(invoice, freeAmount = 0) {
const response = await this._api.post('/payinvoice', {
body: { invoice: invoice, amount: freeAmount },
body: { invoice, amount: freeAmount },
headers: {
'Access-Control-Allow-Origin': '*',
'Content-Type': 'application/json',
@ -215,7 +215,7 @@ export class LightningCustodianWallet extends LegacyWallet {
async addInvoice(amt, memo) {
const response = await this._api.post('/addinvoice', {
body: { amt: amt + '', memo: memo },
body: { amt: amt + '', memo },
headers: {
'Access-Control-Allow-Origin': '*',
'Content-Type': 'application/json',
@ -254,7 +254,7 @@ export class LightningCustodianWallet extends LegacyWallet {
password = this.secret.replace('lndhub://', '').split(':')[1];
}
const response = await this._api.post('/auth?type=auth', {
body: { login: login, password: password },
body: { login, password },
headers: { 'Access-Control-Allow-Origin': '*', 'Content-Type': 'application/json' },
});

View File

@ -19,7 +19,7 @@ export const SquareButton = forwardRef((props, ref) => {
flex: 1,
borderWidth: 0.7,
borderColor: 'transparent',
backgroundColor: backgroundColor,
backgroundColor,
minHeight: 50,
height: 50,
maxHeight: 50,

View File

@ -128,7 +128,7 @@ export default class TransactionsNavigationHeader extends Component {
walletPreviousPreferredUnit = BitcoinUnit.BTC;
}
this.setState({ wallet, walletPreviousPreferredUnit: walletPreviousPreferredUnit }, () => {
this.setState({ wallet, walletPreviousPreferredUnit }, () => {
this.props.onWalletUnitChange(wallet);
});
};

View File

@ -73,7 +73,7 @@ const navigationStyle = (
fontWeight: '600',
color: theme.colors.foregroundColor,
},
headerRight: headerRight,
headerRight,
headerBackTitleVisible: false,
headerTintColor: theme.colors.foregroundColor,
...opts,

View File

@ -47,7 +47,7 @@ module.exports = (
];
prompt(title, text, buttons, {
type: type,
type,
cancelable: isCancelable,
// @ts-ignore suppressed because its supported only on ios and is absent from type definitions
keyboardType,

4693
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -7,38 +7,38 @@
"url": "https://github.com/BlueWallet/BlueWallet.git"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@babel/runtime": "^7.14.6",
"@babel/core": "^7.17.9",
"@babel/runtime": "^7.17.9",
"@jest/reporters": "^27.5.1",
"@react-native-community/eslint-config": "^3.0.0",
"@react-native-community/eslint-config": "^3.1.0",
"@types/bs58check": "^2.1.0",
"@types/create-hash": "^1.2.2",
"@types/jest": "^27.5.1",
"@types/react": "^17.0.14",
"@types/react-native": "^0.67.0",
"@types/react": "^17.0.39",
"@types/react-native": "^0.67.6",
"@types/react-test-renderer": "^17.0.1",
"@typescript-eslint/eslint-plugin": "^4.28.3",
"@typescript-eslint/parser": "^4.28.3",
"@typescript-eslint/eslint-plugin": "^5.41.0",
"@typescript-eslint/parser": "^5.41.0",
"babel-cli": "^6.26.0",
"babel-eslint": "^10.1.0",
"babel-jest": "^27.5.1",
"eslint": "^7.30.0",
"eslint-config-prettier": "^8.3.0",
"eslint-config-standard": "^16.0.2",
"eslint-config-standard-jsx": "^10.0.0",
"eslint-config-standard-react": "^11.0.1",
"eslint": "^8.26.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-standard": "^17.0.0",
"eslint-config-standard-jsx": "^11.0.0",
"eslint-config-standard-react": "^12.0.0",
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-n": "^15.2.3",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-react": "^7.23.2",
"eslint-plugin-standard": "^4.1.0",
"eslint-plugin-react": "^7.31.10",
"eslint-plugin-react-native": "^4.0.0",
"jest": "^27.5.1",
"node-fetch": "^2.6.2",
"prettier": "^2.2.1",
"node-fetch": "^2.6.7",
"prettier": "^2.7.1",
"react-test-renderer": "17.0.2",
"typescript": "^4.3.5"
"typescript": "^4.8.4"
},
"engines": {
"node": ">=10.16.0",

View File

@ -54,7 +54,7 @@ var webln = {
},
makeInvoice: function (RequestInvoiceArgs) {
var id = Math.random(); // eslint-disable-line
window.ReactNativeWebView.postMessage(JSON.stringify({ makeInvoice: RequestInvoiceArgs, id: id }));
window.ReactNativeWebView.postMessage(JSON.stringify({ makeInvoice: RequestInvoiceArgs, id }));
return new Promise(function (resolve, reject) {
var interval = setInterval(function () { // eslint-disable-line
if (bluewalletResponses[id]) {

View File

@ -28,7 +28,7 @@ import Lnurl from '../../class/lnurl';
import { BlueStorageContext } from '../../blue_modules/storage-context';
import Notifications from '../../blue_modules/notifications';
import alert from '../../components/Alert';
import { parse } from 'url'; // eslint-disable-line node/no-deprecated-api
import { parse } from 'url'; // eslint-disable-line n/no-deprecated-api
const currency = require('../../blue_modules/currency');
const torrific = require('../../blue_modules/torrific');
@ -246,7 +246,7 @@ const LNDCreateInvoice = () => {
// decoding the lnurl
const url = Lnurl.getUrlFromLnurl(data);
const { query } = parse(url, true); // eslint-disable-line node/no-deprecated-api
const { query } = parse(url, true);
if (query.tag === Lnurl.TAG_LOGIN_REQUEST) {
navigate('LnurlAuth', {
@ -367,7 +367,7 @@ const LNDCreateInvoice = () => {
};
const navigateToSelectWallet = () => {
navigate('SelectWallet', { onWalletSelect: onWalletSelect, chainType: Chain.OFFCHAIN });
navigate('SelectWallet', { onWalletSelect, chainType: Chain.OFFCHAIN });
};
const renderWalletSelectionButton = () => {

View File

@ -28,7 +28,7 @@ const LnurlAuth = () => {
const wallet = useMemo(() => wallets.find(w => w.getID() === walletID), [wallets, walletID]);
const LN = useMemo(() => new Lnurl(lnurl), [lnurl]);
const parsedLnurl = useMemo(
() => (lnurl ? url.parse(Lnurl.getUrlFromLnurl(lnurl), true) : {}), // eslint-disable-line node/no-deprecated-api
() => (lnurl ? url.parse(Lnurl.getUrlFromLnurl(lnurl), true) : {}), // eslint-disable-line n/no-deprecated-api
[lnurl],
);
const [authState, setAuthState] = useState(AuthState.USER_PROMPT);

View File

@ -120,7 +120,7 @@ export default class LnurlPaySuccess extends Component {
this.props.navigation.navigate('ScanLndInvoiceRoot', {
screen: 'LnurlPay',
params: {
lnurl: lnurl,
lnurl,
walletID: this.state.fromWalletID,
},
});

View File

@ -461,11 +461,7 @@ const ReceiveDetails = () => {
<View style={[styles.root, stylesHook.root]}>
<StatusBar barStyle="light-content" />
{address !== undefined && showAddress && (
<HandoffComponent
title={loc.send.details_address}
type={HandoffComponent.activityTypes.ReceiveOnchain}
userInfo={{ address: address }}
/>
<HandoffComponent title={loc.send.details_address} type={HandoffComponent.activityTypes.ReceiveOnchain} userInfo={{ address }} />
)}
{showConfirmedBalance ? renderConfirmedBalance() : null}
{showPendingBalance ? renderPendingBalance() : null}

View File

@ -335,11 +335,7 @@ const ScanQRCode = () => {
<View style={styles.root}>
<StatusBar hidden />
{isFocused && cameraStatus !== CameraAuthStatus.NOT_AUTHORIZED && (
<CameraScreen
scanBarcode
onReadCode={event => onBarCodeRead({ data: event?.nativeEvent?.codeStringValue })}
showFrame={false}
/>
<CameraScreen scanBarcode onReadCode={event => onBarCodeRead({ data: event?.nativeEvent?.codeStringValue })} showFrame={false} />
)}
{cameraStatus === CameraAuthStatus.NOT_AUTHORIZED && (
<View style={[styles.openSettingsContainer, stylesHook.openSettingsContainer]}>

View File

@ -67,7 +67,7 @@ const PsbtMultisigQRCode = () => {
navigate('ScanQRCodeRoot', {
screen: 'ScanQRCode',
params: {
onBarScanned: onBarScanned,
onBarScanned,
showFileImportButton: true,
},
});

View File

@ -228,8 +228,8 @@ export default class ElectrumSettings extends Component {
value = DeeplinkSchemaMatch.getServerFromSetElectrumServerAction(value);
}
const [host, port, type] = value.split(':');
this.setState({ host: host, sslPort: '', port: '' }, () => {
type === 's' ? this.setState({ sslPort: port }) : this.setState({ port: port });
this.setState({ host, sslPort: '', port: '' }, () => {
type === 's' ? this.setState({ sslPort: port }) : this.setState({ port });
});
};

View File

@ -101,7 +101,7 @@ const WalletsImport = () => {
screen: 'ScanQRCode',
params: {
launchedBy: route.name,
onBarScanned: onBarScanned,
onBarScanned,
showFileImportButton: true,
},
});

View File

@ -369,7 +369,7 @@ const WalletsList = () => {
contentInsetAdjustmentBehavior="automatic"
automaticallyAdjustContentInsets
refreshing={isLoading}
{...(isElectrumDisabled ? {} : { refreshing: isLoading, onRefresh: onRefresh })}
{...(isElectrumDisabled ? {} : { refreshing: isLoading, onRefresh })}
renderItem={renderSectionItem}
keyExtractor={sectionListKeyExtractor}
renderSectionHeader={renderSectionHeader}

View File

@ -23,7 +23,7 @@ describe('currency', () => {
assert.strictEqual(currency.satoshiToBTC(1), '0.00000001');
assert.strictEqual(currency.satoshiToBTC(-1), '-0.00000001');
assert.strictEqual(currency.satoshiToBTC(100000000), '1');
assert.strictEqual(currency.satoshiToBTC(123456789123456789), '1234567891.2345678'); // eslint-disable-line no-loss-of-precision
assert.strictEqual(currency.satoshiToBTC(123456789123456789), '1234567891.2345678'); // eslint-disable-line @typescript-eslint/no-loss-of-precision
currency._setPreferredFiatCurrency(FiatUnit.JPY);
currency._setExchangeRate('BTC_JPY', 1043740.8614);