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: [
{
env: {
node: true
},
files: [
'*.ts', '*.tsx'
],
excludeFiles: ['*.js', '*.jsx'],
env: { node: true },
files: ['*.ts', '*.tsx'],
parserOptions: {
sourceType: 'script'
}
@ -46,13 +41,8 @@ module.exports = {
'@typescript-eslint/space-before-function-paren': 'off',
'@typescript-eslint/explicit-function-return-type': 'warn',
'@typescript-eslint/no-extraneous-class': 'off',
'@typescript-eslint/strict-boolean-expressions': [
2,
{
allowString: false,
allowNumber: false
}
]
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/strict-boolean-expressions': 'off'
},
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 {
label: string
@ -22,7 +22,6 @@ function Link({ url, label }: any) {
<a href={url} target="_blank">
{label}
</a>
)
}
@ -32,8 +31,7 @@ function Divider() {
)
}
function Date({ date }: any) {
function Date({ date }: { date?: string }) {
if (!date) return null
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'
export interface LinkType {
@ -15,8 +15,7 @@ function BackLinks({ linkList }: BackLinksProps) {
return (<div className="">
<h3 className="">Link to this note</h3>
{(linkList != null && linkList.length > 0)
?
<>
? <>
<div className="">
{linkList.map(aLink =>
<div key={aLink.slug} className="">
@ -31,17 +30,16 @@ function BackLinks({ linkList }: BackLinksProps) {
</div>
</>
: <> <p className=""> No backlinks found</p> </>}
</div>);
</div>)
}
interface MDContentProps {
content: string
backLinks: LinkType[]
}
function MDContent({ content, backLinks }: MDContentProps) {
useRouter();
useRouter()
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>
</footer>
</div>
);
)
}
interface BackLinksGroupProps {
@ -61,8 +59,7 @@ interface BackLinksGroupProps {
}
function BackLinksGroup({ links }: BackLinksGroupProps) {
if (!links?.length) {
if (links?.length === 0) {
return (
<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
}
export default function Skill({ label, link = "#" }: SkillProps) {
export default function Skill({ label, link = '#' }: SkillProps) {
return (
<a href={link} target="_blank" style={{ textDecoration: 'none !important' }}>
{label}
</a>
)
}

View File

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

View File

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

View File

@ -12,7 +12,6 @@ interface LandingProps {
projects: ProjectsType[]
}
export default function Landing({ jobs, skills, projects }: LandingProps) {
return (
<div>
@ -67,7 +66,6 @@ export default function Landing({ jobs, skills, projects }: LandingProps) {
</div>
</section>
<section>
<h4>🚧 Projects</h4>
<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 '>
<div className='flex-row gap-1'>
<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>
</div>
@ -87,7 +85,7 @@ export default function Landing({ jobs, skills, projects }: LandingProps) {
<UsefulLinksList />
</div>
<div style={{ margin: "10px 0" }} />
<div style={{ margin: '10px 0' }} />
<div className='flex-row flex-between '>
<div className='flex-row gap-1'>
@ -164,5 +162,3 @@ export function getStaticProps(): ReturnType<GetStaticProps<{
type SkillsType = SkillProps
type JobsType = JobProps
type ProjectsType = ListItemProps

View File

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

View File

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