Skip to content

Commit bbb4589

Browse files
committed
chore: linting -d
1 parent 3df5ea8 commit bbb4589

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+903
-849
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ wire.*
3535

3636
# Debugging
3737
.ts-node
38+
.eslintcache
3839
*.log
3940
chrome_debug.log
4041
heap*

.vscode/settings.json

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
2-
2+
"git.enableSmartCommit": true,
3+
"git.autofetch": true,
4+
"git.confirmSync": false,
35
"prettier.proseWrap": "always",
46
"editor.largeFileOptimizations": true,
57
// Enable the ESlint flat config support
@@ -13,7 +15,8 @@
1315
"**/node_modules/**",
1416
"**/.hg/**",
1517
"**/.svn/**",
16-
"**/*.test.*"
18+
"**/*.test.*",
19+
".eslintcache"
1720
],
1821
// Auto fix
1922
"editor.codeActionsOnSave": {
@@ -58,10 +61,11 @@
5861
{ "rule": "*semi", "severity": "off", "fixable": true }
5962
],
6063
"search.exclude": {
64+
"**/node_modules": true,
65+
"**/dist": true,
6166
"**/.fiction/**": true,
6267
"**/.ref*": true,
6368
"*.log": true,
64-
"**/dist": true,
6569
"node_modules": true,
6670
"coverage": true,
6771
"**/CHANGELOG.md": true,
@@ -75,8 +79,13 @@
7579
"**/*.svg": true,
7680
"**/stats.html": true
7781
},
78-
"files.exclude": {},
82+
"files.exclude": {
83+
"**/node_modules": true,
84+
"**/dist": true
85+
},
7986
"files.watcherExclude": {
87+
"**/node_modules/**": true,
88+
"**/dist/**": true,
8089
"**/.git/objects/**": true,
8190
"**/.git/subtree-cache/**": true,
8291
"**/node_modules/*/**": true,

@fiction/admin/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"animejs": "^3.2.2",
1212
"mapbox-gl": "^3.6.0",
1313
"tailwindcss": "^3.4.11",
14-
"vue": "^3.5.4"
14+
"vue": "^3.5.5"
1515
},
1616
"devDependencies": {
1717
"@types/animejs": "^3.1.12",

@fiction/admin/tools/ElToolHandle.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { Handle } from './tools'
33
import { vue } from '@fiction/core'
44
import TransitionSlide from '@fiction/ui/anim/TransitionSlide.vue'
55
6-
const props = defineProps({
6+
defineProps({
77
handle: { type: Object as vue.PropType<Handle>, required: true },
88
})
99

@fiction/analytics/tag/test/analyticsTrack.unit.test.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
/* eslint-disable ts/unbound-method */
12
/**
23
* @vitest-environment happy-dom
34
*/
45
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
5-
import { AnalyticsTag } from '../tagAnalytics' // Replace with the actual file name
6-
import { historyUtil } from '../../utils/history'
6+
import { historyUtil } from '../../utils/history' // Replace with the actual file name
77
import { FictionPageStats } from '../../utils/pageStats'
88
import { UnloadUtility } from '../../utils/tracking'
99
import { FictionClient } from '../client'
10+
import { AnalyticsTag } from '../tagAnalytics'
1011

1112
describe('analyticsTag', () => {
1213
let analyticsTag: AnalyticsTag

@fiction/analytics/test/client.stats.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ describe('tracking client', async () => {
3939
it('should transmit event data synchronously', async () => {
4040
const event = client.createTrackingEvent({ event: 'syncEvent' })
4141
const spy = vi.spyOn(client as any, 'transmitSync')
42-
client.event({ event: 'syncEvent' }, { sync: true })
42+
await client.event({ event: 'syncEvent' }, { sync: true })
4343
await waitFor(20) // events are buffered
4444
expect(spy).toHaveBeenCalled()
4545
expect(spy).toHaveBeenCalledWith(expect.objectContaining({ events: [

@fiction/analytics/utils/test/clickTrack.unit.test.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import { clickId, elementId } from '../tracking'
66

77
// Mock the getSelector function
88
vi.mock('../tracking', async (importOriginal) => {
9-
const mod = (await importOriginal())
9+
// eslint-disable-next-line ts/no-unnecessary-type-assertion
10+
const mod = (await importOriginal()) as Record<string, unknown>
1011
return {
1112
...mod,
1213
getSelector: vi.fn().mockImplementation(() => 'div.test-class'),

@fiction/cards/insta/ElCard.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ const props = defineProps({
77
card: { type: Object as vue.PropType<Card<UserConfig, { requests: CardRequests }>>, required: true },
88
})
99
10-
const vis = vue.ref(false)
10+
const _vis = vue.ref(false)
1111
1212
vue.onMounted(async () => {
13-
const x = props.card.request('instagram', { test: true })
13+
const _x = props.card.request('instagram', { test: true })
1414
})
1515
</script>
1616

@fiction/cards/magazine/index.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { Site } from '@fiction/site'
21
import type { SiteUserConfig } from '@fiction/site/schema'
32
import { PostHandlingSchema, safeDirname, vue } from '@fiction/core'
43
import { cardTemplate } from '@fiction/site'
@@ -25,7 +24,7 @@ async function getDefaultUserConfig(): Promise<UserConfig> {
2524
}
2625
}
2726

28-
async function getDemoUserConfig(args: { site?: Site }): Promise<UserConfig> {
27+
async function getDemoUserConfig(): Promise<UserConfig> {
2928
const c: UserConfig = {
3029
standard: { spacing: { verticalSpacing: 'sm' } },
3130
posts: {
@@ -119,8 +118,8 @@ export const templates = [
119118
isPublic: false,
120119
options,
121120
schema,
122-
demoPage: async (args) => {
123-
const demoUserConfig = await getDemoUserConfig(args)
121+
demoPage: async () => {
122+
const demoUserConfig = await getDemoUserConfig()
124123
const defaultUserConfig = await getDefaultUserConfig()
125124
return {
126125
cards: [

@fiction/cards/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"animejs": "^3.2.2",
1313
"mapbox-gl": "^3.6.0",
1414
"tailwindcss": "^3.4.11",
15-
"vue": "^3.5.4"
15+
"vue": "^3.5.5"
1616
},
1717
"devDependencies": {
1818
"@types/animejs": "^3.1.12",

@fiction/cards/postGrid/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export const templates = [
3939
colorTheme: 'green',
4040
el: vue.defineAsyncComponent(async () => import('./ElCard.vue')),
4141
options,
42+
schema,
4243
isPublic: false,
4344
getUserConfig: async () => defaultConfig(),
4445
demoPage: async () => {

@fiction/cards/textEffects/ElCard.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ async function applyAnimatedUnderline() {
1616
1717
vue.onMounted(async () => {
1818
await waitFor(100)
19-
vue.watch(() => fictionRouter.current.value, async (r) => {
19+
vue.watch(() => fictionRouter.current.value, async () => {
2020
// Reset and reapply animations on route change
2121
await waitFor(100) // Short delay to ensure DOM is updated
2222
applyAnimatedUnderline()

@fiction/core/package.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
"@unhead/vue": "^1.11.2",
3838
"@vitejs/plugin-vue": "^5.1.3",
3939
"@vue-email/compiler": "^0.8.14",
40-
"@vue/compiler-sfc": "^3.5.4",
41-
"@vue/server-renderer": "^3.5.4",
40+
"@vue/compiler-sfc": "^3.5.5",
41+
"@vue/server-renderer": "^3.5.5",
4242
"autoprefixer": "^10.4.20",
4343
"axios": "^1.7.7",
4444
"bcrypt": "^5.1.1",
@@ -48,7 +48,7 @@
4848
"buffer-lite": "^2.1.0",
4949
"chalk": "^5.3.0",
5050
"chart.js": "^4.4.4",
51-
"chokidar": "^3.6.0",
51+
"chokidar": "^4.0.0",
5252
"cjs-module-lexer": "^1.4.1",
5353
"commander": "^12.1.0",
5454
"compression": "^1.7.4",
@@ -138,16 +138,16 @@
138138
"unhead": "^1.11.2",
139139
"uuid-apikey": "^1.5.3",
140140
"validator": "^13.12.0",
141-
"vite": "^5.4.4",
142-
"vue": "^3.5.4",
143-
"vue-router": "^4.4.4",
141+
"vite": "^5.4.5",
142+
"vue": "^3.5.5",
143+
"vue-router": "^4.4.5",
144144
"ws": "^8.18.0",
145145
"zod": "^3.23.8",
146146
"zod-to-json-schema": "^3.23.3"
147147
},
148148
"devDependencies": {
149149
"@babel/parser": "^7.25.6",
150-
"@playwright/test": "^1.47.0",
150+
"@playwright/test": "^1.47.1",
151151
"@tailwindcss/forms": "^0.5.9",
152152
"@types/bcrypt": "^5.0.2",
153153
"@types/body-parser": "^1.19.5",
@@ -175,11 +175,11 @@
175175
"@types/spark-md5": "^3.0.4",
176176
"@types/validator": "^13.12.1",
177177
"@types/ws": "^8.5.12",
178-
"@vitest/ui": "^2.1.0",
178+
"@vitest/ui": "^2.1.1",
179179
"deep-object-diff": "^1.1.9",
180180
"fake-indexeddb": "^6.0.0",
181181
"ngrok": "5.0.0-beta.2",
182-
"playwright": "^1.47.0",
182+
"playwright": "^1.47.1",
183183
"react-dom": "^18.3.1",
184184
"rollup": "^4.21.3",
185185
"rollup-plugin-visualizer": "^5.12.0",

@fiction/core/plugin-app/utils/vitePluginMarkdown.ts

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class ParseHandler {
5252
const content = new ExportedContent()
5353

5454
// RELATIVE IMAGE PATHS
55+
// eslint-disable-next-line regexp/no-unused-capturing-group
5556
const imagePattern = /\.\.?\/[^\s)]+\.(jpg|jpeg|png|svg|gif|bmp|webp)/gi
5657

5758
const resolvedCode = code.replaceAll(imagePattern, (match) => {

@fiction/core/plugin-db/objects.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export class FictionDbTable {
107107
else {
108108
this.log.info(`creating table: ${this.pgTableKey}`)
109109
const promise = new Promise<void>(async (resolve) => {
110-
await db.schema.createTable(this.pgTableKey, async (t) => {
110+
await db.schema.createTable(this.pgTableKey, async () => {
111111
await this.createColumns(db)
112112
resolve()
113113
})

@fiction/core/plugin-user/test/endpoint.org.unit.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { describe, expect, it } from 'vitest'
55
describe('org handling', async () => {
66
const testUtils = createTestUtils()
77
const initialized = await testUtils.init()
8-
const orgId = initialized.user.orgs?.[0].orgId
98

109
let workingUser: User | undefined
1110
let workingOrg: Organization | undefined

@fiction/core/plugin-user/test/user.unit.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ describe('user tests', async () => {
8484

8585
let triggered = false
8686

87-
testUtils.fictionUser.events.on('resetPassword', async (args) => {
87+
testUtils.fictionUser.events.on('resetPassword', async (_args) => {
8888
triggered = true
8989
})
9090

@fiction/core/test-utils/buildTest.ts

+20
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,26 @@ export async function performActions(args: {
279279
await playwrightTest.expect(frameElement).toContainText(frameAction.text || '')
280280
break
281281
}
282+
case 'scrollTo':
283+
await frameElement.scrollIntoViewIfNeeded()
284+
break
285+
case 'exists':
286+
await frameElement.waitFor({ state: 'attached', timeout: 10000 })
287+
expect(await frameElement.count(), `${frameAction.selector} exists in frame`).toBeGreaterThan(0)
288+
break
289+
case 'count':
290+
await frameElement.waitFor({ state: 'attached', timeout: 10000 })
291+
expect(await frameElement.count(), `${frameAction.selector} count in frame`).toBeGreaterThan(0)
292+
break
293+
case 'value': {
294+
await waitFor(500)
295+
const value = await frameElement.evaluate(el => el.dataset.value)
296+
const v = value ? JSON.parse(value) : {}
297+
frameAction.callback?.(v)
298+
break
299+
}
300+
default:
301+
throw new Error(`Unsupported frame action type: ${frameAction.type}`)
282302
}
283303
}
284304
break

@fiction/core/utils/url.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export function updateUrl({ url, newUrlOrPath }: { url: string, newUrlOrPath: st
162162
newUrlObj = new URL(p)
163163
urlObj = newUrlObj
164164
}
165-
catch (e) {
165+
catch {
166166
// If not a full URL, treat it as a pathname and construct a new URL with a dummy base
167167
const dummyBase = 'http://dummybase.com'
168168
newUrlObj = new URL(p, dummyBase)

@fiction/forms/endpoint.ts

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import type { DataFilter, EndpointMeta, EndpointResponse, IndexQuery } from '@fiction/core'
22
import type { EmailResponse } from '@fiction/core/plugin-email/endpoint.js'
3+
import type { CardConfigPortable } from '@fiction/site/tables.js'
34
import type { FictionForms, FormPluginSettings } from './index.js'
45
import type { FormConfigPortable, FormSubmissionConfig } from './schema.js'
5-
import { Query } from '@fiction/core'
6+
import type { InputUserConfig } from './templates.js'
7+
import { isPlainObject, Query } from '@fiction/core'
68
import { t } from './schema.js'
79

810
type FormSubmissionSettings = {
@@ -189,12 +191,14 @@ export class QueryManageSubmission extends FormQuery {
189191

190192
const heading = `${orgName}: New ${title || 'Form'} Submission`
191193

192-
const cards = card?.cards || []
194+
const cards = (card?.cards || []) as CardConfigPortable<InputUserConfig>[]
193195

194196
const formattedDetails = cards.filter(c => c.userConfig?.userValue).map((c) => {
195197
const uc = c.userConfig || {}
196198

197-
return `- **${uc.title}**: ${uc.userValue}`
199+
const val = Array.isArray(uc.userValue) ? uc.userValue.join(', ') : isPlainObject(uc.userValue) ? JSON.stringify(uc.userValue) : uc.userValue as string
200+
201+
return `- **${uc.title}**: ${val}`
198202
},
199203
).join('\n')
200204

@@ -219,8 +223,10 @@ export class QueryManageSubmission extends FormQuery {
219223
const emails = await Promise.all(emailPromises)
220224

221225
this.log.info('Email sent for new form submission', { data: { heading, bodyMarkdown } })
226+
// eslint-disable-next-line ts/no-unnecessary-type-assertion
227+
const data = (emails.map(e => e.data).filter(Boolean)) as EmailResponse[]
222228

223-
return { status: 'success', data: emails.map(e => e.data).filter(Boolean) }
229+
return { status: 'success', data }
224230
}
225231
catch (error) {
226232
this.log.error('Failed to send email notification for new form submission', { error, data: params })

@fiction/forms/form.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export class Form extends FictionObject<FormSettings> {
102102
}
103103

104104
if (nextCardId)
105-
this.setActiveId({ cardId: nextCardId, drawer: 'toggle' })
105+
await this.setActiveId({ cardId: nextCardId, drawer: 'toggle' })
106106
}
107107

108108
async setActiveId(args: {

@fiction/forms/templates.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const inputSchema = z.object({
1616
buttonText: z.string().optional(),
1717
required: z.boolean().optional(),
1818
inputType: z.string().optional() as z.Schema<keyof typeof inputs | undefined>,
19-
userValue: z.unknown().optional(),
19+
userValue: z.union([z.string(), z.number(), z.record(z.string(), z.union([z.string(), z.number()]))]).optional(),
2020
media: z.object({
2121
url: z.string().optional(),
2222
format: z.enum(['url', 'image', 'video']).optional(),

@fiction/platform/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ export interface CreateSiteSettings {
2121
isGlobalSetup?: boolean
2222
}
2323

24-
export function createSite(opts?: CreateSiteSettings) {
24+
export function createSite(_opts?: CreateSiteSettings) {
2525
return { }
2626
}

@fiction/plugins/plugin-ai/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"@fiction/core": "workspace:*",
44
"@fiction/plugin-unsplash": "workspace:*",
55
"@pinecone-database/pinecone": "^3.0.3",
6-
"openai": "^4.60.0",
6+
"openai": "^4.60.1",
77
"tailwindcss": "^3.4.11",
8-
"vue": "^3.5.4"
8+
"vue": "^3.5.5"
99
},
1010
"gitHead": "b257411e1c6c32b52b444cc6f1518bf1bee1e480",
1111
"license": "MIT",

@fiction/plugins/plugin-extend/registry.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ class RegistryPlugin extends FictionPlugin<ModuleConfig> {
1212
super(config.name, settings)
1313
}
1414

15-
async init(services: RegistryPlugin[]) {
15+
async init(_services: RegistryPlugin[]) {
1616
// Initialize module with available services
1717
}
1818
}
1919

20-
class ModuleRegistry {
20+
export class ModuleRegistry {
2121
private modules: Record<string, RegistryPlugin> = {}
2222
private moduleConfigs: Record<string, ModuleConfig> = {}
2323

0 commit comments

Comments
 (0)