Unverified Commit 69d42ae9 authored by Bowen Liang's avatar Bowen Liang Committed by GitHub

fix: cover missed source paths for eslint (#1956)

parent 5ff701ca
...@@ -10,20 +10,21 @@ export type WorkspacesContextValue = { ...@@ -10,20 +10,21 @@ export type WorkspacesContextValue = {
} }
const WorkspacesContext = createContext<WorkspacesContextValue>({ const WorkspacesContext = createContext<WorkspacesContextValue>({
workspaces: [] workspaces: [],
}) })
interface IWorkspaceProviderProps { type IWorkspaceProviderProps = {
children: React.ReactNode children: React.ReactNode
} }
export const WorkspaceProvider = ({ export const WorkspaceProvider = ({
children children,
}: IWorkspaceProviderProps) => { }: IWorkspaceProviderProps) => {
const { data } = useSWR({ url: '/workspaces' }, fetchWorkspaces) const { data } = useSWR({ url: '/workspaces' }, fetchWorkspaces)
return ( return (
<WorkspacesContext.Provider value={{ <WorkspacesContext.Provider value={{
workspaces: data?.workspaces || [] workspaces: data?.workspaces || [],
}}> }}>
{children} {children}
</WorkspacesContext.Provider> </WorkspacesContext.Provider>
......
This diff is collapsed.
import { createInstance } from 'i18next' import { createInstance } from 'i18next'
import resourcesToBackend from 'i18next-resources-to-backend' import resourcesToBackend from 'i18next-resources-to-backend'
import { initReactI18next } from 'react-i18next/initReactI18next' import { initReactI18next } from 'react-i18next/initReactI18next'
import { Locale } from '.' import type { Locale } from '.'
// https://locize.com/blog/next-13-app-dir-i18n/ // https://locize.com/blog/next-13-app-dir-i18n/
const initI18next = async (lng: Locale, ns: string) => { const initI18next = async (lng: Locale, ns: string) => {
...@@ -21,6 +21,6 @@ export async function useTranslation(lng: Locale, ns = '', options: Record<strin ...@@ -21,6 +21,6 @@ export async function useTranslation(lng: Locale, ns = '', options: Record<strin
const i18nextInstance = await initI18next(lng, ns) const i18nextInstance = await initI18next(lng, ns)
return { return {
t: i18nextInstance.getFixedT(lng, ns, options.keyPrefix), t: i18nextInstance.getFixedT(lng, ns, options.keyPrefix),
i18n: i18nextInstance i18n: i18nextInstance,
} }
} }
\ No newline at end of file
import { Locale } from '@/i18n' import type { Locale } from '@/i18n'
export type ResponseHolder = {} export type ResponseHolder = {}
...@@ -6,7 +6,7 @@ export type ConversationItem = { ...@@ -6,7 +6,7 @@ export type ConversationItem = {
id: string id: string
name: string name: string
inputs: Record<string, any> | null inputs: Record<string, any> | null
introduction: string, introduction: string
} }
export type SiteInfo = { export type SiteInfo = {
...@@ -18,4 +18,4 @@ export type SiteInfo = { ...@@ -18,4 +18,4 @@ export type SiteInfo = {
prompt_public: boolean prompt_public: boolean
copyright?: string copyright?: string
privacy_policy?: string privacy_policy?: string
} }
\ No newline at end of file
...@@ -24,6 +24,7 @@ const nextConfig = { ...@@ -24,6 +24,7 @@ const nextConfig = {
// Warning: This allows production builds to successfully complete even if // Warning: This allows production builds to successfully complete even if
// your project has ESLint errors. // your project has ESLint errors.
ignoreDuringBuilds: true, ignoreDuringBuilds: true,
dirs: ['app', 'bin', 'config', 'context', 'hooks', 'i18n', 'models', 'service', 'test', 'types', 'utils'],
}, },
typescript: { typescript: {
// https://nextjs.org/docs/api-reference/next.config.js/ignoring-typescript-errors // https://nextjs.org/docs/api-reference/next.config.js/ignoring-typescript-errors
......
...@@ -6,61 +6,61 @@ import type { User } from '@/models/user' ...@@ -6,61 +6,61 @@ import type { User } from '@/models/user'
import type { Log } from '@/models/log' import type { Log } from '@/models/log'
export const seedHistory = () => { export const seedHistory = () => {
return Factory.extend<Partial<History>>({ return Factory.extend<Partial<History>>({
source() { source() {
return faker.address.streetAddress() return faker.address.streetAddress()
}, },
target() { target() {
return faker.address.streetAddress() return faker.address.streetAddress()
}, },
}) })
} }
export const seedUser = () => { export const seedUser = () => {
return Factory.extend<Partial<User>>({ return Factory.extend<Partial<User>>({
firstName() { firstName() {
return faker.name.firstName() return faker.name.firstName()
}, },
lastName() { lastName() {
return faker.name.lastName() return faker.name.lastName()
}, },
name() { name() {
return faker.address.streetAddress() return faker.address.streetAddress()
}, },
phone() { phone() {
return faker.phone.number() return faker.phone.number()
}, },
email() { email() {
return faker.internet.email() return faker.internet.email()
}, },
username() { username() {
return faker.internet.userName() return faker.internet.userName()
}, },
avatar() { avatar() {
return faker.internet.avatar() return faker.internet.avatar()
}, },
}) })
} }
export const seedLog = () => { export const seedLog = () => {
return Factory.extend<Partial<Log>>({ return Factory.extend<Partial<Log>>({
get key() { get key() {
return faker.datatype.uuid() return faker.datatype.uuid()
}, },
get conversationId() { get conversationId() {
return faker.datatype.uuid() return faker.datatype.uuid()
}, },
get question() { get question() {
return faker.lorem.sentence() return faker.lorem.sentence()
}, },
get answer() { get answer() {
return faker.lorem.sentence() return faker.lorem.sentence()
}, },
get userRate() { get userRate() {
return faker.datatype.number(5) return faker.datatype.number(5)
}, },
get adminRate() { get adminRate() {
return faker.datatype.number(5) return faker.datatype.number(5)
} },
}) })
} }
\ No newline at end of file
...@@ -2,8 +2,7 @@ import { Model, createServer } from 'miragejs' ...@@ -2,8 +2,7 @@ import { Model, createServer } from 'miragejs'
import type { User } from '@/models/user' import type { User } from '@/models/user'
import type { History } from '@/models/history' import type { History } from '@/models/history'
import type { Log } from '@/models/log' import type { Log } from '@/models/log'
import { seedUser, seedHistory, seedLog } from '@/test/factories' import { seedHistory, seedLog, seedUser } from '@/test/factories'
export function mockAPI() { export function mockAPI() {
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment