From 6ccbb6537e636d99501f3bf01404f9ed56c7a110 Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Sun, 7 Jan 2024 12:05:04 -0600 Subject: [PATCH] fix all linting problems --- .eslintrc.cjs | 20 +++++--------------- components/Border.tsx | 6 ------ components/ListItem.tsx | 10 ++++------ components/MDContent.tsx | 21 +++++++++------------ components/Skill.tsx | 3 +-- next.config.js | 1 - pages/_app.tsx | 14 ++++++-------- pages/index.tsx | 8 ++------ pages/notes/[id].tsx | 36 +++++++++++++++++------------------- pages/notes/index.tsx | 29 +++++++++++++---------------- pages/playground/index.tsx | 2 +- 11 files changed, 58 insertions(+), 92 deletions(-) delete mode 100644 components/Border.tsx diff --git a/.eslintrc.cjs b/.eslintrc.cjs index d41beea..11e88dd 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -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/*'] } diff --git a/components/Border.tsx b/components/Border.tsx deleted file mode 100644 index 7c93ac5..0000000 --- a/components/Border.tsx +++ /dev/null @@ -1,6 +0,0 @@ - -export function Border() { - return ( - - ) -} diff --git a/components/ListItem.tsx b/components/ListItem.tsx index 6d68f56..4f6349d 100644 --- a/components/ListItem.tsx +++ b/components/ListItem.tsx @@ -1,4 +1,4 @@ -import ExternalLinkIcon from "./ExternalLinkIcon"; +import ExternalLinkIcon from './ExternalLinkIcon' export interface ListItemProps { label: string @@ -9,7 +9,7 @@ export interface ListItemProps { export default function ListItem({ label, date, url }: ListItemProps) { return (
- + @@ -22,7 +22,6 @@ function Link({ url, label }: any) { {label} - ) } @@ -32,8 +31,7 @@ function Divider() { ) } -function Date({ date }: any) { +function Date({ date }: { date?: string }) { if (!date) return null - return {date} - + return {date} } diff --git a/components/MDContent.tsx b/components/MDContent.tsx index e31f833..2d155ee 100644 --- a/components/MDContent.tsx +++ b/components/MDContent.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React from 'react' import { useRouter } from 'next/router' export interface LinkType { @@ -15,33 +15,31 @@ function BackLinks({ linkList }: BackLinksProps) { return (

Link to this note

{(linkList != null && linkList.length > 0) - ? - <> + ? <>
{linkList.map(aLink =>
- {/**/} + {/* */}

{aLink.title}

{aLink.shortSummary}

- {/**/} + {/* */}
)}
: <>

No backlinks found

} -
); +
) } - interface MDContentProps { content: string backLinks: LinkType[] } function MDContent({ content, backLinks }: MDContentProps) { - useRouter(); + useRouter() return ( @@ -53,7 +51,7 @@ function MDContent({ content, backLinks }: MDContentProps) {

Powered by Triston, © {new Date().getFullYear()}

- ); + ) } interface BackLinksGroupProps { @@ -61,8 +59,7 @@ interface BackLinksGroupProps { } function BackLinksGroup({ links }: BackLinksGroupProps) { - - if (!links?.length) { + if (links?.length === 0) { return (

No backlinks found

) @@ -78,4 +75,4 @@ function BackLinksGroup({ links }: BackLinksGroupProps) { ) } -export default MDContent; +export default MDContent diff --git a/components/Skill.tsx b/components/Skill.tsx index ec42bb4..5822cbb 100644 --- a/components/Skill.tsx +++ b/components/Skill.tsx @@ -3,11 +3,10 @@ export interface SkillProps { link?: string } -export default function Skill({ label, link = "#" }: SkillProps) { +export default function Skill({ label, link = '#' }: SkillProps) { return ( {label} ) } - diff --git a/next.config.js b/next.config.js index c64844a..900f350 100644 --- a/next.config.js +++ b/next.config.js @@ -1,5 +1,4 @@ export function webpack(config) { config.resolve.fallback = { ...config.resolve.fallback, fs: false } - config.output = 'export' return config } diff --git a/pages/_app.tsx b/pages/_app.tsx index 09a10ac..c467b83 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -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): React.JSX.Element { const _Component: any = Component return ( <_Component {...pageProps} /> - ); + ) } diff --git a/pages/index.tsx b/pages/index.tsx index e75b2d8..83b1142 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -12,7 +12,6 @@ interface LandingProps { projects: ProjectsType[] } - export default function Landing({ jobs, skills, projects }: LandingProps) { return (
@@ -67,7 +66,6 @@ export default function Landing({ jobs, skills, projects }: LandingProps) {
-

🚧 Projects

@@ -79,7 +77,7 @@ export default function Landing({ jobs, skills, projects }: LandingProps) {
🏃 Notes - {"|"} + {'|'} 🏃 Playground
@@ -87,7 +85,7 @@ export default function Landing({ jobs, skills, projects }: LandingProps) {
-
+
@@ -164,5 +162,3 @@ export function getStaticProps(): ReturnType @@ -32,26 +31,25 @@ export default function Home({ note, backLinks, fileNames: _, tree, flattenNodes
- ); + ) } 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) + } + } } diff --git a/pages/notes/index.tsx b/pages/notes/index.tsx index d4d155c..710f777 100644 --- a/pages/notes/index.tsx +++ b/pages/notes/index.tsx @@ -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
- ); - + ) } - 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 + } + } } diff --git a/pages/playground/index.tsx b/pages/playground/index.tsx index 40cdf80..d9eaeda 100644 --- a/pages/playground/index.tsx +++ b/pages/playground/index.tsx @@ -1,4 +1,4 @@ -import Head from "next/head"; +import Head from 'next/head' export default function Home() { return (