Skip to content

Commit

Permalink
Refactor ESLint Config, Update Dependencies, and Enhance React Compon…
Browse files Browse the repository at this point in the history
…ents (#27)

* Bump sort-package-json from 2.11.0 to 2.12.0

Bumps [sort-package-json](https://github.com/keithamus/sort-package-json) from 2.11.0 to 2.12.0.
- [Release notes](https://github.com/keithamus/sort-package-json/releases)
- [Commits](keithamus/sort-package-json@v2.11.0...v2.12.0)

---
updated-dependencies:
- dependency-name: sort-package-json
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* chore: add Vercel Speed Insights

* chore: upgrade eslint to 9.15

* chore: update license

* chore: add Vercel Speed Insights to Pagee.tsx

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
ggfevans and dependabot[bot] authored Nov 24, 2024
1 parent 81daf49 commit 0354b21
Show file tree
Hide file tree
Showing 9 changed files with 265 additions and 148 deletions.
74 changes: 0 additions & 74 deletions .eslintrc

This file was deleted.

1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
MIT License

Copyright (c) 2021 Tim Baker
Copyright (c) 2024 Gareth Evans - Modified version

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
107 changes: 107 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import simpleImportSort from "eslint-plugin-simple-import-sort";
import _import from "eslint-plugin-import";
import react from "eslint-plugin-react";
import reactMemo from "eslint-plugin-react-memo";
import reactHooks from "eslint-plugin-react-hooks";
import { fixupPluginRules } from "@eslint/compat";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [{
ignores: ["*/public", "*/node_modules/*", "*/.next/*", "*/dist/*"],
}, ...compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@next/next/recommended",
"prettier",
), {
plugins: {
"@typescript-eslint": typescriptEslint,
"simple-import-sort": simpleImportSort,
import: fixupPluginRules(_import),
react,
"react-memo": reactMemo,
"react-hooks": fixupPluginRules(reactHooks),
},

languageOptions: {
parser: tsParser,
ecmaVersion: 2020,
sourceType: "module",

parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},

settings: {
react: {
pragma: "React",
version: "detect",
},
},

rules: {
"react/display-name": "off",
"react-memo/require-usememo": "error",
"react-memo/require-memo": "error",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "error",
"@typescript-eslint/explicit-function-return-type": "off",

"@typescript-eslint/member-ordering": ["warn", {
interfaces: ["signature", "method", "constructor", "field"],
typeLiterals: ["signature", "method", "constructor", "field"],
}],

"import/first": "error",
"import/newline-after-import": "error",
"import/no-duplicates": "error",
"import/order": "off",
"no-irregular-whitespace": "off",

"@typescript-eslint/no-unused-vars": ["warn", {
argsIgnorePattern: "^_",
}],

"object-curly-spacing": ["error", "never"],
"react/jsx-curly-brace-presence": [2, "never"],
"react/jsx-no-duplicate-props": "error",
"react/jsx-sort-props": "error",
"react/react-in-jsx-scope": "off",
"react/no-unescaped-entities": "off",
"simple-import-sort/exports": "error",
"simple-import-sort/imports": "error",
"sort-imports": "off",
"jsx-a11y/no-onchange": "off",
"jsx-a11y/no-autofocus": "off",
"@next/next/no-img-element": "off",
},
}, {
files: ["**/*.tsx"],

rules: {
"react/prop-types": "off",
},
}, {
files: ["**/*.js"],

rules: {
"@typescript-eslint/no-var-requires": "off",
},
}];
17 changes: 10 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,33 @@
"dependencies": {
"@headlessui/react": "^2.2.0",
"@heroicons/react": "^2.2.0",
"@testing-library/dom": "^10.0.0",
"@vercel/analytics": "^1.4.1",
"autoprefixer": "10.4.20",
"@vercel/speed-insights": "^1.1.0",
"classnames": "^2.5.1",
"glob": "^11.0.0",
"next": "^15.0.3",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"sharp": "^0.33.5",
"ts-pattern": "^5.5.0"
},
"devDependencies": {
"@eslint/compat": "^1.2.3",
"@eslint/config-array": "^0.19.0",
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.15.0",
"@eslint/object-schema": "^2.1.4",
"@next/eslint-plugin-next": "^15.0.3",
"@tailwindcss/forms": "^0.5.9",
"@tailwindcss/typography": "^0.5.15",
"@testing-library/react": "^16.0.1",
"@types/node": "^22.9.3",
"@types/react": "^18.3.12",
"@types/tailwindcss": "^3.1.0",
"@types/webpack-env": "^1.18.5",
"@typescript-eslint/eslint-plugin": "^8.15.0",
"@typescript-eslint/parser": "^8.15.0",
"autoprefixer": "10.4.20",
"cssnano": "^7.0.6",
"eslint": "^9.15.0",
"eslint-config-next": "^15.0.3",
Expand All @@ -47,7 +54,6 @@
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-memo": "^0.0.3",
"eslint-plugin-react-native": "^4.0.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-sort-keys-fix": "^1.1.2",
"jest": "^29.7.0",
Expand All @@ -56,16 +62,13 @@
"prettier": "^3.3.3",
"prettier-plugin-tailwindcss": "^0.6.9",
"sass": "^1.81.0",
"sort-package-json": "^2.11.0",
"sort-package-json": "^2.12.0",
"stylelint": "^16.10.0",
"stylelint-config-recommended": "^14.0.1",
"stylelint-order": "^6.0.4",
"stylelint-prettier": "^5.0.2",
"tailwindcss": "^3.4.15",
"ts-jest": "^29.2.5",
"typescript": "^5.7.2"
},
"resolutions": {
"autoprefixer": "10.4.16"
}
}
2 changes: 2 additions & 0 deletions src/components/Layout/Page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {Analytics} from '@vercel/analytics/react';
import {SpeedInsights} from "@vercel/speed-insights/next"
import {NextPage} from 'next';
import Head from 'next/head';
import {useRouter} from 'next/router';
Expand Down Expand Up @@ -29,6 +30,7 @@ const Page: NextPage<PropsWithChildren<HomepageMeta>> = memo(({children, title,
<meta content={`https://gvns.ca${pathname}`} property="og:url" />
</Head>
{children}
<SpeedInsights />
<Analytics />
</>
);
Expand Down
8 changes: 5 additions & 3 deletions src/components/Sections/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import {FC, memo} from 'react';
import {SectionId} from '../../data/data';
import Socials from '../Socials';

const currentDate =new Date();
const currentDate = new Date();
const currentYear = currentDate.getFullYear();
const currentDay = currentDate.getDay();
const weekDay = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
const weekDay = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
const currentDayOfWeek = weekDay[currentDay];

const Footer: FC = memo(() => (
Expand All @@ -23,7 +23,9 @@ const Footer: FC = memo(() => (
<div className="flex gap-x-4 text-neutral-500">
<Socials />
</div>
<span className="text-sm text-neutral-700" suppressHydrationWarning>© Copyright {currentYear} Gareth Evans and it's {currentDayOfWeek}, my dude</span>
<span className="text-sm text-neutral-700" suppressHydrationWarning>
© Copyright {currentYear} Gareth Evans and it's {currentDayOfWeek}, my dude
</span>
</div>
</div>
));
Expand Down
2 changes: 1 addition & 1 deletion src/components/Sections/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const MobileNav: FC<{navSections: SectionId[]; currentSection: SectionId | null}
aria-label="Menu Button"
className="fixed top-2 right-2 z-40 rounded-md bg-green-500 p-2 ring-offset-gray-800/60 hover:bg-green-400 focus:outline-none focus:ring-0 focus-visible:ring-2 focus-visible:ring-green-500 focus-visible:ring-offset-2 sm:hidden"
onClick={toggleOpen}
title = "Menu Button">
title="Menu Button">
<Bars3BottomRightIcon className="h-8 w-8 text-white" />
<span className="sr-only">Open sidebar</span>
</button>
Expand Down
6 changes: 4 additions & 2 deletions src/components/Sections/Testimonials.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,12 @@ const Testimonials: FC = memo(() => {
{[...Array(testimonials.length)].map((_, index) => {
const isActive = index === activeIndex;
return (
<button className={classNames(
<button
className={classNames(
'h-3 w-3 rounded-full bg-gray-300 transition-all duration-500 sm:h-4 sm:w-4',
isActive ? 'scale-100 opacity-100' : 'scale-75 opacity-60',
)} disabled={isActive}
)}
disabled={isActive}
key={`select-button-${index}`}
onClick={setTestimonial(index)}
title="classnames"></button>
Expand Down
Loading

1 comment on commit 0354b21

@vercel
Copy link

@vercel vercel bot commented on 0354b21 Nov 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.