1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-12-31 17:17:46 +01:00

typing updates

This commit is contained in:
Matthias Kretschmann 2021-03-15 21:01:55 +01:00
parent a5ec31af33
commit 01e2821132
Signed by: m
GPG Key ID: 606EEEF3C479A91F
10 changed files with 96 additions and 94 deletions

82
package-lock.json generated
View File

@ -3353,9 +3353,9 @@
}
},
"@types/node": {
"version": "14.14.34",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.34.tgz",
"integrity": "sha512-dBPaxocOK6UVyvhbnpFIj2W+S+1cBTkHQbFQfeeJhoKFbzYcVUGHvddeWPSucKATb3F0+pgDq0i6ghEaZjsugA=="
"version": "14.14.35",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.35.tgz",
"integrity": "sha512-Lt+wj8NVPx0zUmUwumiVXapmaLUcAk3yPuHCFVXras9k5VT9TdhJqKqGVUQCD60OTMCl0qxJ57OiTL0Mic3Iag=="
},
"@types/node-fetch": {
"version": "2.5.8",
@ -3555,12 +3555,12 @@
"integrity": "sha512-HrCIVMLjE1MOozVoD86622S7aunluLb2PJdPfb3nYiEtohm8mIB/vyv0Fd37AdeMFrTUQXEunw78YloMA3Qilg=="
},
"@typescript-eslint/eslint-plugin": {
"version": "4.17.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.17.0.tgz",
"integrity": "sha512-/fKFDcoHg8oNan39IKFOb5WmV7oWhQe1K6CDaAVfJaNWEhmfqlA24g+u1lqU5bMH7zuNasfMId4LaYWC5ijRLw==",
"version": "4.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.18.0.tgz",
"integrity": "sha512-Lzkc/2+7EoH7+NjIWLS2lVuKKqbEmJhtXe3rmfA8cyiKnZm3IfLf51irnBcmow8Q/AptVV0XBZmBJKuUJTe6cQ==",
"requires": {
"@typescript-eslint/experimental-utils": "4.17.0",
"@typescript-eslint/scope-manager": "4.17.0",
"@typescript-eslint/experimental-utils": "4.18.0",
"@typescript-eslint/scope-manager": "4.18.0",
"debug": "^4.1.1",
"functional-red-black-tree": "^1.0.1",
"lodash": "^4.17.15",
@ -3580,50 +3580,50 @@
}
},
"@typescript-eslint/experimental-utils": {
"version": "4.17.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.17.0.tgz",
"integrity": "sha512-ZR2NIUbnIBj+LGqCFGQ9yk2EBQrpVVFOh9/Kd0Lm6gLpSAcCuLLe5lUCibKGCqyH9HPwYC0GIJce2O1i8VYmWA==",
"version": "4.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.18.0.tgz",
"integrity": "sha512-92h723Kblt9JcT2RRY3QS2xefFKar4ZQFVs3GityOKWQYgtajxt/tuXIzL7sVCUlM1hgreiV5gkGYyBpdOwO6A==",
"requires": {
"@types/json-schema": "^7.0.3",
"@typescript-eslint/scope-manager": "4.17.0",
"@typescript-eslint/types": "4.17.0",
"@typescript-eslint/typescript-estree": "4.17.0",
"@typescript-eslint/scope-manager": "4.18.0",
"@typescript-eslint/types": "4.18.0",
"@typescript-eslint/typescript-estree": "4.18.0",
"eslint-scope": "^5.0.0",
"eslint-utils": "^2.0.0"
}
},
"@typescript-eslint/parser": {
"version": "4.17.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.17.0.tgz",
"integrity": "sha512-KYdksiZQ0N1t+6qpnl6JeK9ycCFprS9xBAiIrw4gSphqONt8wydBw4BXJi3C11ywZmyHulvMaLjWsxDjUSDwAw==",
"version": "4.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.18.0.tgz",
"integrity": "sha512-W3z5S0ZbecwX3PhJEAnq4mnjK5JJXvXUDBYIYGoweCyWyuvAKfGHvzmpUzgB5L4cRBb+cTu9U/ro66dx7dIimA==",
"requires": {
"@typescript-eslint/scope-manager": "4.17.0",
"@typescript-eslint/types": "4.17.0",
"@typescript-eslint/typescript-estree": "4.17.0",
"@typescript-eslint/scope-manager": "4.18.0",
"@typescript-eslint/types": "4.18.0",
"@typescript-eslint/typescript-estree": "4.18.0",
"debug": "^4.1.1"
}
},
"@typescript-eslint/scope-manager": {
"version": "4.17.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.17.0.tgz",
"integrity": "sha512-OJ+CeTliuW+UZ9qgULrnGpPQ1bhrZNFpfT/Bc0pzNeyZwMik7/ykJ0JHnQ7krHanFN9wcnPK89pwn84cRUmYjw==",
"version": "4.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.18.0.tgz",
"integrity": "sha512-olX4yN6rvHR2eyFOcb6E4vmhDPsfdMyfQ3qR+oQNkAv8emKKlfxTWUXU5Mqxs2Fwe3Pf1BoPvrwZtwngxDzYzQ==",
"requires": {
"@typescript-eslint/types": "4.17.0",
"@typescript-eslint/visitor-keys": "4.17.0"
"@typescript-eslint/types": "4.18.0",
"@typescript-eslint/visitor-keys": "4.18.0"
}
},
"@typescript-eslint/types": {
"version": "4.17.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.17.0.tgz",
"integrity": "sha512-RN5z8qYpJ+kXwnLlyzZkiJwfW2AY458Bf8WqllkondQIcN2ZxQowAToGSd9BlAUZDB5Ea8I6mqL2quGYCLT+2g=="
"version": "4.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.18.0.tgz",
"integrity": "sha512-/BRociARpj5E+9yQ7cwCF/SNOWwXJ3qhjurMuK2hIFUbr9vTuDeu476Zpu+ptxY2kSxUHDGLLKy+qGq2sOg37A=="
},
"@typescript-eslint/typescript-estree": {
"version": "4.17.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.17.0.tgz",
"integrity": "sha512-lRhSFIZKUEPPWpWfwuZBH9trYIEJSI0vYsrxbvVvNyIUDoKWaklOAelsSkeh3E2VBSZiNe9BZ4E5tYBZbUczVQ==",
"version": "4.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.18.0.tgz",
"integrity": "sha512-wt4xvF6vvJI7epz+rEqxmoNQ4ZADArGQO9gDU+cM0U5fdVv7N+IAuVoVAoZSOZxzGHBfvE3XQMLdy+scsqFfeg==",
"requires": {
"@typescript-eslint/types": "4.17.0",
"@typescript-eslint/visitor-keys": "4.17.0",
"@typescript-eslint/types": "4.18.0",
"@typescript-eslint/visitor-keys": "4.18.0",
"debug": "^4.1.1",
"globby": "^11.0.1",
"is-glob": "^4.0.1",
@ -3642,11 +3642,11 @@
}
},
"@typescript-eslint/visitor-keys": {
"version": "4.17.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.17.0.tgz",
"integrity": "sha512-WfuMN8mm5SSqXuAr9NM+fItJ0SVVphobWYkWOwQ1odsfC014Vdxk/92t4JwS1Q6fCA/ABfCKpa3AVtpUKTNKGQ==",
"version": "4.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.18.0.tgz",
"integrity": "sha512-Q9t90JCvfYaN0OfFUgaLqByOfz8yPeTAdotn/XYNm5q9eHax90gzdb+RJ6E9T5s97Kv/UHWKERTmqA0jTKAEHw==",
"requires": {
"@typescript-eslint/types": "4.17.0",
"@typescript-eslint/types": "4.18.0",
"eslint-visitor-keys": "^2.0.0"
}
},
@ -8826,8 +8826,8 @@
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc="
},
"ethereum-blockies": {
"version": "git+ssh://git@github.com/MyEtherWallet/blockies.git#d36f87e50149aacafb34f099fe0bea1df76e010c",
"from": "ethereum-blockies@github:MyEtherWallet/blockies"
"version": "github:MyEtherWallet/blockies#d36f87e50149aacafb34f099fe0bea1df76e010c",
"from": "github:MyEtherWallet/blockies"
},
"event-emitter": {
"version": "0.3.5",
@ -17004,8 +17004,8 @@
"integrity": "sha1-lKKxYzxPExdVMAfYlm/Q6EG2pMI="
},
"nord-visual-studio-code": {
"version": "git+ssh://git@github.com/arcticicestudio/nord-visual-studio-code.git#5186990b2c8ba8cec1251d4ff3739cdab246e691",
"from": "nord-visual-studio-code@github:arcticicestudio/nord-visual-studio-code"
"version": "github:arcticicestudio/nord-visual-studio-code#5186990b2c8ba8cec1251d4ff3739cdab246e691",
"from": "github:arcticicestudio/nord-visual-studio-code"
},
"normalize-package-data": {
"version": "2.5.0",

View File

@ -92,15 +92,15 @@
"@types/jest": "^26.0.20",
"@types/loadable__component": "^5.13.3",
"@types/lunr": "^2.3.3",
"@types/node": "^14.14.34",
"@types/node": "^14.14.35",
"@types/node-fetch": "^2.5.8",
"@types/react": "^17.0.3",
"@types/react-dom": "^17.0.2",
"@types/react-helmet": "^6.1.0",
"@types/react-transition-group": "^4.4.0",
"@types/shortid": "^0.0.29",
"@typescript-eslint/eslint-plugin": "^4.17.0",
"@typescript-eslint/parser": "^4.17.0",
"@typescript-eslint/eslint-plugin": "^4.18.0",
"@typescript-eslint/parser": "^4.18.0",
"@welldone-software/why-did-you-render": "^6.1.1",
"eslint": "^7.22.0",
"eslint-config-prettier": "^8.1.0",

View File

@ -10,17 +10,19 @@ export default function Menu(): ReactElement {
const [menuOpen, setMenuOpen] = useState(false)
const { menu } = useSiteMetadata()
const toggleMenu = () => {
function toggleMenu(): void {
setMenuOpen(!menuOpen)
}
const MenuItems = menu.map((item: MenuItem) => (
<li key={item.title}>
<Link onClick={toggleMenu} to={item.link}>
{item.title}
</Link>
</li>
))
const MenuItems = menu.map(
(item: MenuItem): JSX.Element => (
<li key={item.title}>
<Link onClick={toggleMenu} to={item.link}>
{item.title}
</Link>
</li>
)
)
return (
<>

View File

@ -9,7 +9,7 @@ import {
pagination
} from './Pagination.module.css'
const PageNumber = ({
function PageNumber({
i,
slug,
current
@ -17,7 +17,7 @@ const PageNumber = ({
i: number
slug: string
current?: boolean
}) => {
}): JSX.Element {
const classes = current ? styleCurrent : styleNumber
const link = i === 0 ? slug : `${slug}page/${i + 1}`
@ -34,7 +34,7 @@ function PrevNext({
}: {
prevPagePath?: string
nextPagePath?: string
}) {
}): JSX.Element {
const link = prevPagePath || nextPagePath
const rel = prevPagePath ? 'prev' : 'next'
const title = prevPagePath ? 'Newer Posts' : 'Older Posts'

View File

@ -21,7 +21,7 @@ function postsWithDataFilter(
posts: [{ node: Post }],
key: keyof Frontmatter,
valuesToFind: string[]
) {
): { node: Post }[] {
const newArray = posts
.filter(({ node }: { node: Post }) => {
const frontmatterKey = node.frontmatter[key] as []
@ -39,7 +39,7 @@ function postsWithDataFilter(
return newArray
}
function photosWithDataFilter(posts: []) {
function photosWithDataFilter(posts: [{ node: Post }]): { node: Post }[] {
const newArray = posts
.filter((post: { node: Post }) => {
const { fileAbsolutePath } = post.node

View File

@ -2,8 +2,13 @@ import React, { ReactElement } from 'react'
import { searchButton } from './SearchButton.module.css'
import Icon from '../../atoms/Icon'
const SearchButton = (props: any): ReactElement => (
<button type="button" title="Search" className={searchButton} {...props}>
const SearchButton = ({ onClick }: { onClick: () => void }): ReactElement => (
<button
type="button"
title="Search"
className={searchButton}
onClick={onClick}
>
<Icon name="Search" />
</button>
)

View File

@ -26,7 +26,7 @@ export default function Search(): ReactElement {
)
}, [query])
const toggleSearch = () => {
function toggleSearch(): void {
setSearchOpen(!searchOpen)
}

View File

@ -17,10 +17,9 @@ const constructMessage = (
message?: { text?: string }
) =>
transactionHash
? message &&
message.text +
'<br /><br />' +
getTransactionMessage(transactionHash).transaction
? message?.text +
'<br /><br />' +
getTransactionMessage(transactionHash).transaction
: message && message.text
const classes = (status: string) =>

View File

@ -1,4 +1,4 @@
import React, { ReactElement, PureComponent } from 'react'
import React from 'react'
import { Link } from 'gatsby'
import Icon from '../atoms/Icon'
import Vcard from '../molecules/Vcard'
@ -30,13 +30,11 @@ function Copyright() {
)
}
export default class Footer extends PureComponent {
render(): ReactElement {
return (
<footer role="contentinfo" className={footer}>
<Vcard />
<Copyright />
</footer>
)
}
export default function Footer(): JSX.Element {
return (
<footer role="contentinfo" className={footer}>
<Vcard />
<Copyright />
</footer>
)
}

View File

@ -1,4 +1,4 @@
import React, { ReactElement, PureComponent } from 'react'
import React from 'react'
import { Link } from 'gatsby'
import Search from '../molecules/Search'
import Menu from '../molecules/Menu'
@ -6,24 +6,22 @@ import ThemeSwitch from '../molecules/ThemeSwitch'
import { ReactComponent as Logo } from '../../images/logo.svg'
import { header, headerContent, title, logo, nav } from './Header.module.css'
export default class Header extends PureComponent {
render(): ReactElement {
return (
<header role="banner" className={header}>
<div className={headerContent}>
<h1 className={title}>
<Link to="/">
<Logo className={logo} /> kremalicious
</Link>
</h1>
export default function Header(): JSX.Element {
return (
<header role="banner" className={header}>
<div className={headerContent}>
<h1 className={title}>
<Link to="/">
<Logo className={logo} /> kremalicious
</Link>
</h1>
<nav role="navigation" className={nav}>
<ThemeSwitch />
<Search />
<Menu />
</nav>
</div>
</header>
)
}
<nav role="navigation" className={nav}>
<ThemeSwitch />
<Search />
<Menu />
</nav>
</div>
</header>
)
}