Skip to content

Commit

Permalink
Fix prettier tsconfig issue
Browse files Browse the repository at this point in the history
  • Loading branch information
sawden committed Feb 10, 2024
1 parent 87064a5 commit a460cf8
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 44 deletions.
2 changes: 1 addition & 1 deletion apps/backend/src/admin/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@strapi/typescript-utils/tsconfigs/admin",
"include": ["../plugins/**/admin/src/**/*", "./"],
"exclude": ["node_modules/", "build/", "dist/", "**/*.test.ts"]
"exclude": ["node_modules/", "build/", "dist/", "**/*.test.ts"],
}
5 changes: 1 addition & 4 deletions apps/backend/src/api/page/content-types/page/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@
}
},
"type": "dynamiczone",
"components": [
"sections.link-cards",
"sections.rich-text"
]
"components": ["sections.link-cards", "sections.rich-text"]
},
"seo": {
"displayName": "Seo",
Expand Down
6 changes: 3 additions & 3 deletions apps/backend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compilerOptions": {
"outDir": "dist",
"rootDir": ".",
"strictNullChecks": true
"strictNullChecks": true,
},
"include": ["./", "./**/*.ts", "./**/*.js", "src/**/*.json"],
"exclude": [
Expand All @@ -14,6 +14,6 @@
".tmp/",
"src/admin/",
"**/*.test.*",
"src/plugins/**"
]
"src/plugins/**",
],
}
6 changes: 3 additions & 3 deletions apps/frontend/src/app/[locale]/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Image from "next/image";

import { Hero } from "@/components/hero";
import { sectionRenderer } from "@/components/section-renderer";
import { fetchOneBySlug } from "@/lib/api";
import type { APIUrlParams } from "@/lib/api/types";
import { Callout } from "@turbostrapi/ui";
import { notFound } from "next/navigation";
import { sectionRenderer } from "@/components/section-renderer";
import { Hero } from "@/components/hero";

interface PageProps {
params: {
Expand Down Expand Up @@ -49,7 +49,7 @@ export default async function Page({
>
apps/frontend
</Callout>
<div className="fixed bottom-0 left-0 flex h-36 w-full items-end justify-center bg-gradient-to-t from-white via-white md:static md:h-auto md:w-auto md:bg-none dark:from-black dark:via-black">
<div className="fixed bottom-0 left-0 flex h-36 w-full items-end justify-center bg-gradient-to-t from-white via-white dark:from-black dark:via-black md:static md:h-auto md:w-auto md:bg-none">
<a
className="pointer-events-none flex place-items-center gap-2 p-8 md:pointer-events-auto md:p-0"
href={`https://vercel.com?utm_source=turbostrapi-starter&utm_medium=basic&utm_campaign=turbostrapi-starter`}
Expand Down
6 changes: 3 additions & 3 deletions apps/frontend/src/app/[locale]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Image from "next/image";

import { Hero } from "@/components/hero";
import { sectionRenderer } from "@/components/section-renderer";
import { fetchOneBySlug } from "@/lib/api";
import type { APIUrlParams } from "@/lib/api/types";
import { Callout } from "@turbostrapi/ui";
import { notFound } from "next/navigation";
import { sectionRenderer } from "@/components/section-renderer";
import { Hero } from "@/components/hero";

interface PageProps {
params: {
Expand Down Expand Up @@ -50,7 +50,7 @@ export default async function Page({
>
apps/frontend
</Callout>
<div className="fixed bottom-0 left-0 flex h-36 w-full items-end justify-center bg-gradient-to-t from-white via-white md:static md:h-auto md:w-auto md:bg-none dark:from-black dark:via-black">
<div className="fixed bottom-0 left-0 flex h-36 w-full items-end justify-center bg-gradient-to-t from-white via-white dark:from-black dark:via-black md:static md:h-auto md:w-auto md:bg-none">
<a
className="pointer-events-none flex place-items-center gap-2 p-8 md:pointer-events-auto md:p-0"
href={`https://vercel.com?utm_source=turbostrapi-starter&utm_medium=basic&utm_campaign=turbostrapi-starter`}
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/components/hero/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const Hero = React.forwardRef<HTMLDivElement, HeroProps>(
</div>
<div className="z-50 flex flex-col items-center justify-center px-6 text-center">
<Image
className="w-[160px] fill-current md:w-[200px] dark:invert"
className="w-[160px] fill-current dark:invert md:w-[200px]"
alt="Turborepo wordmark"
width={200}
height={20}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,38 @@ import { cx } from "@turbostrapi/cva";
import { Card } from "@turbostrapi/ui";
import * as React from "react";

export interface LinkCardsSectionProps extends React.HTMLAttributes<HTMLDivElement> {
export interface LinkCardsSectionProps
extends React.HTMLAttributes<HTMLDivElement> {
section: Attribute.GetDynamicZoneValue<
Attribute.DynamicZone<["sections.link-cards"]>
>[number];
locale: string;
}

const LinkCardsSection = React.forwardRef<HTMLDivElement, LinkCardsSectionProps>(
({ className, section, locale, ...props }, ref) => (
<div
className={cx(
"z-20 grid text-center md:grid-cols-2 md:text-left lg:w-full lg:max-w-5xl lg:grid-cols-4",
className,
)}
ref={ref}
{...props}
>
{section.cards?.map((card) => (
<Card
href={localizeHref(card.url, locale)}
key={card.id}
title={card.title}
target={card.target}
>
{card.description}
</Card>
))}
</div>
),
);
const LinkCardsSection = React.forwardRef<
HTMLDivElement,
LinkCardsSectionProps
>(({ className, section, locale, ...props }, ref) => (
<div
className={cx(
"z-20 grid text-center md:grid-cols-2 md:text-left lg:w-full lg:max-w-5xl lg:grid-cols-4",
className,
)}
ref={ref}
{...props}
>
{section.cards?.map((card) => (
<Card
href={localizeHref(card.url, locale)}
key={card.id}
title={card.title}
target={card.target}
>
{card.description}
</Card>
))}
</div>
));

LinkCardsSection.displayName = "Link Cards";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { BlocksRenderer } from "@strapi/blocks-react-renderer";
import type { Attribute } from "@turbostrapi/backend";
import * as React from "react";

export interface RichTextSectionProps extends React.HTMLAttributes<HTMLDivElement> {
export interface RichTextSectionProps
extends React.HTMLAttributes<HTMLDivElement> {
section: Attribute.GetDynamicZoneValue<
Attribute.DynamicZone<["sections.rich-text"]>
>[number];
Expand Down
8 changes: 4 additions & 4 deletions apps/frontend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
"plugins": [{ "name": "next" }],
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
"@/*": ["./src/*"],
},
},
"include": [
".",
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts"
".next/types/**/*.ts",
],
"exclude": ["node_modules"]
"exclude": ["node_modules"],
}
12 changes: 12 additions & 0 deletions configs/prettier-config/base.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
module.exports = {
plugins: ["prettier-plugin-packagejson", "prettier-plugin-organize-imports"],
/**
* Fixes prettier formatting for tsconfig.json files with trailing commas.
* @todo Remove this fix after https://github.com/prettier/prettier/issues/15956 is resolved.
*/
overrides: [
{
files: ["tsconfig.json"],
options: {
trailingComma: "none",
},
},
],
};

0 comments on commit a460cf8

Please sign in to comment.