mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-04 21:04:37 +08:00
Fix lint
This commit is contained in:
parent
d400d379bb
commit
408d00e21e
@ -80,6 +80,7 @@ To see all development ports, refer to the index.html of `apps/dev-launchpad/pub
|
||||
- To update the list of apps available, edit `apps-frontend.tsx` and `apps-config.ts`. When you're tasked to implement a new app or a new page, always check existing apps for inspiration on how you could implement the new app or page.
|
||||
- NEVER use Next.js dynamic functions if you can avoid them. Instead, prefer using a client component to make sure the page remains static (eg. prefer `usePathname` instead of `await params`).
|
||||
- Whenever you make backwards-incompatible changes to the config schema, you must update the migration functions in `packages/stack-shared/src/config/schema.ts`!
|
||||
- NEVER try-catch-all, NEVER void a promise, and NEVER .catch(console.error) (or similar). In most cases you don't actually need to be asynchronous, especially when UI is involved (instead, use a loading indicator! eg. our <Button> component already takes an async callback for onClick and sets its loading state accordingly — if whatever component doesn't do that, update the component instead). If you really do need things to be asynchronous, use `runAsynchronously` or `runAsynchronouslyWithAlert` instead as it deals with error logging.
|
||||
|
||||
### Code-related
|
||||
- Use ES6 maps instead of records wherever you can.
|
||||
|
||||
@ -306,7 +306,7 @@ function SidebarContent({ projectId, onNavigate }: { projectId: string, onNaviga
|
||||
const pathname = usePathname();
|
||||
const project = stackAdminApp.useProject();
|
||||
const config = project.useConfig();
|
||||
const enabledApps = typedEntries(config.apps.installed).filter(([_, appConfig]) => appConfig?.enabled).map(([appId]) => appId);
|
||||
const enabledApps = typedEntries(config.apps.installed).filter(([appId, appConfig]) => appConfig?.enabled && appId in ALL_APPS).map(([appId]) => appId as AppId);
|
||||
const [expandedSections, setExpandedSections] = useState<Set<AppId>>(getDefaultExpandedSections());
|
||||
|
||||
const toggleSection = (appId: AppId) => {
|
||||
@ -352,8 +352,8 @@ function SidebarContent({ projectId, onNavigate }: { projectId: string, onNaviga
|
||||
</div>
|
||||
{/* App Sections */}
|
||||
{enabledApps.map((appId) => {
|
||||
const app = ALL_APPS[appId];
|
||||
const appFrontend = ALL_APPS_FRONTEND[appId];
|
||||
const app = ALL_APPS[appId as AppId];
|
||||
const appFrontend = ALL_APPS_FRONTEND[appId as AppId];
|
||||
return (
|
||||
<NavItem
|
||||
key={appId}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
// OTHERWISE THINGS WILL GO BOOM!!
|
||||
|
||||
import * as yup from "yup";
|
||||
import { ALL_APPS, AppId } from "../apps/apps-config";
|
||||
import { ALL_APPS } from "../apps/apps-config";
|
||||
import { DEFAULT_EMAIL_TEMPLATES, DEFAULT_EMAIL_THEMES, DEFAULT_EMAIL_THEME_ID } from "../helpers/emails";
|
||||
import * as schemaFields from "../schema-fields";
|
||||
import { productSchema, userSpecifiedIdSchema, yupBoolean, yupDate, yupMixed, yupNever, yupNumber, yupObject, yupRecord, yupString, yupTuple, yupUnion } from "../schema-fields";
|
||||
@ -465,9 +465,7 @@ const organizationConfigDefaults = {
|
||||
},
|
||||
|
||||
apps: {
|
||||
installed: ((key: AppId) => ({
|
||||
enabled: false,
|
||||
})),
|
||||
installed: typedFromEntries(appIds.map(appId => [appId, { enabled: false }])) as Record<string, { enabled: boolean } | undefined>,
|
||||
},
|
||||
|
||||
teams: {
|
||||
@ -587,7 +585,7 @@ typeAssertIs<DefaultsType<{ a: { b: Record<string, 123>, c: 456 } }, [{ a: { c:
|
||||
|
||||
type DeepReplaceAllowFunctionsForObjects<T> = T extends object
|
||||
? (
|
||||
string & AppId extends keyof T
|
||||
string extends keyof T
|
||||
? ((arg: Exclude<keyof T, number>) => DeepReplaceAllowFunctionsForObjects<T[keyof T]>) & ({ [K in keyof T]?: DeepReplaceAllowFunctionsForObjects<T[K]> } | {})
|
||||
: { [K in keyof T]: DeepReplaceAllowFunctionsForObjects<T[K]> }
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user