Add wrong default import from json files to code quality checks, fix those imports

This commit is contained in:
Pieter Vander Vennet 2023-02-08 01:14:21 +01:00
parent 71c815d37d
commit ce44f34bf3
42 changed files with 167 additions and 148 deletions

View file

@ -12,9 +12,9 @@ import LZString from "lz-string"
import { FixLegacyTheme } from "../Models/ThemeConfig/Conversion/LegacyJsonConvert"
import { LayerConfigJson } from "../Models/ThemeConfig/Json/LayerConfigJson"
import SharedTagRenderings from "../Customizations/SharedTagRenderings"
import * as known_layers from "../assets/generated/known_layers.json"
import known_layers from "../assets/generated/known_layers.json"
import { PrepareTheme } from "../Models/ThemeConfig/Conversion/PrepareTheme"
import * as licenses from "../assets/generated/license_info.json"
import licenses from "../assets/generated/license_info.json"
import TagRenderingConfig from "../Models/ThemeConfig/TagRenderingConfig"
import { FixImages } from "../Models/ThemeConfig/Conversion/FixImages"
import Svg from "../Svg"

View file

@ -1,5 +1,5 @@
import { Utils } from "../../Utils"
import * as polygon_features from "../../assets/polygon-features.json"
import polygon_features from "../../assets/polygon-features.json"
import { Store, UIEventSource } from "../UIEventSource"
import { BBox } from "../BBox"
import OsmToGeoJson from "osmtogeojson"
@ -290,7 +290,7 @@ export abstract class OsmObject {
{ values: Set<string>; blacklist: boolean }
> {
const result = new Map<string, { values: Set<string>; blacklist: boolean }>()
for (const polygonFeature of polygon_features["default"] ?? polygon_features) {
for (const polygonFeature of polygon_features) {
const key = polygonFeature.key
if (polygonFeature.polygon === "all") {

View file

@ -9,7 +9,7 @@ import SelectedElementTagsUpdater from "../Actors/SelectedElementTagsUpdater"
import { Changes } from "../Osm/Changes"
import ChangeToElementsActor from "../Actors/ChangeToElementsActor"
import PendingChangesUploader from "../Actors/PendingChangesUploader"
import * as translators from "../../assets/translators.json"
import translators from "../../assets/translators.json"
import Maproulette from "../Maproulette"
/**

View file

@ -7,13 +7,13 @@ import { RegexTag } from "./RegexTag"
import SubstitutingTag from "./SubstitutingTag"
import { Or } from "./Or"
import { TagConfigJson } from "../../Models/ThemeConfig/Json/TagConfigJson"
import * as key_counts from "../../assets/key_totals.json"
import key_counts from "../../assets/key_totals.json"
type Tags = Record<string, string>
export type UploadableTag = Tag | SubstitutingTag | And
export class TagUtils {
private static keyCounts: { keys: any; tags: any } = key_counts["default"] ?? key_counts
private static keyCounts: { keys: any; tags: any } = key_counts
private static comparators: [string, (a: number, b: number) => boolean][] = [
["<=", (a, b) => a <= b],
[">=", (a, b) => a >= b],