1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-06-30 07:16:37 -04:00

finally bump eslint to 9.x

This commit is contained in:
2025-01-16 10:54:19 -05:00
parent 70f86283a7
commit e97613dda5
8 changed files with 1326 additions and 1188 deletions

View File

@ -1,48 +0,0 @@
/**
* @type {import("eslint").Linter.Config}
*/
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
extends: [
"@jakejarvis/eslint-config",
"next/core-web-vitals",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
],
plugins: ["@typescript-eslint", "prettier"],
rules: {
camelcase: "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-explicit-any": "warn",
"react/no-unescaped-entities": "off",
"react/jsx-boolean-value": "error",
"react/jsx-wrap-multilines": [
"error",
{
// https://github.com/jsx-eslint/eslint-plugin-react/blob/HEAD/docs/rules/jsx-wrap-multilines.md#rule-details
arrow: "parens-new-line",
assignment: "parens-new-line",
condition: "parens-new-line",
declaration: "parens-new-line",
logical: "parens-new-line",
prop: "ignore",
return: "parens-new-line",
},
],
"prettier/prettier": ["error", {}, { usePrettierrc: true }],
},
overrides: [
{
files: ["*.md", "*.mdx"],
extends: ["plugin:mdx/recommended"],
rules: {
"mdx/code-blocks": "off",
"import/no-unresolved": "off",
"react/jsx-no-undef": "off",
"react/jsx-boolean-value": "off", // TODO: causes some inconsistent parser errors in mdx
},
},
],
ignorePatterns: ["README.md"],
};

View File

@ -15,7 +15,7 @@ Run `pnpm install` to install the necessary dependencies and `pnpm dev` to start
Most production steps are handled [automatically by Vercel](https://vercel.com/docs/frameworks/nextjs), but running `pnpm build` locally will still generate an unoptimized, less-than-ideal static version which can be served via `pnpm start`. Most production steps are handled [automatically by Vercel](https://vercel.com/docs/frameworks/nextjs), but running `pnpm build` locally will still generate an unoptimized, less-than-ideal static version which can be served via `pnpm start`.
**⚡ Bonus tip:** [Volta](https://volta.sh/), a magical, blazing-fast alternative to [nvm](https://github.com/nvm-sh/nvm), is used to pin the exact Node.js version used for development. It's completely optional but I highly recommend it in general! **☝️ Note:** [pnpm](https://pnpm.io/installation#using-corepack) is highly recommended (for [many reasons!](https://pnpm.io/benchmarks)) but this project should also work just fine with NPM or Yarn.
## 🌎 Related ## 🌎 Related

View File

@ -59,7 +59,7 @@ export type HeadingProps = ComponentPropsWithoutRef<typeof H> & {
const Heading = ({ level, id, divider, children, ...rest }: HeadingProps) => { const Heading = ({ level, id, divider, children, ...rest }: HeadingProps) => {
return ( return (
<H as={`h${level}`} id={id} divider={divider || level === 2} {...rest}> <H as={`h${level}` as keyof JSX.IntrinsicElements} id={id} divider={divider || level === 2} {...rest}>
{children} {children}
{/* add anchor link to H2s and H3s. ID is either provided or automatically generated by rehype-slug. */} {/* add anchor link to H2s and H3s. ID is either provided or automatically generated by rehype-slug. */}

View File

@ -14,7 +14,7 @@ export const ThemeContext: Context<{
setTheme: (theme: string) => void; setTheme: (theme: string) => void;
}> = createContext({ }> = createContext({
activeTheme: "", activeTheme: "",
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function // eslint-disable-next-line @typescript-eslint/no-unused-vars
setTheme: (_) => {}, setTheme: (_) => {},
}); });

70
eslint.config.mjs Normal file
View File

@ -0,0 +1,70 @@
import { FlatCompat } from "@eslint/eslintrc";
import js from "@eslint/js";
import typescriptEslint from "typescript-eslint";
import prettierRecommended from "eslint-plugin-prettier/recommended";
import customConfig from "@jakejarvis/eslint-config";
import * as mdx from "eslint-plugin-mdx";
const compat = new FlatCompat({
baseDirectory: import.meta.dirname,
});
// eslint-disable-next-line import/no-anonymous-default-export
export default [
{ ignores: ["README.md", ".next", ".vercel", "node_modules"] },
js.configs.recommended,
...typescriptEslint.configs.recommended,
...compat.extends("next/core-web-vitals"),
prettierRecommended,
...customConfig,
{
rules: {
"prettier/prettier": [
"error",
{},
{
usePrettierrc: true,
},
],
},
},
{
files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
rules: {
camelcase: "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-explicit-any": "warn",
"react/no-unescaped-entities": "off",
"react/jsx-boolean-value": "error",
"react/jsx-wrap-multilines": [
"error",
{
arrow: "parens-new-line",
assignment: "parens-new-line",
condition: "parens-new-line",
declaration: "parens-new-line",
logical: "parens-new-line",
prop: "ignore",
return: "parens-new-line",
},
],
},
},
{
...mdx.flat,
processor: mdx.createRemarkProcessor({
lintCodeBlocks: false,
}),
rules: {
"mdx/remark": "warn",
"mdx/code-blocks": "off",
"react/jsx-no-undef": "off",
"react/jsx-boolean-value": "off",
"react/no-unescaped-entities": "off",
// TODO: skip these correctly
"max-len": "off",
semi: "off",
},
},
];

View File

@ -3,7 +3,6 @@
import { useCallback, useState, useRef } from "react"; import { useCallback, useState, useRef } from "react";
import type { Dispatch, SetStateAction } from "react"; import type { Dispatch, SetStateAction } from "react";
// eslint-disable-next-line @typescript-eslint/no-empty-function
const noop = () => {}; const noop = () => {};
const useLocalStorage = <T = string>( const useLocalStorage = <T = string>(

View File

@ -15,48 +15,48 @@
"dev": "next dev --turbopack -H 0.0.0.0", "dev": "next dev --turbopack -H 0.0.0.0",
"build": "next build", "build": "next build",
"start": "next start", "start": "next start",
"lint": "next lint", "lint": "next lint --no-cache",
"typecheck": "tsc", "typecheck": "tsc",
"postinstall": "prisma generate" "postinstall": "prisma generate"
}, },
"dependencies": { "dependencies": {
"@giscus/react": "^3.0.0", "@giscus/react": "^3.1.0",
"@libsql/client": "^0.8.1", "@libsql/client": "^0.8.1",
"@novnc/novnc": "1.4.0", "@novnc/novnc": "1.4.0",
"@octokit/graphql": "^8.1.1", "@octokit/graphql": "^8.1.2",
"@octokit/graphql-schema": "^15.25.0", "@octokit/graphql-schema": "^15.25.0",
"@prisma/adapter-libsql": "^5.22.0", "@prisma/adapter-libsql": "^6.2.1",
"@prisma/client": "^5.22.0", "@prisma/client": "^6.2.1",
"@react-spring/web": "^9.7.5", "@react-spring/web": "^9.7.5",
"@stitches/react": "1.3.1-1", "@stitches/react": "1.3.1-1",
"@vercel/analytics": "^1.4.1", "@vercel/analytics": "^1.4.1",
"comma-number": "^2.1.0", "comma-number": "^2.1.0",
"copy-to-clipboard": "^3.3.3", "copy-to-clipboard": "^3.3.3",
"dayjs": "^1.11.13", "dayjs": "^1.11.13",
"fast-glob": "^3.3.2", "fast-glob": "^3.3.3",
"feed": "^4.2.2", "feed": "^4.2.2",
"formik": "^2.4.6", "formik": "^2.4.6",
"gray-matter": "^4.0.3", "gray-matter": "^4.0.3",
"next": "15.0.3", "next": "15.1.4",
"next-mdx-remote": "^5.0.0", "next-mdx-remote": "^5.0.0",
"next-seo": "^6.6.0", "next-seo": "^6.6.0",
"nodemailer": "^6.9.16", "nodemailer": "^6.9.16",
"obj-str": "^1.1.0", "obj-str": "^1.1.0",
"p-map": "^7.0.2", "p-map": "^7.0.3",
"p-memoize": "^7.1.1", "p-memoize": "^7.1.1",
"polished": "^4.3.1", "polished": "^4.3.1",
"prop-types": "^15.8.1", "prop-types": "^15.8.1",
"query-string": "^9.1.1", "query-string": "^9.1.1",
"react": "18.3.1", "react": "18.3.1",
"react-dom": "18.3.1", "react-dom": "18.3.1",
"react-error-boundary": "^4.1.2", "react-error-boundary": "^5.0.0",
"react-frame-component": "^5.2.7", "react-frame-component": "^5.2.7",
"react-icons": "^5.3.0", "react-icons": "~5.3.0",
"react-innertext": "^1.1.5", "react-innertext": "^1.1.5",
"react-intersection-observer": "^9.13.1", "react-intersection-observer": "^9.15.0",
"react-is": "18.3.1", "react-is": "18.3.1",
"react-player": "^2.16.0", "react-player": "^2.16.0",
"react-textarea-autosize": "^8.5.5", "react-textarea-autosize": "^8.5.7",
"react-turnstile": "^1.1.4", "react-turnstile": "^1.1.4",
"react-tweet": "^3.2.1", "react-tweet": "^3.2.1",
"rehype-prism-plus": "^2.0.0", "rehype-prism-plus": "^2.0.0",
@ -71,34 +71,35 @@
"sitemap": "^8.0.0", "sitemap": "^8.0.0",
"stitches-normalize": "^3.0.1", "stitches-normalize": "^3.0.1",
"strip-comments": "^2.0.1", "strip-comments": "^2.0.1",
"swr": "^2.2.5", "swr": "^2.3.0",
"trim-lines": "^3.0.1", "trim-lines": "^3.0.1",
"unified": "^11.0.5" "unified": "^11.0.5"
}, },
"devDependencies": { "devDependencies": {
"@jakejarvis/eslint-config": "^3.1.0", "@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.18.0",
"@jakejarvis/eslint-config": "~4.0.7",
"@types/comma-number": "^2.1.2", "@types/comma-number": "^2.1.2",
"@types/node": "^22.9.1", "@types/node": "^22.10.7",
"@types/nodemailer": "^6.4.17", "@types/nodemailer": "^6.4.17",
"@types/novnc__novnc": "1.3.4", "@types/novnc__novnc": "1.3.4",
"@types/prop-types": "^15.7.13", "@types/prop-types": "^15.7.14",
"@types/react": "^18.3.12", "@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1", "@types/react-dom": "^18.3.1",
"@types/react-is": "^18.3.0", "@types/react-is": "^18.3.0",
"@types/strip-comments": "^2.0.4", "@types/strip-comments": "^2.0.4",
"@typescript-eslint/eslint-plugin": "^8.15.0",
"@typescript-eslint/parser": "^8.15.0",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"eslint": "~8.57.1", "eslint": "~9.18.0",
"eslint-config-next": "15.0.3", "eslint-config-next": "15.1.4",
"eslint-config-prettier": "~9.1.0", "eslint-config-prettier": "~10.0.1",
"eslint-plugin-mdx": "~3.1.5", "eslint-plugin-mdx": "~3.1.5",
"eslint-plugin-prettier": "~5.2.1", "eslint-plugin-prettier": "~5.2.2",
"lint-staged": "^15.2.10", "lint-staged": "^15.4.0",
"prettier": "^3.3.3", "prettier": "^3.4.2",
"prisma": "^5.22.0", "prisma": "^6.2.1",
"simple-git-hooks": "^2.11.1", "simple-git-hooks": "^2.11.1",
"typescript": "^5.6.3" "typescript": "^5.7.3",
"typescript-eslint": "^8.20.0"
}, },
"optionalDependencies": { "optionalDependencies": {
"sharp": "^0.33.5" "sharp": "^0.33.5"
@ -106,6 +107,7 @@
"engines": { "engines": {
"node": ">=20.x" "node": ">=20.x"
}, },
"packageManager": "pnpm@9.15.4+sha512.b2dc20e2fc72b3e18848459b37359a32064663e5627a51e4c74b2c29dd8e8e0491483c3abb40789cfd578bf362fb6ba8261b05f0387d76792ed6e23ea3b1b6a0",
"cacheDirectories": [ "cacheDirectories": [
"node_modules", "node_modules",
".next/cache" ".next/cache"
@ -117,10 +119,5 @@
"*.{js,jsx,mjs,ts,tsx,md,mdx}": [ "*.{js,jsx,mjs,ts,tsx,md,mdx}": [
"eslint" "eslint"
] ]
},
"packageManager": "pnpm@9.14.2",
"volta": {
"node": "20.18.1",
"pnpm": "9.14.2"
} }
} }

2330
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff