mirror of
https://github.com/civitai/civitai.git
synced 2026-09-20 22:08:18 +08:00
d6f3defc81
Neither tool covered the app. Prettier's root scripts glob "**/*.{ts,tsx}" and
prettier-plugin-svelte was absent, so a .svelte file failed with "No parser could
be inferred". ESLint's root script is scoped to src/ (the Next app), and the root
config cannot parse .svelte at all - @typescript-eslint/parser reads the markup
as TypeScript and throws.
Scoped to this app rather than fixed at the root, since an app-wide eslint/
prettier overhaul is in flight separately.
Prettier is a second major here (3.9 alongside root 2.8) out of necessity: no
prettier-plugin-svelte supports svelte 5 on prettier 2 (@2.10 caps at svelte 4,
svelte 5 support starts at @3.2 which peers prettier ^3). The two majors are NOT
interchangeable - prettier 3 collapses leading-pipe union types that prettier 2
breaks across lines - so root .prettierignore hands this directory over wholesale
rather than letting both format the same files and revert each other forever.
Run `pnpm -F @civitai/creator-studio-app format` from the app.
ESLint needed no version split: eslint-plugin-svelte@2.46 peers eslint ^8 and
still ships eslintrc configs, matching the pinned 8.57.1.
Four rules are adjusted where they are categorically wrong rather than merely
inconvenient, each with the reason inline:
- prefer-const off in .svelte - svelte 5 REQUIRES let for $props()
destructuring, so it fired on all 118 props in the app
- no-undef off - TS resolves types itself; it reported generics and DOM lib
types (T, FormDataEntryValue) as undefined globals
- prefer-const destructuring:'all' - the default reports unreassigned bindings
in a let{...} pattern with a reassigned sibling, unfixable without splitting
the statement (see getEdgeUrl)
- svelte/valid-compile off - re-reports compiler diagnostics that svelte-check
and the build already own, including a custom-element warning that cannot
apply to an app never compiled as a custom element
Also uncomment WEBHOOK_TOKEN in .env.example. It is required for permanent paid
access (the main-app endpoint gates the `permanent` flag on it) but shipped
commented out, so deployments provisioned from the template omitted it - which is
how creator-studio came to send `?token=` and every creator got the misleading
403 "Permanent access can only be set from the Creator Studio."
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
7 lines
499 B
Plaintext
7 lines
499 B
Plaintext
# apps/creator-studio formats itself, from its own root, with its own Prettier 3 + prettier-plugin-svelte
|
|
# (svelte 5 needs prettier >=3; no prettier-plugin-svelte supports svelte 5 on the root's prettier 2).
|
|
# The two majors format TS differently -- prettier 3 collapses leading-pipe unions that prettier 2 breaks
|
|
# across lines -- so ownership has to be exclusive or the two fight over the same files forever.
|
|
# Run `pnpm -F @civitai/creator-studio-app format` there instead.
|
|
apps/creator-studio/
|