chore: use prettier instead of clang-format (#7014)

* chore: add and configure prettier

* chore: remove clang-format

* chore: remove clang-format config

* chore: lint additional ts files

* chore: fix lint errors in blocks

* chore: add prettier-ignore where needed

* chore: ignore js blocks when formatting

* chore: fix playground html syntax

* chore: fix yaml spacing from merge

* chore: convert text blocks to use arrow functions

* chore: format everything with prettier

* chore: fix lint unused imports in blocks
This commit is contained in:
Maribeth Bottorff
2023-05-10 16:01:39 -07:00
committed by GitHub
parent af991f5e1b
commit 88ff901a72
425 changed files with 29170 additions and 21169 deletions

View File

@@ -19,7 +19,6 @@ import type {IConnectionChecker} from './interfaces/i_connection_checker.js';
import type {RenderedConnection} from './rendered_connection.js';
import type {Coordinate} from './utils/coordinate.js';
/**
* Database of connections.
* Connections are stored in order of their vertical component. This way
@@ -58,8 +57,10 @@ export class ConnectionDB {
* @returns The index of the connection, or -1 if the connection was not
* found.
*/
private findIndexOfConnection(conn: RenderedConnection, yPos: number):
number {
private findIndexOfConnection(
conn: RenderedConnection,
yPos: number
): number {
if (!this.connections.length) {
return -1;
}
@@ -81,8 +82,10 @@ export class ConnectionDB {
}
pointer = bestGuess;
while (pointer < this.connections.length &&
this.connections[pointer].y === yPos) {
while (
pointer < this.connections.length &&
this.connections[pointer].y === yPos
) {
if (this.connections[pointer] === conn) {
return pointer;
}
@@ -140,8 +143,10 @@ export class ConnectionDB {
* @param maxRadius The maximum radius to another connection.
* @returns List of connections.
*/
getNeighbours(connection: RenderedConnection, maxRadius: number):
RenderedConnection[] {
getNeighbours(
connection: RenderedConnection,
maxRadius: number
): RenderedConnection[] {
const db = this.connections;
const currentX = connection.x;
const currentY = connection.y;
@@ -218,8 +223,10 @@ export class ConnectionDB {
* connection or null, and 'radius' which is the distance.
*/
searchForClosest(
conn: RenderedConnection, maxRadius: number,
dxy: Coordinate): {connection: RenderedConnection|null, radius: number} {
conn: RenderedConnection,
maxRadius: number,
dxy: Coordinate
): {connection: RenderedConnection | null; radius: number} {
if (!this.connections.length) {
// Don't bother.
return {connection: null, radius: maxRadius};
@@ -253,8 +260,10 @@ export class ConnectionDB {
}
let pointerMax = closestIndex;
while (pointerMax < this.connections.length &&
this.isInYRange(pointerMax, conn.y, maxRadius)) {
while (
pointerMax < this.connections.length &&
this.isInYRange(pointerMax, conn.y, maxRadius)
) {
temp = this.connections[pointerMax];
if (this.connectionChecker.canConnect(conn, temp, true, bestRadius)) {
bestConnection = temp;