Skip to content

Commit

Permalink
refactor(format): Fix ESLint error
Browse files Browse the repository at this point in the history
  • Loading branch information
syfxlin committed Jan 13, 2024
1 parent 6939ac1 commit 0373e5e
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 76 deletions.
28 changes: 14 additions & 14 deletions keystatic.config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import { Articles } from "./src/components/docs/articles/preview";
import { COLINE_GITHUB_REPO, IS_DEV } from "./src/env/private";
import { t } from "./src/locales";

const storage = () => {
function storage() {
if (IS_DEV || !COLINE_GITHUB_REPO) {
return { kind: "local" } as const;
} else {
return { kind: "github", repo: COLINE_GITHUB_REPO as `${string}/${string}` } as const;
}
};
}

const content = (path: string) => {
function content(path: string) {
return fields.document({
label: t("keystatic.page.content"),
images: {
Expand Down Expand Up @@ -97,7 +97,7 @@ const content = (path: string) => {
}),
},
});
};
}

export default config({
storage: storage(),
Expand Down Expand Up @@ -204,7 +204,7 @@ export default config({
}),
{
label: t("category.name"),
itemLabel: (props) => props.value,
itemLabel: props => props.value,
validation: { length: { min: 0, max: 10 } },
},
),
Expand All @@ -215,7 +215,7 @@ export default config({
}),
{
label: t("tag.name"),
itemLabel: (props) => props.value,
itemLabel: props => props.value,
validation: { length: { min: 0, max: 10 } },
},
),
Expand Down Expand Up @@ -265,7 +265,7 @@ export default config({
}),
{
label: t("keystatic.seo.keywords"),
itemLabel: (props) => props.value,
itemLabel: props => props.value,
validation: { length: { min: 0 } },
},
),
Expand Down Expand Up @@ -336,7 +336,7 @@ export default config({
}),
{
label: t("keystatic.header.main"),
itemLabel: (props) => props.fields.title.value,
itemLabel: props => props.fields.title.value,
validation: { length: { min: 0, max: 10 } },
},
),
Expand All @@ -361,7 +361,7 @@ export default config({
}),
{
label: t("keystatic.footer.main"),
itemLabel: (props) => props.fields.title.value,
itemLabel: props => props.fields.title.value,
validation: { length: { min: 0, max: 10 } },
},
),
Expand Down Expand Up @@ -443,7 +443,7 @@ export default config({
}),
{
label: t("keystatic.friends.main"),
itemLabel: (props) => props.fields.name.value,
itemLabel: props => props.fields.name.value,
validation: { length: { min: 0 } },
},
),
Expand All @@ -460,7 +460,7 @@ export default config({
}),
{
label: t("keystatic.friends.lost"),
itemLabel: (props) => props.fields.name.value,
itemLabel: props => props.fields.name.value,
validation: { length: { min: 0 } },
},
),
Expand Down Expand Up @@ -511,21 +511,21 @@ export default config({
}),
{
label: t("keystatic.projects.component"),
itemLabel: (props) => props.value,
itemLabel: props => props.value,
validation: { length: { min: 0 } },
},
),
}),
{
label: t("keystatic.projects.main"),
itemLabel: (props) => props.fields.name.value,
itemLabel: props => props.fields.name.value,
validation: { length: { min: 1 } },
},
),
}),
{
label: t("keystatic.projects.category"),
itemLabel: (props) => props.fields.name.value,
itemLabel: props => props.fields.name.value,
validation: { length: { min: 0 } },
},
),
Expand Down
2 changes: 1 addition & 1 deletion next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import createPwaPlugin from "next-pwa";
import createBundleAnalyzer from "@next/bundle-analyzer";
import { COLINE_ANALYZE, IS_DEV } from "./src/env/private.mjs";
import { createVanillaExtractPlugin } from "@vanilla-extract/next-plugin";
import { COLINE_ANALYZE, IS_DEV } from "./src/env/private.mjs";

const withPwa = createPwaPlugin({ dest: "public" });
const withVanillaExtract = createVanillaExtractPlugin();
Expand Down
16 changes: 8 additions & 8 deletions src/app/(group)/archives/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ const query = React.cache(async () => {
export async function generateMetadata(): Promise<Metadata> {
const data = await query();
if (
data.articles.length === 0
&& data.archives.length === 0
&& data.categories.length === 0
&& data.tags.length === 0
data.articles.length === 0 &&
data.archives.length === 0 &&
data.categories.length === 0 &&
data.tags.length === 0
) {
return notFound();
}
Expand All @@ -62,10 +62,10 @@ export async function generateMetadata(): Promise<Metadata> {
export default async function ArchivesPage() {
const data = await query();
if (
data.articles.length === 0
&& data.archives.length === 0
&& data.categories.length === 0
&& data.tags.length === 0
data.articles.length === 0 &&
data.archives.length === 0 &&
data.categories.length === 0 &&
data.tags.length === 0
) {
return notFound();
}
Expand Down
16 changes: 8 additions & 8 deletions src/app/(post)/post/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ const query = React.cache(async (_slug: string) => {
if (curr.slug === slug) {
return {
data: curr,
prev: prev
? {
prev: prev ?
{
name: prev.title,
link: prev.link,
}
: undefined,
next: next
? {
} :
undefined,
next: next ?
{
name: next.title,
link: next.link,
}
: undefined,
} :
undefined,
};
}
}
Expand Down
42 changes: 21 additions & 21 deletions src/components/ui/button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ export type LinkButtonProps = AnchorHTMLAttributes<HTMLAnchorElement> & LinkProp

export const Button = forwardRef<HTMLButtonElement, ButtonProps>(({ tooltip, unstyled, ...props }, ref) => {
const element = <button {...props} className={cx(props.className, !unstyled && styles.button)} ref={ref} />;
return tooltip
? (
<Tippy animation="shift-away" content={props["aria-label"]} {...(typeof tooltip === "boolean" ? {} : tooltip)}>
{element}
</Tippy>
)
: (
return tooltip ?
(
<Tippy animation="shift-away" content={props["aria-label"]} {...(typeof tooltip === "boolean" ? {} : tooltip)}>
{element}
</Tippy>
) :
(
element
);
});
Expand All @@ -33,26 +33,26 @@ export const LinkButton = forwardRef<HTMLAnchorElement, LinkButtonProps>(
const element = (
<a {...props} className={cx(props.className, !unstyled && styles.button)} href={href} ref={ref} />
);
return tooltip
? (
<Tippy animation="shift-away" content={props["aria-label"]} {...(typeof tooltip === "boolean" ? {} : tooltip)}>
{element}
</Tippy>
)
: (
return tooltip ?
(
<Tippy animation="shift-away" content={props["aria-label"]} {...(typeof tooltip === "boolean" ? {} : tooltip)}>
{element}
</Tippy>
) :
(
element
);
} else {
const element = (
<Link {...props} className={cx(props.className, !unstyled && styles.button)} href={href} ref={ref} />
);
return tooltip
? (
<Tippy animation="shift-away" content={props["aria-label"]} {...(typeof tooltip === "boolean" ? {} : tooltip)}>
{element}
</Tippy>
)
: (
return tooltip ?
(
<Tippy animation="shift-away" content={props["aria-label"]} {...(typeof tooltip === "boolean" ? {} : tooltip)}>
{element}
</Tippy>
) :
(
element
);
}
Expand Down
18 changes: 9 additions & 9 deletions src/components/ui/divider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ export interface DividerProps {

export const Divider: React.FC<DividerProps> = ({ orientation }) => {
const span = <span className={styles.container} />;
return orientation === "vertical"
? (
return orientation === "vertical" ?
(
span
)
: (
<div>
{span}
{span}
{span}
</div>
) :
(
<div>
{span}
{span}
{span}
</div>
);
};
28 changes: 14 additions & 14 deletions src/components/ui/link/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@ export type LinkProps = AnchorHTMLAttributes<HTMLAnchorElement> & NLinkProps & {
export const Link = forwardRef<HTMLAnchorElement, LinkProps>(({ tooltip, unstyled, href, ...props }, ref) => {
if (typeof href === "string" && /^(https?:)?\/\/|^#|\.[\da-z]+$/i.test(href)) {
const element = <a {...props} className={cx(props.className, !unstyled && styles.link)} href={href} ref={ref} />;
return tooltip
? (
<Tippy animation="shift-away" content={props["aria-label"]} {...(typeof tooltip === "boolean" ? {} : tooltip)}>
{element}
</Tippy>
)
: (
return tooltip ?
(
<Tippy animation="shift-away" content={props["aria-label"]} {...(typeof tooltip === "boolean" ? {} : tooltip)}>
{element}
</Tippy>
) :
(
element
);
} else {
const element = (
<NLink {...props} className={cx(props.className, !unstyled && styles.link)} href={href} ref={ref} />
);
return tooltip
? (
<Tippy animation="shift-away" content={props["aria-label"]} {...(typeof tooltip === "boolean" ? {} : tooltip)}>
{element}
</Tippy>
)
: (
return tooltip ?
(
<Tippy animation="shift-away" content={props["aria-label"]} {...(typeof tooltip === "boolean" ? {} : tooltip)}>
{element}
</Tippy>
) :
(
element
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/widgets/toc/styles.css.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { theme } from "../../../theme/theme.css";
import { styled } from "@syfxlin/reve";
import { theme } from "../../../theme/theme.css";
import { iconify } from "../../ui/iconify/query";

export const container = styled.css`
Expand Down

0 comments on commit 0373e5e

Please sign in to comment.