Skip to content

Commit

Permalink
Update to ESLint v9
Browse files Browse the repository at this point in the history
  • Loading branch information
marnym committed Dec 8, 2024
1 parent 5b19e5d commit 28449a0
Show file tree
Hide file tree
Showing 7 changed files with 300 additions and 332 deletions.
28 changes: 0 additions & 28 deletions .eslintrc.json

This file was deleted.

4 changes: 2 additions & 2 deletions app/api/revalidate/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ export async function POST(request: NextRequest) {
}
case 'category': {
const category = body?.entry?.slug
for (const page of body?.entry?.content_pages) {
body?.entry?.content_pages?.forEach((page: PageType | undefined) =>
revalidatePath(`/${category}/${page?.slug}`)
}
)
revalidateTag('navbar')
break
}
Expand Down
3 changes: 2 additions & 1 deletion components/header/navbar/searchpage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,15 @@ const SearchOverlay = ({
const filteredFiles = resDrive?.files?.filter(
(file) => !fileResults.files?.find((f) => f.id === file.id)
)
resDrive &&
if (resDrive) {
dispatch({
type: 'SET_FILE_RESULTS',
payload: {
files: [...(fileResults.files ?? []), ...(filteredFiles || [])],
nextPageToken: resDrive.nextPageToken,
},
})
}
} else {
dispatch({
type: 'SET_FILE_RESULTS',
Expand Down
34 changes: 34 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import url from 'node:url'
import { FlatCompat } from '@eslint/eslintrc'
import eslint from '@eslint/js'
import tseslint from 'typescript-eslint'
import eslintConfigPrettier from 'eslint-config-prettier'

const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
const compat = new FlatCompat({ baseDirectory: __dirname })

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
...compat.extends('next/core-web-vitals'),
eslintConfigPrettier,
{
rules: {
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'max-len': 'off',
'no-unused-vars': 'off',
'no-console': 'off',
'func-names': 'off',
'no-process-exit': 'off',
'object-shorthand': 'off',
'class-methods-use-this': 'off',
'react/function-component-definition': [
2,
{
namedComponents: 'arrow-function',
},
],
},
}
)
7 changes: 5 additions & 2 deletions next.config.js → next.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/** @type {import('next').NextConfig} */
module.exports = {
import type { NextConfig } from 'next'

const nextConfig: NextConfig = {
reactStrictMode: true,
images: {
remotePatterns: [
Expand All @@ -16,3 +17,5 @@ module.exports = {
},
output: 'standalone',
}

export default nextConfig
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"sharp": "^0.32.6"
},
"devDependencies": {
"@eslint/js": "^9.16.0",
"@tailwindcss/typography": "^0.5.9",
"@types/content-disposition": "^0.5.6",
"@types/gapi": "^0.0.47",
Expand All @@ -42,20 +43,19 @@
"@types/react": "19.0.1",
"@types/react-textfit": "^1.1.0",
"@types/react-window": "^1.8.5",
"@typescript-eslint/eslint-plugin": "^7.9.0",
"@typescript-eslint/parser": "^7.9.0",
"autoprefixer": "^10.4.8",
"encoding": "^0.1.13",
"eslint": "8",
"eslint": "^9.16.0",
"eslint-config-next": "15.0.4",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-hooks": "^5.1.0",
"postcss": "^8.4.16",
"prettier": "^3.0.3",
"prettier-plugin-tailwindcss": "^0.5.4",
"tailwindcss": "^3.1.8",
"typescript": "5.4.5"
"typescript": "^5.7.2",
"typescript-eslint": "^8.17.0"
},
"resolutions": {
"@types/react": "19.0.1"
Expand Down
Loading

0 comments on commit 28449a0

Please sign in to comment.