forked from MapComplete/MapComplete
Chore: housekeeping, linting
This commit is contained in:
parent
f942529755
commit
30d00eb06d
74 changed files with 998 additions and 623 deletions
|
@ -9,15 +9,10 @@ import { ConversionContext } from "../src/Models/ThemeConfig/Conversion/Conversi
|
|||
|
||||
class ExtractQuestionHint extends DesugaringStep<QuestionableTagRenderingConfigJson> {
|
||||
constructor() {
|
||||
super(
|
||||
"ExtractQuestionHint",
|
||||
"Tries to extract a 'questionHint' from the question",
|
||||
)
|
||||
super("ExtractQuestionHint", "Tries to extract a 'questionHint' from the question")
|
||||
}
|
||||
|
||||
convert(
|
||||
json: QuestionableTagRenderingConfigJson
|
||||
): QuestionableTagRenderingConfigJson {
|
||||
convert(json: QuestionableTagRenderingConfigJson): QuestionableTagRenderingConfigJson {
|
||||
json = { ...json }
|
||||
if (json.question === undefined || json.questionHint !== undefined) {
|
||||
return json
|
||||
|
@ -82,7 +77,8 @@ class FixQuestionHint extends Script {
|
|||
}
|
||||
contents[key] = convertor.convertStrict(
|
||||
tr,
|
||||
ConversionContext.construct([],
|
||||
ConversionContext.construct(
|
||||
[],
|
||||
["While automatically extracting questiondHints of " + filepath]
|
||||
)
|
||||
)
|
||||
|
@ -100,9 +96,10 @@ class FixQuestionHint extends Script {
|
|||
}
|
||||
layer.tagRenderings[i] = convertor.convertStrict(
|
||||
<QuestionableTagRenderingConfigJson>tagRendering,
|
||||
ConversionContext.construct([], [
|
||||
"While automatically extracting questionHints of " + filepath
|
||||
])
|
||||
ConversionContext.construct(
|
||||
[],
|
||||
["While automatically extracting questionHints of " + filepath]
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -290,7 +290,9 @@ export class GenerateDocs extends Script {
|
|||
}
|
||||
|
||||
if (denomination.factorToCanonical) {
|
||||
els.push(`1${denomination.canonical} = ${denomination.factorToCanonical}${defaultUnit.canonical}`)
|
||||
els.push(
|
||||
`1${denomination.canonical} = ${denomination.factorToCanonical}${defaultUnit.canonical}`
|
||||
)
|
||||
}
|
||||
|
||||
if (denomination.useIfNoUnitGiven === true) {
|
||||
|
|
|
@ -9,12 +9,16 @@ import {
|
|||
DoesImageExist,
|
||||
PrevalidateTheme,
|
||||
ValidateLayer,
|
||||
ValidateThemeEnsemble
|
||||
ValidateThemeEnsemble,
|
||||
} from "../src/Models/ThemeConfig/Conversion/Validation"
|
||||
import { Translation } from "../src/UI/i18n/Translation"
|
||||
import { PrepareLayer } from "../src/Models/ThemeConfig/Conversion/PrepareLayer"
|
||||
import { PrepareTheme } from "../src/Models/ThemeConfig/Conversion/PrepareTheme"
|
||||
import { Conversion, DesugaringContext, DesugaringStep } from "../src/Models/ThemeConfig/Conversion/Conversion"
|
||||
import {
|
||||
Conversion,
|
||||
DesugaringContext,
|
||||
DesugaringStep,
|
||||
} from "../src/Models/ThemeConfig/Conversion/Conversion"
|
||||
import { Utils } from "../src/Utils"
|
||||
import Script from "./Script"
|
||||
import { AllSharedLayers } from "../src/Customizations/AllSharedLayers"
|
||||
|
@ -31,7 +35,10 @@ import { Translatable } from "../src/Models/ThemeConfig/Json/Translatable"
|
|||
import { ValidateThemeAndLayers } from "../src/Models/ThemeConfig/Conversion/ValidateThemeAndLayers"
|
||||
import { ExtractImages } from "../src/Models/ThemeConfig/Conversion/FixImages"
|
||||
import { TagRenderingConfigJson } from "../src/Models/ThemeConfig/Json/TagRenderingConfigJson"
|
||||
import { LayerConfigDependencyGraph, LevelInfo } from "../src/Models/ThemeConfig/LayerConfigDependencyGraph"
|
||||
import {
|
||||
LayerConfigDependencyGraph,
|
||||
LevelInfo,
|
||||
} from "../src/Models/ThemeConfig/LayerConfigDependencyGraph"
|
||||
|
||||
// This scripts scans 'src/assets/layers/*.json' for layer definition files and 'src/assets/themes/*.json' for theme definition files.
|
||||
// It spits out an overview of those to be used to load them
|
||||
|
@ -768,7 +775,14 @@ class LayerOverviewUtils extends Script {
|
|||
const data = JSON.parse(readFileSync(path, "utf8"))
|
||||
results.push(data)
|
||||
if (data.id !== expectedId) {
|
||||
throw "Wrong ID or location for file " + path + "; expected " + expectedId + " but got " + data.id
|
||||
throw (
|
||||
"Wrong ID or location for file " +
|
||||
path +
|
||||
"; expected " +
|
||||
expectedId +
|
||||
" but got " +
|
||||
data.id
|
||||
)
|
||||
}
|
||||
} catch (e) {
|
||||
throw "Could not parse layer file " + path + " due to " + e
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
import Script from "./Script"
|
||||
import NameSuggestionIndex, { NamgeSuggestionWikidata, NSIItem } from "../src/Logic/Web/NameSuggestionIndex"
|
||||
import NameSuggestionIndex, {
|
||||
NamgeSuggestionWikidata,
|
||||
NSIItem,
|
||||
} from "../src/Logic/Web/NameSuggestionIndex"
|
||||
import * as nsiWD from "../node_modules/name-suggestion-index/dist/wikidata.min.json"
|
||||
import { existsSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "fs"
|
||||
import ScriptUtils from "./ScriptUtils"
|
||||
|
@ -215,7 +218,7 @@ class NsiLogos extends Script {
|
|||
const config: LayerConfigJson = {
|
||||
id: "nsi_" + type,
|
||||
description: {
|
||||
en: "Exposes part of the NSI to reuse in other themes, e.g. for rendering. Automatically generated and never directly loaded in a theme. Generated with scripts/nsiLogos.ts"
|
||||
en: "Exposes part of the NSI to reuse in other themes, e.g. for rendering. Automatically generated and never directly loaded in a theme. Generated with scripts/nsiLogos.ts",
|
||||
},
|
||||
source: "special:library",
|
||||
pointRendering: null,
|
||||
|
@ -393,7 +396,7 @@ class NsiLogos extends Script {
|
|||
download: { f: () => this.download(), doc: "Download all icons" },
|
||||
generateRenderings: {
|
||||
f: () => this.generateRenderings(),
|
||||
doc: "Generates the layer files 'nsi_brand.json' and 'nsi_operator.json' which allows to reuse the icons in renderings"
|
||||
doc: "Generates the layer files 'nsi_brand.json' and 'nsi_operator.json' which allows to reuse the icons in renderings",
|
||||
},
|
||||
prune: { f: () => NsiLogos.prune(), doc: "Remove no longer needed files" },
|
||||
addExtensions: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue