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, auditEmptyToNull,
auditFunction, auditFunction,
auditHttpUrl, auditHttpUrl,
auditInteger,
auditNullish, auditNullish,
auditNumber, auditNumber,
auditOptions, auditOptions,

View file

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

View file

@ -674,31 +674,6 @@ function auditNota(audit: Audit, dataUnknown: unknown): [unknown, unknown] {
return audit.reduceRemaining(data, errors, remainingKeys) 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] { function auditRect(audit: Audit, dataUnknown: unknown): [unknown, unknown] {
if (dataUnknown == null) { if (dataUnknown == null) {
return [dataUnknown, null] return [dataUnknown, null]
@ -752,33 +727,6 @@ function auditSignataires(
return audit.reduceRemaining(data, errors, remainingKeys) 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] { function auditTp(audit: Audit, dataUnknown: unknown): [unknown, unknown] {
if (dataUnknown == null) { if (dataUnknown == null) {
return [dataUnknown, null] return [dataUnknown, null]

View file

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

View file

@ -12,7 +12,7 @@
{#if items !== undefined} {#if items !== undefined}
<div class="tabs"> <div class="tabs">
{#each items as { href, label }} {#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 >{label}</a
> >
{/each} {/each}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -4,7 +4,7 @@
import { page } from "$app/stores" import { page } from "$app/stores"
import Pagination from "$lib/components/Pagination.svelte" 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 { summarizeTexteVersionProperties } from "$lib/summaries"
import type { PageData } from "./$types" import type { PageData } from "./$types"

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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