Remove jsx-runtime alias for React 18 (#635)

* Remove jsx-runtime alias for React 18

* Adjust override

* s/cb/fn/
This commit is contained in:
Jaco
2022-04-23 08:57:36 +02:00
committed by GitHub
parent e4787f1b25
commit 6c2d03a6c5
7 changed files with 222 additions and 213 deletions
+8 -9
View File
@@ -6,24 +6,23 @@ import type { KeyringJson, KeyringStore } from '../types';
import store from 'store';
export class BrowserStore implements KeyringStore {
public all (cb: (key: string, value: KeyringJson) => void): void {
public all (fn: (key: string, value: KeyringJson) => void): void {
store.each((value: KeyringJson, key: string): void => {
cb(key, value);
fn(key, value);
});
}
public get (key: string, cb: (value: KeyringJson) => void): void {
// eslint-disable-next-line node/no-callback-literal
cb(store.get(key) as KeyringJson);
public get (key: string, fn: (value: KeyringJson) => void): void {
fn(store.get(key) as KeyringJson);
}
public remove (key: string, cb?: () => void): void {
public remove (key: string, fn?: () => void): void {
store.remove(key);
cb && cb();
fn && fn();
}
public set (key: string, value: KeyringJson, cb?: () => void): void {
public set (key: string, value: KeyringJson, fn?: () => void): void {
store.set(key, value);
cb && cb();
fn && fn();
}
}
+8 -8
View File
@@ -21,33 +21,33 @@ export class FileStore implements KeyringStore {
this.#path = path;
}
public all (cb: (key: string, value: KeyringJson) => void): void {
public all (fn: (key: string, value: KeyringJson) => void): void {
fs
.readdirSync(this.#path)
.filter((key): boolean => !['.', '..', '.DS_Store'].includes(key))
.forEach((key): void => {
const value = this._readKey(key);
value?.address && cb(key, value);
value?.address && fn(key, value);
});
}
public get (key: string, cb: (value: KeyringJson) => void): void {
public get (key: string, fn: (value: KeyringJson) => void): void {
const value = this._readKey(key);
assert(value?.address, `Invalid JSON found for ${key}`);
cb(value);
fn(value);
}
public remove (key: string, cb?: () => void): void {
public remove (key: string, fn?: () => void): void {
fs.unlinkSync(this._getPath(key));
cb && cb();
fn && fn();
}
public set (key: string, value: KeyringJson, cb?: () => void): void {
public set (key: string, value: KeyringJson, fn?: () => void): void {
fs.writeFileSync(this._getPath(key), Buffer.from(JSON.stringify(value), 'utf-8'));
cb && cb();
fn && fn();
}
private _getPath (key: string): string {