Skip to content

Commit

Permalink
fix: update most code to adapt new language version
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethTrecy committed Mar 14, 2024
1 parent 939b910 commit 2bf5722
Show file tree
Hide file tree
Showing 78 changed files with 200 additions and 165 deletions.
11 changes: 10 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,14 @@ module.exports = {
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:svelte/recommended",
"whitelistyle"
]
],
"rules": {
"init-declarations": [ "off" ],
"sort-imports": [ "off" ],
"max-len": [ "off" ],
"max-lines": [ "warn" ],
"no-undefined": [ "off" ],
"no-undef-init": [ "off" ],
"@typescript-eslint/restrict-template-expressions": [ "off" ]
}
}
2 changes: 1 addition & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PlaywrightTestConfig } from "@playwright/test"
import { type PlaywrightTestConfig } from "@playwright/test"

const configuration: PlaywrightTestConfig = {
"webServer": {
Expand Down
18 changes: 11 additions & 7 deletions src/app.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
// and what to do when importing types
/*
* See https://kit.svelte.dev/docs/types#app
* for information about these interfaces
* and what to do when importing types
*/
declare namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface PageState {}
/*
* Interface Error {}
* interface Locals {}
* interface PageData {}
* interface PageState {}
*/
interface Platform {
env: {
PUBLIC_PRODUCTION_BASE_URL: string
Expand Down
2 changes: 1 addition & 1 deletion src/components/about_myself/contact_link.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { externalTypes, authorTypes } from "@/components/general/links/constants"
import { authorTypes, externalTypes } from "@/components/general/links/constants"
import Link from "@/components/general/links/base.svelte"
import BrandIcon from "@/components/general/brand_icon.svelte"
Expand Down
2 changes: 1 addition & 1 deletion src/components/general/card/article.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import type { PageMeta } from "@/types/content_metadata"
import { type PageMeta } from "@/types/content_metadata"
import { internalTypes } from "@/components/general/links/constants"
import { PUBLIC_PRODUCTION_BASE_URL } from "$env/static/public"
Expand Down
4 changes: 2 additions & 2 deletions src/components/general/card/page_detail.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script lang="ts">
import type { PageMeta } from "@/types/content_metadata"
import { type PageMeta } from "@/types/content_metadata"
import { principlesPath } from "@/constants/schema_collection"
import { internalTypes, authorTypes } from "@/components/general/links/constants"
import { authorTypes, internalTypes } from "@/components/general/links/constants"
import {
draftStatusURL,
publishedStatusURL
Expand Down
4 changes: 2 additions & 2 deletions src/components/general/common_head.svelte
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<script lang="ts">
import type { PageMeta } from "@/types/content_metadata"
import { type PageMeta } from "@/types/content_metadata"
import { dev } from "$app/environment"
import {
PUBLIC_PRODUCTION_BASE_URL,
PUBLIC_MINIMUM_TITLE_LENGTH,
PUBLIC_PRODUCTION_BASE_URL,
PUBLIC_RECOMMENDED_DESCRIPTION_LENGTH
} from "$env/static/public"
Expand Down
2 changes: 1 addition & 1 deletion src/components/general/containers/article_post.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import type { ArticlePageMeta } from "@/types/content_metadata"
import { type ArticlePageMeta } from "@/types/content_metadata"
import CommonHead from "@/components/general/common_head.svelte"
import PrimaryHeading from "@/components/general/headings/primary.svelte"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<script lang="ts">
import type { ListVariant } from "@/types/container_info"
import { type ListVariant } from "@/types/container_info"
import SimpleThing from "@/components/general/containers/simple_thing.svelte"
import StructuredListItem from "@/components/general/containers/structured_list_item.svelte"
export let itemprop: string = "itemListElement"
export let itemtype: string = "https://schema.org/ListItem"
export let itemprop = "itemListElement"
export let itemtype = "https://schema.org/ListItem"
export let variant: ListVariant = "normal"
let otherClasses: string[] = []
Expand All @@ -17,7 +17,7 @@
{itemprop}
{variant}
{itemtype}
class={[ ...initialClasses, ...otherClasses] }>
class={[ ...initialClasses, ...otherClasses ] }>
<SimpleThing itemprop="description">
<slot></slot>
</SimpleThing>
Expand Down
10 changes: 4 additions & 6 deletions src/components/general/containers/example_code.svelte
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
<script lang="ts">
import { onMount } from "svelte"
import type { CompleteCodeFileInfo } from "@/types/container_info"
import { type CompleteCodeFileInfo } from "@/types/container_info"
import ExternalLink from "@/components/general/links/external.svelte"
export let codeInfo: CompleteCodeFileInfo
export let itemprop: string = "workExample"
export let beginLineIndex: number = 0
export let endLineIndex: number = Infinity
export let itemprop = "workExample"
export let beginLineIndex = 0
export let endLineIndex = Infinity
$: rawCodeLines = (() => {
try {
Expand Down
6 changes: 3 additions & 3 deletions src/components/general/containers/example_code_part.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script lang="ts">
export let filename: string
export let rawCodeLines: string[]
export let itemprop: string = "workExample"
export let beginLineIndex: number = 0
export let endLineIndex: number = Infinity
export let itemprop = "workExample"
export let beginLineIndex = 0
export let endLineIndex = Infinity
$: targetBeginLineIndex = Math.max(0, beginLineIndex)
$: targetEndLineIndex = Math.min(rawCodeLines.length, endLineIndex)
Expand Down
5 changes: 1 addition & 4 deletions src/components/general/containers/example_command.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<script lang="ts">
import { onMount } from "svelte"
import { type ExecutedCommandSetInfo } from "@/types/container_info"
import type { ExecutedCommandSetInfo } from "@/types/container_info"
import ExternalLink from "@/components/general/links/external.svelte"
import SimpleText from "@/components/general/containers/simple_text.svelte"
export let commandInfos: ExecutedCommandSetInfo
Expand Down
4 changes: 1 addition & 3 deletions src/components/general/containers/example_output.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<script lang="ts">
import { onMount } from "svelte"
import type { CompleteCodeFileInfo, ExecutedCommandSetInfo } from "@/types/container_info"
import { type CompleteCodeFileInfo, type ExecutedCommandSetInfo } from "@/types/container_info"
import ExternalLink from "@/components/general/links/external.svelte"
import ExampleCommand from "@/components/general/containers/example_command.svelte"
Expand Down
2 changes: 1 addition & 1 deletion src/components/general/containers/keyword.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
export let otherItemprop: string = ""
export let otherItemprop = ""
export { otherItemprop as itemprop }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable max-lines-per-function */
// @vitest-environment jsdom

import type { ReferenceInfo } from "@/types/reference"
import { type ReferenceInfo } from "@/types/reference"

import { cleanup } from "@testing-library/svelte"
import { get } from "svelte/store"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ReferenceInfo } from "@/types/reference"
import { type ReferenceInfo } from "@/types/reference"

import { writable } from "svelte/store"

Expand Down
2 changes: 1 addition & 1 deletion src/components/general/containers/simple_text.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
export let otherItemprop: string = ""
export let otherItemprop = ""
export { otherItemprop as itemprop }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { browser } from "$app/environment"
import { MAIN_CONTENT_ID } from "@/constants/miscellaneous_meta"
export let itemtype: string = "https://schema.org/WebContent"
export let itemtype = "https://schema.org/WebContent"
const currentLocation = browser ? location.href : ""
</script>
Expand Down
8 changes: 4 additions & 4 deletions src/components/general/containers/structured_list.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<script lang="ts">
import type { Order, ListVariant } from "@/types/container_info"
import { type ListVariant, type Order } from "@/types/container_info"
export let order: Order
export let hasOwnScope = true
export let itemprop: string = "mainEntity"
export const itemtype: string = "https://schema.org/ItemList"
export let itemprop = "mainEntity"
export const itemtype = "https://schema.org/ItemList"
export let variant: ListVariant = "normal"
let otherClasses: string[] = []
const cardVariantClasses = [ "flex", "flex-col", "list-outside", "list-none" ]
Expand All @@ -17,7 +17,7 @@
: []
export { otherClasses as class }
$: joinedClasses = [ ...initialClasses, ...otherClasses].join(" ")
$: joinedClasses = [ ...initialClasses, ...otherClasses ].join(" ")
$: listOrder = order === "unordered"
? "https://schema.org/ItemListUnordered"
: order === "ascending"
Expand Down
8 changes: 4 additions & 4 deletions src/components/general/containers/structured_list_item.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script lang="ts">
import type { ListVariant } from "@/types/container_info"
import { type ListVariant } from "@/types/container_info"
export let itemprop: string = "itemListElement"
export let itemtype: string = "https://schema.org/ListItem"
export let itemprop = "itemListElement"
export let itemtype = "https://schema.org/ListItem"
export let variant: ListVariant = "normal"
let otherClasses: string[] = []
Expand All @@ -18,7 +18,7 @@
{itemprop}
itemscope
{itemtype}
class={[ ...initialClasses, ...otherClasses].join(" ")}>
class={[ ...initialClasses, ...otherClasses ].join(" ")}>
<slot></slot>
</li>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable max-lines-per-function */
// @vitest-environment jsdom

import type { ReferenceInfo } from "@/types/reference"
import { type ReferenceInfo } from "@/types/reference"

import { cleanup, render } from "@testing-library/svelte"
import { describe, expect, it } from "vitest"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import type { ReferenceInfo, PersonInfo, LicenseInfo } from "@/types/reference"
import { type LicenseInfo, type PersonInfo, type ReferenceInfo } from "@/types/reference"
import { internalTypes } from "@/components/general/links/constants"
Expand Down
4 changes: 2 additions & 2 deletions src/components/general/containers/structured_section.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
export let id: string|undefined = undefined
export let itemprop: string = "hasPart"
export let itemtype: string = "https://schema.org/WebContent"
export let itemprop = "hasPart"
export let itemtype = "https://schema.org/WebContent"
export let itemid: string|undefined = undefined
let otherClasses: string[] = []
Expand Down
2 changes: 1 addition & 1 deletion src/components/general/headings/base.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
export let level: number
export let fragment: string
export let mayUseBookmark: boolean = true
export let mayUseBookmark = true
let otherClasses: string[] = []
export { otherClasses as class }
Expand Down
8 changes: 4 additions & 4 deletions src/components/general/headings/primary.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// @vitest-environment jsdom

import { describe, it, expect } from "vitest"
import { render, cleanup } from "@testing-library/svelte"
import { describe, expect, it } from "vitest"
import { cleanup, render } from "@testing-library/svelte"

import Component from "./primary.svelte"

describe("Primary heading behavior", () => {
it("can render prefix as separate", async () => {
it("can render prefix as separate", async() => {
const prefix = "I. "
const { container } = render(Component, { prefix })

Expand All @@ -18,7 +18,7 @@ describe("Primary heading behavior", () => {
cleanup()
})

it("can render one span if there is no prefix", async () => {
it("can render one span if there is no prefix", async() => {
const { container } = render(Component)

const spans = container.querySelectorAll("h1 > span")
Expand Down
2 changes: 1 addition & 1 deletion src/components/general/headings/primary.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import Heading from "@/components/general/headings/base.svelte"
let otherClasses: string[] = []
export let prefix: string = ""
export let prefix = ""
export { otherClasses as class }
$: joinedClasses = [
Expand Down
4 changes: 2 additions & 2 deletions src/components/general/headings/quaternary.svelte
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<script lang="ts">
import type { HeadingInfo, SubheadingVariant } from "@/types/container_info"
import { type HeadingInfo, type SubheadingVariant } from "@/types/container_info"
import Subheading from "@/components/general/headings/subheading.svelte"
export let headingInfo: HeadingInfo<"defined">
export let variant: SubheadingVariant = "headline"
export let mayUseBookmark: boolean = true
export let mayUseBookmark = true
let otherClasses: string[] = []
export { otherClasses as class }
Expand Down
2 changes: 1 addition & 1 deletion src/components/general/headings/secondary.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import type { HeadingInfo, SubheadingVariant } from "@/types/container_info"
import { type HeadingInfo, type SubheadingVariant } from "@/types/container_info"
import Subheading from "@/components/general/headings/subheading.svelte"
export let headingInfo: HeadingInfo<"defined">
Expand Down
4 changes: 2 additions & 2 deletions src/components/general/headings/subheading.svelte
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<script lang="ts">
import type { HeadingInfo, SubheadingVariant } from "@/types/container_info"
import { type HeadingInfo, type SubheadingVariant } from "@/types/container_info"
import Heading from "@/components/general/headings/base.svelte"
export let level: number
export let variant: SubheadingVariant
export let headingInfo: HeadingInfo<"defined">
export let mayUseBookmark: boolean = true
export let mayUseBookmark = true
let otherClasses: string[] = []
export { otherClasses as class }
Expand Down
4 changes: 2 additions & 2 deletions src/components/general/headings/tertiary.svelte
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<script lang="ts">
import type { HeadingInfo, SubheadingVariant } from "@/types/container_info"
import { type HeadingInfo, type SubheadingVariant } from "@/types/container_info"
import Subheading from "@/components/general/headings/subheading.svelte"
export let headingInfo: HeadingInfo<"defined">
export let variant: SubheadingVariant = "headline"
export let mayUseBookmark: boolean = true
export let mayUseBookmark = true
let otherClasses: string[] = []
export { otherClasses as class }
Expand Down
2 changes: 1 addition & 1 deletion src/components/general/links/base.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @vitest-environment jsdom

import type { AnchorLinkType } from "@/types/container_info"
import { type AnchorLinkType } from "@/types/container_info"

import { cleanup, render } from "@testing-library/svelte"
import { describe, expect, it } from "vitest"
Expand Down
2 changes: 1 addition & 1 deletion src/components/general/links/base.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import type { AnchorTarget, AnchorLinkType } from "@/types/container_info"
import { type AnchorLinkType, type AnchorTarget } from "@/types/container_info"
export let address: string
export let relationship: AnchorLinkType|AnchorLinkType[]
Expand Down
4 changes: 2 additions & 2 deletions src/components/general/links/bound.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import ExternalLink from "@/components/general/links/external.svelte"
export let address: string
export let itemprop: string|undefined = undefined
export let itemtype: string|undefined = undefined
export let itemprop: string|undefined
export let itemtype: string|undefined
$: isInbound = address.includes(PUBLIC_PRODUCTION_BASE_URL)
$: linkComponent = isInbound ? BaseLink : ExternalLink
Expand Down
Loading

0 comments on commit 2bf5722

Please sign in to comment.