Prettify & lint

This commit is contained in:
Emmanuel 2023-03-04 10:16:47 +01:00
parent 3e49648c2d
commit 3a165c1978
17 changed files with 21 additions and 75 deletions

View file

@ -4,7 +4,6 @@ import {
auditEmptyToNull,
auditFunction,
auditHttpUrl,
auditInteger,
auditNullish,
auditNumber,
auditOptions,

View file

@ -3,8 +3,6 @@ import {
auditDateIso8601String,
auditEmptyToNull,
auditFunction,
auditHttpUrl,
auditInteger,
auditNumber,
auditOptions,
auditRequire,

View file

@ -674,31 +674,6 @@ function auditNota(audit: Audit, dataUnknown: unknown): [unknown, unknown] {
return audit.reduceRemaining(data, errors, remainingKeys)
}
function auditNotice(audit: Audit, dataUnknown: unknown): [unknown, unknown] {
if (dataUnknown == null) {
return [dataUnknown, null]
}
if (typeof dataUnknown !== "object") {
return audit.unexpectedType(dataUnknown, "object")
}
const data = { ...dataUnknown }
const errors: { [key: string]: unknown } = {}
const remainingKeys = new Set(Object.keys(data))
audit.attribute(
data,
"CONTENU",
true,
errors,
remainingKeys,
auditTrimString,
auditEmptyToNull,
)
return audit.reduceRemaining(data, errors, remainingKeys)
}
function auditRect(audit: Audit, dataUnknown: unknown): [unknown, unknown] {
if (dataUnknown == null) {
return [dataUnknown, null]
@ -752,33 +727,6 @@ function auditSignataires(
return audit.reduceRemaining(data, errors, remainingKeys)
}
function auditSm(audit: Audit, dataUnknown: unknown): [unknown, unknown] {
if (dataUnknown == null) {
return [dataUnknown, null]
}
if (typeof dataUnknown !== "object") {
return audit.unexpectedType(dataUnknown, "object")
}
const data = { ...dataUnknown }
const errors: { [key: string]: unknown } = {}
const remainingKeys = new Set(Object.keys(data))
audit.attribute(
data,
"CONTENU",
true,
errors,
remainingKeys,
auditSwitch(
[auditNumber, auditFunction((num) => num.toString())],
[auditTrimString, auditEmptyToNull],
),
)
return audit.reduceRemaining(data, errors, remainingKeys)
}
function auditTp(audit: Audit, dataUnknown: unknown): [unknown, unknown] {
if (dataUnknown == null) {
return [dataUnknown, null]

View file

@ -3,7 +3,6 @@ import {
auditDateIso8601String,
auditEmptyToNull,
auditFunction,
auditHttpUrl,
auditInteger,
auditNullish,
auditNumber,

View file

@ -12,7 +12,7 @@
{#if items !== undefined}
<div class="tabs">
{#each items as { href, label }}
<a class="tab tab-lifted" class:tab-active={href === pathname} {href}
<a class="tab-lifted tab" class:tab-active={href === pathname} {href}
>{label}</a
>
{/each}

View file

@ -1,6 +1,5 @@
<script lang="ts">
import { iterArrayOrSingleton } from "@tricoteuses/explorer-tools"
import { SummaryView } from "augmented-data-viewer"
import type { Aggregate } from "$lib/aggregates"
import ArticleView from "$lib/components/ArticleView.svelte"

View file

@ -1,5 +1,4 @@
import assert from "assert"
import type { SerializableParameter } from "postgres"
import type { TexteVersion } from "$lib/legal"
import { db, type Version, versionNumber } from "$lib/server/database"

View file

@ -472,7 +472,7 @@ export const summarizeLienArtId: Summarizer = (access, value) => {
type: "raw_data",
},
{ class: "mt-1 mx-1", icon: arrowRight, inline: true, type: "icon" },
summarizeLienArt(access, lienArt)!,
summarizeLienArt(access, lienArt) as Summary,
],
type: "concatenation",
}
@ -528,7 +528,7 @@ export const summarizeLienSectionTaId: Summarizer = (access, value) => {
type: "raw_data",
},
{ class: "mt-1 mx-1", icon: arrowRight, inline: true, type: "icon" },
summarizeLienSectionTa(access, lienSectionTa)!,
summarizeLienSectionTa(access, lienSectionTa) as Summary,
],
type: "concatenation",
}

View file

@ -2,7 +2,7 @@ import { db } from "$lib/server/database"
import type { RequestHandler } from "./$types"
export const GET: RequestHandler = async ({ url }) => {
export const GET: RequestHandler = async () => {
const natures = (
await db<{ nature: string }[]>`
SELECT distinct nature

View file

@ -3,6 +3,7 @@
import ArticleView from "$lib/components/ArticleView.svelte"
import IdPagesSwitcher from "$lib/components/IdPagesSwitcher.svelte"
import type { Article } from "$lib/legal"
import {
summarizeAggregateProperties,
summarizeLegalObject,
@ -14,8 +15,8 @@
let showRawData = false
$: id = data.id!
$: article = data.article![id]
$: id = data.id
$: article = (data.article as { [articleId: string]: Article })[id]
$: summary = summarizeLegalObject({ key: "article" }, "article", article)
</script>

View file

@ -4,7 +4,7 @@
import { page } from "$app/stores"
import Pagination from "$lib/components/Pagination.svelte"
import type { Article, SectionTa, Textelr, TexteVersion } from "$lib/legal"
import type { TexteVersion } from "$lib/legal"
import { summarizeTexteVersionProperties } from "$lib/summaries"
import type { PageData } from "./$types"

View file

@ -6,6 +6,7 @@
import type { Follow } from "$lib/aggregates"
import IdPagesSwitcher from "$lib/components/IdPagesSwitcher.svelte"
import TexteVersionView from "$lib/components/TexteVersionView.svelte"
import type { TexteVersion } from "$lib/legal"
import { summarizeLegalObject } from "$lib/summaries"
import type { PageData } from "./$types"
@ -16,8 +17,10 @@
let showRawData = false
$: follow = data.follow
$: id = data.id!
$: texteVersion = data.texte_version![id]
$: id = data.id
$: texteVersion = (
data.texte_version as { [texteVersionId: string]: TexteVersion }
)[id]
$: url = $page.url
$: summary = summarizeLegalObject(
@ -45,8 +48,8 @@
searchParams.append("follow", aFollow)
}
goto(new URL(`${url.pathname}?${searchParams.toString()}`, url), {
keepfocus: true,
noscroll: true,
keepFocus: true,
noScroll: true,
})
}
</script>

View file

@ -62,7 +62,7 @@ async function exportEcheanciers(csvFilePath: string): Promise<void> {
}
}
}
const csvFile = await fs.writeFile(
await fs.writeFile(
csvFilePath,
Papa.unparse(data, {
columns: [

View file

@ -47,7 +47,7 @@ async function importDole(
iterXmlFiles: for (const relativeSplitPath of walkDir(dataDir)) {
const relativePath = path.join(...relativeSplitPath)
if (skip) {
if (relativePath.startsWith(resume!)) {
if (relativePath.startsWith(resume as string)) {
skip = false
console.log(`Resuming at file ${relativePath}...`)
} else {

View file

@ -22,7 +22,7 @@ import {
// jorfArticleStats,
// jorfSectionTaStats,
// joStats,
jorfTextelrStats,
// jorfTextelrStats,
// jorfTexteVersionStats,
} from "$lib/auditors/jorf"
import type {
@ -175,7 +175,7 @@ async function importJorf(
iterXmlFiles: for (const relativeSplitPath of walkDir(dataDir)) {
const relativePath = path.join(...relativeSplitPath)
if (skip) {
if (relativePath.startsWith(resume!)) {
if (relativePath.startsWith(resume as string)) {
skip = false
console.log(`Resuming at file ${relativePath}...`)
} else {

View file

@ -102,7 +102,7 @@ async function importKali(
iterXmlFiles: for (const relativeSplitPath of walkDir(dataDir)) {
const relativePath = path.join(...relativeSplitPath)
if (skip) {
if (relativePath.startsWith(resume!)) {
if (relativePath.startsWith(resume as string)) {
skip = false
console.log(`Resuming at file ${relativePath}...`)
} else {

View file

@ -160,7 +160,7 @@ async function importLegi(
iterXmlFiles: for (const relativeSplitPath of walkDir(dataDir)) {
const relativePath = path.join(...relativeSplitPath)
if (skip) {
if (relativePath.startsWith(resume!)) {
if (relativePath.startsWith(resume as string)) {
skip = false
console.log(`Resuming at file ${relativePath}...`)
} else {