forked from MapComplete/MapComplete
Chore: remove all unused imports, port 'allTags' to proper svelte
This commit is contained in:
parent
f7b555b9b6
commit
d09f89dc2a
38 changed files with 216 additions and 227 deletions
|
@ -1,7 +1,7 @@
|
|||
import { ConversionMessage, ConversionMsgLevel } from "./Conversion"
|
||||
import { Context } from "maplibre-gl"
|
||||
|
||||
export class ConversionContext {
|
||||
private static reported = false
|
||||
/**
|
||||
* The path within the data structure where we are currently operating
|
||||
*/
|
||||
|
@ -11,7 +11,6 @@ export class ConversionContext {
|
|||
*/
|
||||
readonly operation: ReadonlyArray<string>
|
||||
readonly messages: ConversionMessage[]
|
||||
|
||||
private _hasErrors: boolean = false
|
||||
|
||||
private constructor(
|
||||
|
@ -33,7 +32,6 @@ export class ConversionContext {
|
|||
}
|
||||
}
|
||||
}
|
||||
private static reported = false
|
||||
|
||||
public static construct(path: (string | number)[], operation: string[]) {
|
||||
return new ConversionContext([], [...path], [...operation])
|
||||
|
@ -43,31 +41,6 @@ export class ConversionContext {
|
|||
return new ConversionContext([], msg ? [msg] : [], ["test"])
|
||||
}
|
||||
|
||||
/**
|
||||
* Does an inline edit of the messages for which a new path is defined
|
||||
* This is a slight hack
|
||||
* @param rewritePath
|
||||
*/
|
||||
public rewriteMessages(
|
||||
rewritePath: (
|
||||
p: ReadonlyArray<number | string>
|
||||
) => undefined | ReadonlyArray<number | string>
|
||||
): void {
|
||||
for (let i = 0; i < this.messages.length; i++) {
|
||||
const m = this.messages[i]
|
||||
const newPath = rewritePath(m.context.path)
|
||||
if (!newPath) {
|
||||
continue
|
||||
}
|
||||
const rewrittenContext = new ConversionContext(
|
||||
this.messages,
|
||||
newPath,
|
||||
m.context.operation
|
||||
)
|
||||
this.messages[i] = <ConversionMessage>{ ...m, context: rewrittenContext }
|
||||
}
|
||||
}
|
||||
|
||||
static print(msg: ConversionMessage) {
|
||||
const noString = msg.context.path.filter(
|
||||
(p) => typeof p !== "string" && typeof p !== "number"
|
||||
|
@ -102,6 +75,31 @@ export class ConversionContext {
|
|||
return "\x1b[31m" + s + "\x1b[0m"
|
||||
}
|
||||
|
||||
/**
|
||||
* Does an inline edit of the messages for which a new path is defined
|
||||
* This is a slight hack
|
||||
* @param rewritePath
|
||||
*/
|
||||
public rewriteMessages(
|
||||
rewritePath: (
|
||||
p: ReadonlyArray<number | string>
|
||||
) => undefined | ReadonlyArray<number | string>
|
||||
): void {
|
||||
for (let i = 0; i < this.messages.length; i++) {
|
||||
const m = this.messages[i]
|
||||
const newPath = rewritePath(m.context.path)
|
||||
if (!newPath) {
|
||||
continue
|
||||
}
|
||||
const rewrittenContext = new ConversionContext(
|
||||
this.messages,
|
||||
newPath,
|
||||
m.context.operation
|
||||
)
|
||||
this.messages[i] = <ConversionMessage>{ ...m, context: rewrittenContext }
|
||||
}
|
||||
}
|
||||
|
||||
public enter(key: string | number | (string | number)[]) {
|
||||
if (!Array.isArray(key)) {
|
||||
if (typeof key === "number" && key < 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue