diff --git a/biome.json b/biome.json index f80f4438..7df32a8d 100644 --- a/biome.json +++ b/biome.json @@ -34,6 +34,7 @@ "rules": { "recommended": true, "complexity": { + "all": true, "noForEach": "off", "useOptionalChain": "warn", "useLiteralKeys": "off" diff --git a/gen/context/new/context.ejs.t b/gen/context/new/context.ejs.t index e374020e..ca1de791 100644 --- a/gen/context/new/context.ejs.t +++ b/gen/context/new/context.ejs.t @@ -5,8 +5,7 @@ import type { Accessor, JSX } from 'solid-js' import { createContext, createSignal, useContext } from 'solid-js' type <%= h.changeCase.pascal(name) %>ContextType = { - actions: { - } + } const <%= h.changeCase.pascal(name) %>Context = createContext<<%= h.changeCase.pascal(name) %>ContextType>() @@ -19,7 +18,7 @@ export const <%= h.changeCase.pascal(name) %>Provider = (props: { children: JSX. const actions = { } - const value: <%= h.changeCase.pascal(name) %>ContextType = { actions } + const value: <%= h.changeCase.pascal(name) %>ContextType = { ...actions } return <<%= h.changeCase.pascal(name) %>Context.Provider value={value}>{props.children}Context.Provider> } diff --git a/src/components/Article/Comment/Comment.tsx b/src/components/Article/Comment/Comment.tsx index 17c19c48..d6af579f 100644 --- a/src/components/Article/Comment/Comment.tsx +++ b/src/components/Article/Comment/Comment.tsx @@ -39,23 +39,14 @@ export const Comment = (props: Props) => { const [editMode, setEditMode] = createSignal(false) const [clearEditor, setClearEditor] = createSignal(false) const { author } = useSession() - - const { - actions: { createReaction, deleteReaction, updateReaction }, - } = useReactions() - - const { - actions: { showConfirm }, - } = useConfirm() - - const { - actions: { showSnackbar }, - } = useSnackbar() + const { createReaction, deleteReaction, updateReaction } = useReactions() + const { showConfirm } = useConfirm() + const { showSnackbar } = useSnackbar() const isCommentAuthor = createMemo(() => props.comment.created_by?.slug === author()?.slug) - const comment = createMemo(() => props.comment) const body = createMemo(() => (comment().body || '').trim()) + const remove = async () => { if (comment()?.id) { try { diff --git a/src/components/Article/CommentRatingControl.tsx b/src/components/Article/CommentRatingControl.tsx index 4fb906c1..5ce60d08 100644 --- a/src/components/Article/CommentRatingControl.tsx +++ b/src/components/Article/CommentRatingControl.tsx @@ -19,13 +19,8 @@ type Props = { export const CommentRatingControl = (props: Props) => { const { t } = useLocalize() const { author } = useSession() - const { - actions: { showSnackbar }, - } = useSnackbar() - const { - reactionEntities, - actions: { createReaction, deleteReaction, loadReactionsBy }, - } = useReactions() + const { showSnackbar } = useSnackbar() + const { reactionEntities, createReaction, deleteReaction, loadReactionsBy } = useReactions() const checkReaction = (reactionKind: ReactionKind) => Object.values(reactionEntities).some( @@ -86,7 +81,7 @@ export const CommentRatingControl = (props: Props) => {