Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 15 additions & 16 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
// @ts-check

import { FlatCompat } from "@eslint/eslintrc";
import { defineConfig, globalIgnores } from "eslint/config";
import nextVitals from "eslint-config-next/core-web-vitals";
import pluginMocha from "eslint-plugin-mocha";

const compat = new FlatCompat({
baseDirectory: import.meta.dirname,
});
const eslintConfig = defineConfig([
pluginMocha.configs.recommended,
...nextVitals,
// Override default ignores of eslint-config-next.
globalIgnores([
// Default ignores of eslint-config-next:
".next/**",
"out/**",
"build/**",
"next-env.d.ts",
]),
]);

export default [
...compat.config({
extends: ["next"],
rules: {
"react/no-unescaped-entities": "off",
"@next/next/no-page-custom-font": "off",
},
}),
{
plugins: { mocha: pluginMocha },
},
];
export default eslintConfig;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MouseEventHandler, ReactNode } from "react";
import { Button } from "component-library/components/Button";
import { MarkdownToJSX } from "markdown-to-jsx";
import { MarkdownToJSX } from "markdown-to-jsx/react";

export interface MarkdownControlsProps {
textArea: HTMLTextAreaElement | HTMLInputElement | null;
Expand Down
2 changes: 1 addition & 1 deletion packages/component-library/components/Markdown/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Markdown, { MarkdownToJSX } from "markdown-to-jsx";
import Markdown, { MarkdownToJSX } from "markdown-to-jsx/react";
import Link from "next/link";
import { ReactNode, ElementType } from "react";
import { Url } from "url";
Expand Down
2 changes: 1 addition & 1 deletion packages/component-library/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
Expand Down
2 changes: 1 addition & 1 deletion packages/content-engine/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
Expand Down
2 changes: 1 addition & 1 deletion packages/menus-collection/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
Expand Down
1 change: 0 additions & 1 deletion packages/next-static-image/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"clsx": "^2.1.1",
"fs-extra": "^11.3.3",
"markdown-to-jsx": "^9.5.0",
"ora": "^9.0.0",
"sharp": "0.34.5"
},
"peerDependencies": {
Expand Down
6 changes: 1 addition & 5 deletions packages/next-static-image/src/resizeImage.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { parse } from "path";
import type { Sharp } from "sharp";
import { ensureDir, stat } from "fs-extra";
import { oraPromise } from "ora";

interface ImageResizeProps {
sharp: Sharp;
Expand Down Expand Up @@ -42,10 +41,7 @@ export async function queuePossibleImageResize({

// Check if the target width is larger than the original width
if (originalWidth === undefined || width <= originalWidth) {
await oraPromise(
sharp.resize({ width }).webp({ quality }).toFile(resultPath),
`Resizing ${resultFilename}`,
);
await sharp.resize({ width }).webp({ quality }).toFile(resultPath);
} else {
// If the target width is larger than the original width, skip resizing
await sharp.webp({ quality }).toFile(resultPath);
Expand Down
4 changes: 2 additions & 2 deletions packages/pages-collection/components/Form/fields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { PageFormState } from "../../controller/formState";
import createDefaultSlug from "../../controller/createSlug";
import { DateTimeInput } from "component-library/components/Form/inputs/DateTime";
import { TextInput } from "component-library/components/Form/inputs/Text";
import { TextAreaInput } from "component-library/components/Form/inputs/TextArea";
import { MarkdownInput } from "component-library/components/Form/inputs/Markdown";
import { StaticImageProps } from "next-static-image/src";

export default function PageFields({
Expand Down Expand Up @@ -43,7 +43,7 @@ export default function PageFields({
onChange={(e) => setCurrentName(e.target.value)}
errors={state.errors?.name}
/>
<TextAreaInput
<MarkdownInput
label="Content"
name="content"
id="page-form-content"
Expand Down
2 changes: 1 addition & 1 deletion packages/pages-collection/components/View/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const PageView = ({ page }: { page?: Page }) => {
return (
<div className="w-full h-full p-2 print:p-0 grow flex flex-col flex-nowrap max-w-prose">
<h1 className="text-3xl font-bold mt-4 mb-6">{name}</h1>
{content && <Markdown>{content}</Markdown>}
{content && <Markdown forceBlock={true}>{content}</Markdown>}
</div>
);
};
4 changes: 3 additions & 1 deletion packages/pages-collection/controller/parseFormData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import dateEpochSchema from "content-engine/forms/schema/dateEpoch";

const PageFormSchema = z.object({
name: z.string().min(1),
content: z.string(),
content: z
.string()
.transform((rawString) => rawString.replaceAll("\r\n", "\n")),
date: z.optional(dateEpochSchema),
slug: z.string().optional(),
});
Expand Down
1 change: 1 addition & 0 deletions packages/pages-collection/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"fraction.js": "^5.3.4",
"fs-extra": "^11.3.3",
"lodash": "^4.17.21",
"markdown-to-jsx": "^9.5.0",
"next": "16.1.1",
"next-static-image": "^0.0.1",
"plaiceholder": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/pages-collection/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
Expand Down
2 changes: 1 addition & 1 deletion packages/projects-collection/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
Expand Down
Loading