fix: 修复 eslint 报错

This commit is contained in:
LooseLi
2025-05-27 10:06:47 +08:00
parent 3366dd4a6c
commit 84236f3cff
12 changed files with 29 additions and 22 deletions

View File

@@ -6,7 +6,7 @@ import algoliasearch from 'algoliasearch'
* 生成全文索引
* @param {*} allPages
*/
const generateAlgoliaSearch = async ({ allPages, force = false }) => {
const generateAlgoliaSearch = ({ allPages, force = false }) => {
allPages?.forEach(p => {
// 判断这篇文章是否需要重新创建索引
if (p && !p.password) {

View File

@@ -1,15 +1,19 @@
import BLOG from '@/blog.config'
/**
* 订阅邮件-服务端接口
* @param {*} email
* @returns
*/
export default function subscribeToMailchimpApi({ email, first_name = '', last_name = '' }) {
* 订阅邮件-服务端接口
* @param {*} email
* @returns
*/
export default function subscribeToMailchimpApi({
email,
first_name = '',
last_name = ''
}) {
const listId = BLOG.MAILCHIMP_LIST_ID // 替换为你的邮件列表 ID
const apiKey = BLOG.MAILCHIMP_API_KEY // 替换为你的 API KEY
if (!email || !listId || !apiKey) {
return {}
return Promise.resolve({})
}
const data = {
email_address: email,

View File

@@ -1,6 +1,6 @@
import fs from 'fs'
export async function generateRobotsTxt(props) {
export function generateRobotsTxt(props) {
const { siteInfo } = props
const LINK = siteInfo?.link
const content = `

View File

@@ -5,7 +5,7 @@ import { siteConfig } from './config'
* 生成站点地图
* @param {*} param0
*/
export async function generateSitemapXml({ allPages, NOTION_CONFIG }) {
export function generateSitemapXml({ allPages, NOTION_CONFIG }) {
let link = siteConfig('LINK', BLOG.LINK, NOTION_CONFIG)
// 确保链接不以斜杠结尾
if (link && link.endsWith('/')) {

View File

@@ -64,7 +64,7 @@ const noAuthMiddleware = async (req: NextRequest, ev: any) => {
* 鉴权中间件
*/
const authMiddleware = process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
? clerkMiddleware(async (auth, req) => {
? clerkMiddleware((auth, req) => {
const { userId } = auth()
// 处理 /dashboard 路由的登录保护
if (isTenantRoute(req)) {

View File

@@ -117,7 +117,7 @@ const nextConfig = {
// 默认将feed重定向至 /public/rss/feed.xml
redirects: process.env.EXPORT
? undefined
: async () => {
: () => {
return [
{
source: '/feed',
@@ -129,7 +129,7 @@ const nextConfig = {
// 重写url
rewrites: process.env.EXPORT
? undefined
: async () => {
: () => {
// 处理多语言重定向
const langsRewrites = []
if (BLOG.NOTION_PAGE_ID.indexOf(',') > 0) {
@@ -176,7 +176,7 @@ const nextConfig = {
},
headers: process.env.EXPORT
? undefined
: async () => {
: () => {
return [
{
source: '/:path*{/}?',
@@ -217,7 +217,7 @@ const nextConfig = {
experimental: {
scrollRestoration: true
},
exportPathMap: async function (
exportPathMap: function (
defaultPathMap,
{ dev, dir, outDir, distDir, buildId }
) {

View File

@@ -62,7 +62,10 @@ export default async function handler(
}
// 这里将用户数据写入到Notion数据库
res.redirect(302, `/auth/result?${new URLSearchParams(redirectQuery)}`)
res.redirect(
302,
`/auth/result?${new URLSearchParams(redirectQuery).toString()}`
)
} else {
const redirectQuery = { msg: params?.statusText || '请求异常' }
res.redirect(

View File

@@ -71,7 +71,7 @@ export async function getStaticProps({ locale }) {
}
}
export const getStaticPaths = async () => {
export const getStaticPaths = () => {
return {
paths: [
{ params: { index: [] } }, // 对应首页路径

View File

@@ -51,7 +51,7 @@ export async function getStaticProps({ params: { keyword }, locale }) {
}
}
export async function getStaticPaths() {
export function getStaticPaths() {
return {
paths: [{ params: { keyword: 'NotionNext' } }],
fallback: true
@@ -128,7 +128,7 @@ async function filterByMemCache(allPosts, keyword) {
// console.log('全文搜索缓存', cacheKey, page != null)
post.results = []
let hitCount = 0
for (const i in indexContent) {
for (const i of indexContent) {
const c = indexContent[i]
if (!c) {
continue

View File

@@ -50,7 +50,7 @@ export async function getStaticProps({ params: { keyword, page }, locale }) {
}
}
export async function getStaticPaths() {
export function getStaticPaths() {
return {
paths: [{ params: { keyword: 'NotionNext', page: '1' } }],
fallback: true
@@ -135,7 +135,7 @@ async function filterByMemCache(allPosts, keyword) {
// console.log('全文搜索缓存', cacheKey, page != null)
post.results = []
let hitCount = 0
for (const i in indexContent) {
for (const i of indexContent) {
const c = indexContent[i]
if (!c) {
continue

View File

@@ -37,7 +37,7 @@ export async function getStaticProps(req) {
* catch-all route for clerk
* @returns
*/
export async function getStaticPaths() {
export function getStaticPaths() {
return {
paths: [
{ params: { index: [] } }, // 使 /sign-in 路径可访问

View File

@@ -36,7 +36,7 @@ export async function getStaticProps(req) {
* catch-all route for clerk
* @returns
*/
export async function getStaticPaths() {
export function getStaticPaths() {
return {
paths: [
{ params: { index: [] } }, // 使 /sign-up 路径可访问