Update linter peer dependencies (#2168)

This commit is contained in:
Jackson Mills
2023-02-07 15:00:55 -08:00
committed by GitHub
parent 7dd38f6a76
commit bef2f79fee
15 changed files with 5327 additions and 2001 deletions

7099
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -27,25 +27,25 @@
"@types/node": "^14.18.35",
"@types/puppeteer": "5.4.6",
"@types/ws": "^8.2.0",
"@typescript-eslint/eslint-plugin": "^4.30.0",
"@typescript-eslint/parser": "^4.0.0",
"@xrplf/eslint-config": "^1.6.0",
"@xrplf/prettier-config": "^1.5.0",
"@typescript-eslint/eslint-plugin": "^5.28.0",
"@typescript-eslint/parser": "^5.28 .0",
"@xrplf/eslint-config": "^1.9.1",
"@xrplf/prettier-config": "^1.9.1",
"assert": "^2.0.0",
"buffer": "^6.0.2",
"chai": "^4.3.4",
"copyfiles": "^2.4.1",
"crypto-browserify": "^3.12.0",
"ejs": "^3.0.1",
"eslint": "^7.5.0",
"eslint": "^8.18.0",
"eslint-plugin-array-func": "^3.1.7",
"eslint-plugin-consistent-default-export-name": "^0.0.15",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.24.1",
"eslint-plugin-jsdoc": "^37.1.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsdoc": "^39.3.3",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-tsdoc": "^0.2.14",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-tsdoc": "^0.2.16",
"eventemitter2": "^6.0.0",
"expect": "^29.3.1",
"https-browserify": "^1.0.0",

View File

@@ -39,6 +39,7 @@ module.exports = {
'jsdoc/require-throws': 'off',
'jsdoc/require-jsdoc': 'off',
'jsdoc/require-param': 'off',
'jsdoc/check-examples': 'off', // Not implemented in eslint 8
'tsdoc/syntax': 'off',
'@typescript-eslint/no-require-imports': 'off',
},

View File

@@ -80,6 +80,7 @@ module.exports = {
'jsdoc/require-description-complete-sentence': 'off',
'jsdoc/require-jsdoc': 'off',
'jsdoc/check-tag-names': 'off',
'jsdoc/check-examples': 'off', // Not implemented in eslint 8
'jsdoc/require-returns': 'off',
'jsdoc/require-hyphen-before-param-description': 'off',
'jsdoc/require-description': 'off',

View File

@@ -159,6 +159,7 @@ class ShaMapInner extends ShaMapNode {
*/
addItem(index?: Hash256, item?: ShaMapNode, leaf?: ShaMapLeaf): void {
assert.ok(index !== undefined)
if (index !== undefined) {
const nibble = index.nibblet(this.depth)
const existing = this.branches[nibble]
@@ -175,6 +176,7 @@ class ShaMapInner extends ShaMapNode {
throw new Error('invalid ShaMap.addItem call')
}
}
}
}
class ShaMap extends ShaMapInner {}

View File

@@ -50,6 +50,7 @@ module.exports = {
'jsdoc/require-returns': 'off',
'jsdoc/require-description-complete-sentence': 'off',
'jsdoc/check-tag-names': 'off',
'jsdoc/check-examples': 'off', // Not implemented in eslint 8
'jsdoc/no-types': 'off',
'tsdoc/syntax': 'off',
'import/order': 'off',

View File

@@ -86,15 +86,6 @@ class Wallet {
public readonly classicAddress: string
public readonly seed?: string
/**
* Alias for wallet.classicAddress.
*
* @returns The wallet's classic address.
*/
public get address(): string {
return this.classicAddress
}
/**
* Creates a new Wallet.
*
@@ -120,6 +111,15 @@ class Wallet {
this.seed = opts.seed
}
/**
* Alias for wallet.classicAddress.
*
* @returns The wallet's classic address.
*/
public get address(): string {
return this.classicAddress
}
/**
* Generates a new Wallet using a generated seed.
*

View File

@@ -74,6 +74,15 @@ export default class WSWrapper extends EventEmitter {
}
}
/**
* Get the ready state of the websocket.
*
* @returns The Websocket's ready state.
*/
public get readyState(): number {
return this.ws.readyState
}
/**
* Closes the websocket.
*
@@ -94,13 +103,4 @@ export default class WSWrapper extends EventEmitter {
public send(message: string): void {
this.ws.send(message)
}
/**
* Get the ready state of the websocket.
*
* @returns The Websocket's ready state.
*/
public get readyState(): number {
return this.ws.readyState
}
}

View File

@@ -212,6 +212,24 @@ export class Connection extends EventEmitter {
}
}
/**
* Gets the state of the websocket.
*
* @returns The Websocket's ready state.
*/
private get state(): WebsocketState {
return this.ws ? this.ws.readyState : WebSocket.CLOSED
}
/**
* Returns whether the server should be connected.
*
* @returns Whether the server should be connected.
*/
private get shouldBeConnected(): boolean {
return this.ws !== null
}
/**
* Returns whether the websocket is connected.
*
@@ -367,7 +385,7 @@ export class Connection extends EventEmitter {
return this.url ?? ''
}
// eslint-disable-next-line @typescript-eslint/no-empty-function -- Does nothing on default
// eslint-disable-next-line @typescript-eslint/no-empty-function, class-methods-use-this -- Does nothing on default
public readonly trace: (id: string, message: string) => void = () => {}
/**
@@ -410,24 +428,6 @@ export class Connection extends EventEmitter {
}
}
/**
* Gets the state of the websocket.
*
* @returns The Websocket's ready state.
*/
private get state(): WebsocketState {
return this.ws ? this.ws.readyState : WebSocket.CLOSED
}
/**
* Returns whether the server should be connected.
*
* @returns Whether the server should be connected.
*/
private get shouldBeConnected(): boolean {
return this.ws !== null
}
/**
* Handler for what to do once the connection to the server is open.
*

View File

@@ -1,3 +1,4 @@
/* eslint-disable jsdoc/require-jsdoc -- Request has many aliases, but they don't need unique docs */
/* eslint-disable @typescript-eslint/member-ordering -- TODO: remove when instance methods aren't members */
/* eslint-disable max-lines -- Client is a large file w/ lots of imports/exports */
import * as assert from 'assert'

View File

@@ -33,6 +33,26 @@ class InnerNode extends Node {
this.empty = true
}
/**
* Get the hash of a LeafNode.
*
* @returns Hash of the LeafNode.
*/
public get hash(): string {
if (this.empty) {
return HEX_ZERO
}
let hex = ''
for (let iter = 0; iter <= SLOT_MAX; iter++) {
const child = this.leaves[iter]
const hash: string = child == null ? HEX_ZERO : child.hash
hex += hash
}
const prefix = HashPrefix.INNER_NODE.toString(HEX)
return sha512Half(prefix + hex)
}
/**
* Adds an item to the InnerNode.
*
@@ -99,26 +119,6 @@ class InnerNode extends Node {
}
return this.leaves[slot]
}
/**
* Get the hash of a LeafNode.
*
* @returns Hash of the LeafNode.
*/
public get hash(): string {
if (this.empty) {
return HEX_ZERO
}
let hex = ''
for (let iter = 0; iter <= SLOT_MAX; iter++) {
const child = this.leaves[iter]
const hash: string = child == null ? HEX_ZERO : child.hash
hex += hash
}
const prefix = HashPrefix.INNER_NODE.toString(HEX)
return sha512Half(prefix + hex)
}
}
export default InnerNode

View File

@@ -28,18 +28,6 @@ class LeafNode extends Node {
this.data = data
}
/**
* Add item to Leaf.
*
* @param tag - Index of the Node.
* @param node - Node to insert.
* @throws When called, because LeafNodes cannot addItem.
*/
public addItem(tag: string, node: Node): void {
throw new XrplError('Cannot call addItem on a LeafNode')
this.addItem(tag, node)
}
/**
* Get the hash of a LeafNode.
*
@@ -64,6 +52,18 @@ class LeafNode extends Node {
throw new XrplError('Tried to hash a SHAMap node of unknown type.')
}
}
/**
* Add item to Leaf.
*
* @param tag - Index of the Node.
* @param node - Node to insert.
* @throws When called, because LeafNodes cannot addItem.
*/
public addItem(tag: string, node: Node): void {
throw new XrplError('Cannot call addItem on a LeafNode')
this.addItem(tag, node)
}
}
export default LeafNode

View File

@@ -2,6 +2,10 @@ import InnerNode from './InnerNode'
import LeafNode from './LeafNode'
import { NodeType } from './node'
/**
* SHAMap is the hash structure used to model ledgers.
* If the root hash is equivalent, that means all nodes should be equivalent as well.
*/
class SHAMap {
public root: InnerNode
@@ -12,6 +16,15 @@ class SHAMap {
this.root = new InnerNode(0)
}
/**
* Get the hash of the SHAMap.
*
* @returns The hash of the root of the SHAMap.
*/
public get hash(): string {
return this.root.hash
}
/**
* Add an item to the SHAMap.
*
@@ -22,15 +35,6 @@ class SHAMap {
public addItem(tag: string, data: string, type: NodeType): void {
this.root.addItem(tag, new LeafNode(tag, data, type))
}
/**
* Get the hash of the SHAMap.
*
* @returns The hash of the root of the SHAMap.
*/
public get hash(): string {
return this.root.hash
}
}
export * from './node'

View File

@@ -9,6 +9,6 @@ export enum NodeType {
* Abstract base class for SHAMapNode.
*/
export abstract class Node {
public abstract addItem(_tag: string, _node: Node): void
public abstract get hash(): string
public abstract addItem(_tag: string, _node: Node): void
}

View File

@@ -14,10 +14,7 @@
"esModuleInterop": true,
"suppressImplicitAnyIndexErrors": false,
"resolveJsonModule": true,
"preserveSymlinks": true,
"preserveSymlinks": true
},
"include": [
"src/**/*.ts",
"src/**/*.json"
]
"include": ["src/**/*.ts", "src/**/*.json"]
}