Skip to content

Commit 8b84276

Browse files
marin-karamihalevTRomesh
authored andcommitted
CMS-51693 Add prettier, simple-git-hooks and pretty-quick to enable prettier on pre-commit, add prettier config and ignore files, prettify all relevant files
1 parent 21fdebc commit 8b84276

152 files changed

Lines changed: 5289 additions & 6411 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.prettierignore

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
.pnpm-debug.log*
9+
10+
# Dependency directories
11+
node_modules/
12+
jspm_packages/
13+
14+
# dotenv environment variable files
15+
.env
16+
.env.development.local
17+
.env.test.local
18+
.env.production.local
19+
.env.local
20+
21+
dist
22+
.vercel
23+
.DS_Store
24+
*-temp.json
25+
26+
# Files and folders that start with a dot
27+
.*
28+
29+
# yaml files
30+
*.yaml
31+
32+
# Markdown files
33+
*.md

.prettierrc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"arrowParens": "avoid",
3+
"bracketSpacing": true,
4+
"embeddedLanguageFormatting": "auto",
5+
"endOfLine": "crlf",
6+
"experimentalTernaries": true,
7+
"jsxSingleQuote": true,
8+
"printWidth": 120,
9+
"proseWrap": "always",
10+
"quoteProps": "as-needed",
11+
"rangeStart": 0,
12+
"requirePragma": false,
13+
"semi": true,
14+
"singleQuote": true,
15+
"tabWidth": 2,
16+
"trailingComma": "all",
17+
"useTabs": false
18+
}

__test__/test-website/next.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { NextConfig } from "next";
1+
import type { NextConfig } from 'next';
22

33
const nextConfig: NextConfig = {
44
/* config options here */

__test__/test-website/src/app/en/layout.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ import {
3636
ctString,
3737
ctWithCollision,
3838
} from '@/components/with-repeated-properties';
39-
import {
40-
initContentTypeRegistry,
41-
initDisplayTemplateRegistry,
42-
} from '@optimizely/cms-sdk';
39+
import { initContentTypeRegistry, initDisplayTemplateRegistry } from '@optimizely/cms-sdk';
4340
import { initReactComponentRegistry } from '@optimizely/cms-sdk/react/server';
4441

4542
initContentTypeRegistry([
@@ -103,7 +100,7 @@ export default function RootLayout({
103100
children: React.ReactNode;
104101
}>) {
105102
return (
106-
<html lang="en">
103+
<html lang='en'>
107104
<body>{children}</body>
108105
</html>
109106
);
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
export const metadata = {
22
title: 'Next.js',
33
description: 'Generated by Next.js',
4-
}
4+
};
55

6-
export default function RootLayout({
7-
children,
8-
}: {
9-
children: React.ReactNode
10-
}) {
6+
export default function RootLayout({ children }: { children: React.ReactNode }) {
117
return (
12-
<html lang="en">
8+
<html lang='en'>
139
<body>{children}</body>
1410
</html>
15-
)
11+
);
1612
}

__test__/test-website/src/app/missing-content-types/page.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import {
2-
ct4,
3-
ct5,
4-
notSynced,
5-
} from '@/components/missing-content-types/not-synced';
1+
import { ct4, ct5, notSynced } from '@/components/missing-content-types/not-synced';
62
import { GraphClient, initContentTypeRegistry } from '@optimizely/cms-sdk';
73
import React from 'react';
84

__test__/test-website/src/app/multi-host/[...slug]/page.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ export default async function Page({ params }: Props) {
1616
const client = new GraphClient(process.env.OPTIMIZELY_GRAPH_SINGLE_KEY!, {
1717
graphUrl: process.env.OPTIMIZELY_GRAPH_GATEWAY,
1818
});
19-
const host =
20-
process.env.NEXTJS_HOST ?? `https://localhost:${process.env.PORT ?? 3000}`;
19+
const host = process.env.NEXTJS_HOST ?? `https://localhost:${process.env.PORT ?? 3000}`;
2120

2221
const content = await client.getContentByPath(`/${slug.join('/')}/`, {
2322
host,
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
export const metadata = {
22
title: 'Next.js',
33
description: 'Generated by Next.js',
4-
}
4+
};
55

6-
export default function RootLayout({
7-
children,
8-
}: {
9-
children: React.ReactNode
10-
}) {
6+
export default function RootLayout({ children }: { children: React.ReactNode }) {
117
return (
12-
<html lang="en">
8+
<html lang='en'>
139
<body>{children}</body>
1410
</html>
15-
)
11+
);
1612
}

__test__/test-website/src/app/preview/page.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ export default async function Page({ searchParams }: Props) {
1515
const response = await client
1616
.getPreviewContent(
1717
// TODO: check types in runtime properly
18-
(await searchParams) as PreviewParams
18+
(await searchParams) as PreviewParams,
1919
)
20-
.catch((err) => {
20+
.catch(err => {
2121
console.log(err.errors);
2222
console.log(err.request);
2323

@@ -29,9 +29,7 @@ export default async function Page({ searchParams }: Props) {
2929

3030
return (
3131
<>
32-
<Script
33-
src={`${process.env.OPTIMIZELY_CMS_URL}/util/javascript/communicationinjector.js`}
34-
></Script>
32+
<Script src={`${process.env.OPTIMIZELY_CMS_URL}/util/javascript/communicationinjector.js`}></Script>
3533
<PreviewComponent />
3634
<OptimizelyComponent content={response} />
3735
</>

__test__/test-website/src/app/related/[...slug]/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default function RootLayout({
1111
children: React.ReactNode;
1212
}>) {
1313
return (
14-
<html lang="en">
14+
<html lang='en'>
1515
<body>{children}</body>
1616
</html>
1717
);

0 commit comments

Comments
 (0)