fix all linting problems

This commit is contained in:
Triston Armstrong 2024-01-07 12:05:04 -06:00
parent 3ee2eed96e
commit 6ccbb6537e
11 changed files with 58 additions and 92 deletions

View File

@ -12,13 +12,8 @@ module.exports = {
], ],
overrides: [ overrides: [
{ {
env: { env: { node: true },
node: true files: ['*.ts', '*.tsx'],
},
files: [
'*.ts', '*.tsx'
],
excludeFiles: ['*.js', '*.jsx'],
parserOptions: { parserOptions: {
sourceType: 'script' sourceType: 'script'
} }
@ -46,13 +41,8 @@ module.exports = {
'@typescript-eslint/space-before-function-paren': 'off', '@typescript-eslint/space-before-function-paren': 'off',
'@typescript-eslint/explicit-function-return-type': 'warn', '@typescript-eslint/explicit-function-return-type': 'warn',
'@typescript-eslint/no-extraneous-class': 'off', '@typescript-eslint/no-extraneous-class': 'off',
'@typescript-eslint/strict-boolean-expressions': [ '@typescript-eslint/no-explicit-any': 'off',
2, '@typescript-eslint/strict-boolean-expressions': 'off'
{
allowString: false,
allowNumber: false
}
]
}, },
ignorePatterns: ['src/**/*.test.ts', 'src/frontend/generated/*'] ignorePatterns: ['**/*.js*', 'src/**/*.test.ts', 'src/frontend/generated/*']
} }

View File

@ -1,6 +0,0 @@
export function Border() {
return (
<span className={``}></span>
)
}

View File

@ -1,4 +1,4 @@
import ExternalLinkIcon from "./ExternalLinkIcon"; import ExternalLinkIcon from './ExternalLinkIcon'
export interface ListItemProps { export interface ListItemProps {
label: string label: string
@ -9,7 +9,7 @@ export interface ListItemProps {
export default function ListItem({ label, date, url }: ListItemProps) { export default function ListItem({ label, date, url }: ListItemProps) {
return ( return (
<div className="flex-row flex-between y-bottom gap-1"> <div className="flex-row flex-between y-bottom gap-1">
<Link {...{ url, label }} /> <Link {...{ url, label }} />
<Divider /> <Divider />
<Date {...{ date }} /> <Date {...{ date }} />
<ExternalLinkIcon /> <ExternalLinkIcon />
@ -22,7 +22,6 @@ function Link({ url, label }: any) {
<a href={url} target="_blank"> <a href={url} target="_blank">
{label} {label}
</a> </a>
) )
} }
@ -32,8 +31,7 @@ function Divider() {
) )
} }
function Date({ date }: any) { function Date({ date }: { date?: string }) {
if (!date) return null if (!date) return null
return <i className="font-muted" >{date}</i> return <i className="font-muted" >{date}</i>
} }

View File

@ -1,4 +1,4 @@
import React from 'react'; import React from 'react'
import { useRouter } from 'next/router' import { useRouter } from 'next/router'
export interface LinkType { export interface LinkType {
@ -15,33 +15,31 @@ function BackLinks({ linkList }: BackLinksProps) {
return (<div className=""> return (<div className="">
<h3 className="">Link to this note</h3> <h3 className="">Link to this note</h3>
{(linkList != null && linkList.length > 0) {(linkList != null && linkList.length > 0)
? ? <>
<>
<div className=""> <div className="">
{linkList.map(aLink => {linkList.map(aLink =>
<div key={aLink.slug} className=""> <div key={aLink.slug} className="">
{/*<Link href={aLink.slug}>*/} {/* <Link href={aLink.slug}> */}
<a href={aLink.slug}> <a href={aLink.slug}>
<p className="">{aLink.title}</p> <p className="">{aLink.title}</p>
<p className="">{aLink.shortSummary} </p> <p className="">{aLink.shortSummary} </p>
</a> </a>
{/*</Link>*/} {/* </Link> */}
</div> </div>
)} )}
</div> </div>
</> </>
: <> <p className=""> No backlinks found</p> </>} : <> <p className=""> No backlinks found</p> </>}
</div>); </div>)
} }
interface MDContentProps { interface MDContentProps {
content: string content: string
backLinks: LinkType[] backLinks: LinkType[]
} }
function MDContent({ content, backLinks }: MDContentProps) { function MDContent({ content, backLinks }: MDContentProps) {
useRouter(); useRouter()
return ( return (
@ -53,7 +51,7 @@ function MDContent({ content, backLinks }: MDContentProps) {
<p>Powered by <a href="https://gitlab.com/Tarmstrong95">Triston</a>, © {new Date().getFullYear()}</p> <p>Powered by <a href="https://gitlab.com/Tarmstrong95">Triston</a>, © {new Date().getFullYear()}</p>
</footer> </footer>
</div> </div>
); )
} }
interface BackLinksGroupProps { interface BackLinksGroupProps {
@ -61,8 +59,7 @@ interface BackLinksGroupProps {
} }
function BackLinksGroup({ links }: BackLinksGroupProps) { function BackLinksGroup({ links }: BackLinksGroupProps) {
if (links?.length === 0) {
if (!links?.length) {
return ( return (
<p className=""> No backlinks found</p> <p className=""> No backlinks found</p>
) )
@ -78,4 +75,4 @@ function BackLinksGroup({ links }: BackLinksGroupProps) {
) )
} }
export default MDContent; export default MDContent

View File

@ -3,11 +3,10 @@ export interface SkillProps {
link?: string link?: string
} }
export default function Skill({ label, link = "#" }: SkillProps) { export default function Skill({ label, link = '#' }: SkillProps) {
return ( return (
<a href={link} target="_blank" style={{ textDecoration: 'none !important' }}> <a href={link} target="_blank" style={{ textDecoration: 'none !important' }}>
{label} {label}
</a> </a>
) )
} }

View File

@ -1,5 +1,4 @@
export function webpack(config) { export function webpack(config) {
config.resolve.fallback = { ...config.resolve.fallback, fs: false } config.resolve.fallback = { ...config.resolve.fallback, fs: false }
config.output = 'export'
return config return config
} }

View File

@ -1,14 +1,12 @@
import "../styles/global.css"; import '../styles/global.css'
import "../styles/prism.css"; import '../styles/prism.css'
import type { AppProps } from "next/app"; import type { AppProps } from 'next/app'
import type { HomeProps } from "./notes"; import type { HomeProps } from './notes'
import type React from "react"; import React from 'react'
export default function App({ Component, pageProps }: AppProps<HomeProps>): React.JSX.Element { export default function App({ Component, pageProps }: AppProps<HomeProps>): React.JSX.Element {
const _Component: any = Component const _Component: any = Component
return ( return (
<_Component {...pageProps} /> <_Component {...pageProps} />
); )
} }

View File

@ -12,7 +12,6 @@ interface LandingProps {
projects: ProjectsType[] projects: ProjectsType[]
} }
export default function Landing({ jobs, skills, projects }: LandingProps) { export default function Landing({ jobs, skills, projects }: LandingProps) {
return ( return (
<div> <div>
@ -67,7 +66,6 @@ export default function Landing({ jobs, skills, projects }: LandingProps) {
</div> </div>
</section> </section>
<section> <section>
<h4>🚧 Projects</h4> <h4>🚧 Projects</h4>
<div className='flex-col'> <div className='flex-col'>
@ -79,7 +77,7 @@ export default function Landing({ jobs, skills, projects }: LandingProps) {
<footer className='flex-col flex-between gap-1 mt-4 '> <footer className='flex-col flex-between gap-1 mt-4 '>
<div className='flex-row gap-1'> <div className='flex-row gap-1'>
<a href="/notes" target="_blank" className='text-md font-muted font-bold'>🏃 Notes</a> <a href="/notes" target="_blank" className='text-md font-muted font-bold'>🏃 Notes</a>
{"|"} {'|'}
<a href="/playground" target="_blank" className='text-md font-muted font-bold'>🏃 Playground</a> <a href="/playground" target="_blank" className='text-md font-muted font-bold'>🏃 Playground</a>
</div> </div>
@ -87,7 +85,7 @@ export default function Landing({ jobs, skills, projects }: LandingProps) {
<UsefulLinksList /> <UsefulLinksList />
</div> </div>
<div style={{ margin: "10px 0" }} /> <div style={{ margin: '10px 0' }} />
<div className='flex-row flex-between '> <div className='flex-row flex-between '>
<div className='flex-row gap-1'> <div className='flex-row gap-1'>
@ -164,5 +162,3 @@ export function getStaticProps(): ReturnType<GetStaticProps<{
type SkillsType = SkillProps type SkillsType = SkillProps
type JobsType = JobProps type JobsType = JobProps
type ProjectsType = ListItemProps type ProjectsType = ListItemProps

View File

@ -1,10 +1,10 @@
import Head from "next/head"; import Head from 'next/head'
import Layout from "components/Layout"; import Layout from 'components/Layout'
import Util from "lib/utils" import Util from 'lib/utils'
import FolderTree from "components/FolderTree"; import FolderTree from 'components/FolderTree'
import MDContent, { type LinkType } from "components/MDContent"; import MDContent, { type LinkType } from 'components/MDContent'
import type { GetStaticProps } from "next/types"; import type { GetStaticProps } from 'next/types'
import type { ParsedUrlQuery } from "querystring"; import type { ParsedUrlQuery } from 'querystring'
interface HomeProps { interface HomeProps {
note: { title: string, data: string } note: { title: string, data: string }
@ -16,7 +16,6 @@ interface HomeProps {
} }
export default function Home({ note, backLinks, fileNames: _, tree, flattenNodes }: HomeProps) { export default function Home({ note, backLinks, fileNames: _, tree, flattenNodes }: HomeProps) {
return ( return (
<Layout> <Layout>
<Head> <Head>
@ -32,26 +31,25 @@ export default function Home({ note, backLinks, fileNames: _, tree, flattenNodes
<MDContent content={note.data} backLinks={backLinks} /> <MDContent content={note.data} backLinks={backLinks} />
</div> </div>
</Layout> </Layout>
); )
} }
export async function getStaticPaths() { export async function getStaticPaths() {
const allPostsData = Util.getAllSlugs(); const allPostsData = Util.getAllSlugs()
const paths = allPostsData.map(p => ({ params: { id: p } })) const paths = allPostsData.map(p => ({ params: { id: p } }))
return { return {
paths, paths,
fallback: false fallback: false
}; }
} }
export const getStaticProps: GetStaticProps = (context) => { export const getStaticProps: GetStaticProps = (context) => {
const { nodes, edges }: { nodes: unknown[], edges: unknown[] } = Util.constructGraphData() const { nodes, edges }: { nodes: unknown[], edges: unknown[] } = Util.constructGraphData()
const { id } = context.params as ParsedUrlQuery & { id: string } const { id } = context.params as ParsedUrlQuery & { id: string }
const note = Util.getSinglePost(id); const note = Util.getSinglePost(id)
const tree = Util.convertObject(Util.getDirectoryData()); const tree = Util.convertObject(Util.getDirectoryData())
const flattenNodes = Util.getFlattenArray(tree) const flattenNodes = Util.getFlattenArray(tree)
const listOfEdges: unknown[] = edges.filter(anEdge => (anEdge as { target: string }).target === id) const listOfEdges: unknown[] = edges.filter(anEdge => (anEdge as { target: string }).target === id)
@ -60,9 +58,9 @@ export const getStaticProps: GetStaticProps = (context) => {
return { return {
props: { props: {
note, note,
tree: tree, tree,
flattenNodes: flattenNodes, flattenNodes,
backLinks: backLinks.filter((link) => (link as { slug: string }).slug !== id), backLinks: backLinks.filter((link) => (link as { slug: string }).slug !== id)
}, }
}; }
} }

View File

@ -1,9 +1,8 @@
import Layout from "components/Layout"; import Layout from 'components/Layout'
import Util from 'lib/utils' import Util from 'lib/utils'
import FolderTree from "components/FolderTree"; import FolderTree from 'components/FolderTree'
import MDContent, { type LinkType } from "components/MDContent"; import MDContent, { type LinkType } from 'components/MDContent'
import Head from "next/head"; import Head from 'next/head'
export interface HomeProps { export interface HomeProps {
content: string content: string
@ -26,19 +25,17 @@ export default function Home({ content, tree, flattenNodes, backLinks }: HomePro
<MDContent content={content} backLinks={backLinks} /> <MDContent content={content} backLinks={backLinks} />
</div> </div>
</Layout > </Layout >
); )
} }
export function getStaticProps() { export function getStaticProps() {
const { nodes, edges }: { nodes: unknown[], edges: unknown[] } = Util.constructGraphData() const { nodes, edges }: { nodes: unknown[], edges: unknown[] } = Util.constructGraphData()
const tree = Util.convertObject(Util.getDirectoryData()); const tree = Util.convertObject(Util.getDirectoryData())
const contentData = Util.getSinglePost("index"); const contentData = Util.getSinglePost('index')
const flattenNodes = Util.getFlattenArray(tree) const flattenNodes = Util.getFlattenArray(tree)
const listOfEdges = edges const listOfEdges = edges
.filter((anEdge) => ( .filter((anEdge) => (
anEdge as { target: string }).target === "index" anEdge as { target: string }).target === 'index'
) )
const internalLinks = listOfEdges.map( const internalLinks = listOfEdges.map(
anEdge => nodes anEdge => nodes
@ -52,9 +49,9 @@ export function getStaticProps() {
return { return {
props: { props: {
content: contentData.data, content: contentData.data,
tree: tree, tree,
flattenNodes: flattenNodes, flattenNodes,
backLinks: backLinks backLinks
}, }
}; }
} }

View File

@ -1,4 +1,4 @@
import Head from "next/head"; import Head from 'next/head'
export default function Home() { export default function Home() {
return ( return (