From 5c3653559f68e38ad43b75e88fe7370d721c7b50 Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Sun, 5 May 2024 15:00:21 +0200 Subject: [PATCH] use prettier to format markdown --- .prettierignore | 2 ++ README.md | 58 +++++++++++++++++++++++-------------------------- package.json | 7 +++--- pnpm-lock.yaml | 10 +++++++++ 4 files changed, 43 insertions(+), 34 deletions(-) create mode 100644 .prettierignore diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..7d63853 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +**/*.* +!**/*.md \ No newline at end of file diff --git a/README.md b/README.md index ab5fb19..fdca925 100644 --- a/README.md +++ b/README.md @@ -26,31 +26,31 @@ Takes the rich text property from the Umbraco Content Delivery API and renders i ```tsx import { UmbracoRichText } from "@charlietango/react-umbraco"; -import Image from 'next/image' -import Link from 'next/link' +import Image from "next/image"; +import Link from "next/link"; const MyComponent = ({ data }) => { - return ( - { - switch (tag) { - case "a": - return {children}; - default: - return undefined; - } - }} - renderBlock={({ content }) => { - switch (content?.contentType) { - case "imageBlock": - return ; - default: - return null; - } - }} - /> - ); + return ( + { + switch (tag) { + case "a": + return {children}; + default: + return undefined; + } + }} + renderBlock={({ content }) => { + switch (content?.contentType) { + case "imageBlock": + return ; + default: + return null; + } + }} + /> + ); }; ``` @@ -65,23 +65,19 @@ for `ApiBlockItemModel`. **types/react-umbraco.d.ts** ```ts -import {components} from '@/openapi/umbraco'; +import { components } from "@/openapi/umbraco"; // Define the intermediate interface -type ApiBlockItemModel = components['schemas']['ApiBlockItemModel']; +type ApiBlockItemModel = components["schemas"]["ApiBlockItemModel"]; -declare module '@charlietango/react-umbraco' { - interface UmbracoBlockItemModel extends ApiBlockItemModel { - } +declare module "@charlietango/react-umbraco" { + interface UmbracoBlockItemModel extends ApiBlockItemModel {} } ``` [npm-version-src]: https://img.shields.io/npm/v/@charlietango/react-umbraco?style=flat&colorA=080f12&colorB=1fa669 - [npm-version-href]: https://npmjs.com/package/@charlietango/react-umbraco - [license-src]: https://img.shields.io/github/license/charlie-tango/react-umbraco.svg?style=flat&colorA=080f12&colorB=1fa669 - [license-href]: https://github.com/charlie-tango/react-umbraco/blob/main/LICENSE diff --git a/package.json b/package.json index 68e542a..d9420cf 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "url": "git+https://github.com/charlietango/react-umbraco.git" }, "bugs": "https://github.com/charlietango/react-umbraco/issues", - "keywords": [], + "keywords": ["umbraco", "react", "content delivery api", "headless cms"], "sideEffects": false, "exports": { ".": { @@ -56,7 +56,7 @@ "bumpp": "^9.4.1", "happy-dom": "^14.7.1", "lint-staged": "^15.2.2", - "pnpm": "^9.0.6", + "prettier": "^3.2.5", "react": "^18.3.1", "react-dom": "^18.3.1", "rimraf": "^5.0.5", @@ -72,6 +72,7 @@ "lint-staged": { "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}": [ "biome check --apply --no-errors-on-unmatched" - ] + ], + "*.md": ["prettier --write"] } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0b1f41d..a6ff840 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -36,6 +36,9 @@ importers: pnpm: specifier: ^9.0.6 version: 9.0.6 + prettier: + specifier: ^3.2.5 + version: 3.2.5 react: specifier: ^18.3.1 version: 18.3.1 @@ -1512,6 +1515,11 @@ packages: resolution: {integrity: sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==} engines: {node: ^10 || ^12 || >=14} + prettier@3.2.5: + resolution: {integrity: sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==} + engines: {node: '>=14'} + hasBin: true + pretty-bytes@6.1.1: resolution: {integrity: sha512-mQUvGU6aUFQ+rNvTIAcZuWGRT9a6f6Yrg9bHs4ImKF+HZCEK+plBvnAZYSIQztknZF2qnzNtr6F8s0+IuptdlQ==} engines: {node: ^14.13.1 || >=16.0.0} @@ -3154,6 +3162,8 @@ snapshots: picocolors: 1.0.0 source-map-js: 1.2.0 + prettier@3.2.5: {} + pretty-bytes@6.1.1: {} pretty-format@29.7.0: