Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prettier configuration changed #160

Merged
merged 6 commits into from
Nov 3, 2024
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
2 changes: 1 addition & 1 deletion content/blog/cheerpj-3-deep-dive.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ async function iTextExample() {
const document = await new Document();
const writer = await PdfWriter.getInstance(
document,
await new FileOutputStream("/files/HelloIText.pdf"),
await new FileOutputStream("/files/HelloIText.pdf")
);

await document.open();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"typescript": "^5.2.2"
},
"prettier": {
"trailingComma": "all",
"trailingComma": "es5",
"useTabs": true,
"plugins": [
"prettier-plugin-astro",
Expand Down
2 changes: 1 addition & 1 deletion packages/astro-theme/components/BlogPostCard.astro
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const authors = await resolveAuthors(post.data.authors);
loading="lazy"
decoding="async"
/>
) : undefined,
) : undefined
)}
</div>
<span class="overflow-hidden text-ellipsis">
Expand Down
4 changes: 2 additions & 2 deletions packages/astro-theme/components/DocsPagination.astro
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async function getNextPrev(): Promise<{
const activeIndex = directory.entries.findIndex(({ id }) => id === activeId);
if (activeIndex === -1) {
console.warn(
`ContentPagination: could not find activeId "${activeId}" in given directory`,
`ContentPagination: could not find activeId "${activeId}" in given directory`
);
return { next: undefined, prev: undefined };
}
Expand All @@ -37,7 +37,7 @@ async function getNextPrev(): Promise<{
function findValidEntry(
entries: NavEntry[],
index: number,
direction: number,
direction: number
): NavEntry | undefined {
for (
let i = index + direction;
Expand Down
2 changes: 1 addition & 1 deletion packages/astro-theme/components/DocsSidebar.astro
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const hasMultipleLocales = !!Astro.currentLocale;
<script>
function loadPos(): number {
const pos = parseFloat(
sessionStorage.getItem("docs-sidebar-scroll") || "0",
sessionStorage.getItem("docs-sidebar-scroll") || "0"
);
if (isNaN(pos)) return 0;
return pos;
Expand Down
2 changes: 1 addition & 1 deletion packages/astro-theme/components/LanguageSwitcher.astro
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const currentLocale = Astro.currentLocale;
selector.addEventListener("change", () => {
const newLocale = selector.value;
const { href } = document.querySelector(
`link[rel=alternate][hreflang=${newLocale}]`,
`link[rel=alternate][hreflang=${newLocale}]`
); // from BaseHead
window.location.href = href;
});
Expand Down
2 changes: 1 addition & 1 deletion packages/astro-theme/components/LocaleSwitcher.astro
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const currentLocale = Astro.currentLocale;
selector.addEventListener("change", () => {
const newLocale = selector.value;
const { href } = document.querySelector(
`link[rel=alternate][hreflang=${newLocale}]`,
`link[rel=alternate][hreflang=${newLocale}]`
); // from BaseHead
window.location.href = href;
});
Expand Down
2 changes: 1 addition & 1 deletion packages/astro-theme/components/WasThisHelpful.astro
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ interface Props {
plausible("HelpfulNo", {
props: {
reason: prompt(
"Thanks for your feedback! What could we have done better?",
"Thanks for your feedback! What could we have done better?"
),
},
});
Expand Down
2 changes: 1 addition & 1 deletion packages/astro-theme/components/nav/product/Nav.astro
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const { product } = Astro.props;
const firstDocsEntry = getLocalisedProductNav(
await getRootNav(),
product.id,
Astro.currentLocale,
Astro.currentLocale
)[0];
if (!firstDocsEntry) throw new Error("must have a docs entry");
---
Expand Down
2 changes: 1 addition & 1 deletion packages/astro-theme/components/search/Result.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
function thinSubResults(
pageUrl: string,
results: PagefindSubResult[],
limit: number,
limit: number
) {
results = results.filter((r) => r.url !== pageUrl);

Expand Down
4 changes: 2 additions & 2 deletions packages/astro-theme/components/search/Search.astro
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ interface Props {
{
t(
"If you have a question, please ask it in our Discord server.",
Astro.currentLocale,
Astro.currentLocale
)
}
</p>
Expand All @@ -61,7 +61,7 @@ interface Props {
constructor() {
super();
const openBtn = this.querySelector<HTMLButtonElement>(
"button[data-open-modal]",
"button[data-open-modal]"
);
const dialog = this.querySelector<HTMLDialogElement>("dialog");

Expand Down
2 changes: 1 addition & 1 deletion packages/astro-theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export type Options = {
const contentDir = joinPath(dirname, "../../content");

export default function ThemeIntegration(
options: Options = {},
options: Options = {}
): AstroIntegration {
const base = options.baseIsDocs ? "/docs" : "";
return {
Expand Down
8 changes: 4 additions & 4 deletions packages/astro-theme/lib/blog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { getEntry, type CollectionEntry, getCollection } from "astro:content";
import { productFromUrl } from "./products";

export async function resolveAuthors(
authors: string[],
authors: string[]
): Promise<CollectionEntry<"blogauthors">["data"][]> {
return Promise.all(
authors.map((id: string) =>
getEntry("blogauthors", id).then((entry) => {
if (!entry) throw new Error(`unknown author '${id}'`);
return entry.data;
}),
),
})
)
);
}

Expand All @@ -23,7 +23,7 @@ export async function latestFeaturedPost(url: URL) {
(entry) =>
entry.data.featured &&
!entry.data.draft &&
(!requiredTag || entry.data.tags?.includes(requiredTag)),
(!requiredTag || entry.data.tags?.includes(requiredTag))
)
).sort((a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf());
return posts[0];
Expand Down
2 changes: 1 addition & 1 deletion packages/astro-theme/lib/callout.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function transition(cb) {

document.addEventListener("DOMContentLoaded", () => {
const callouts = document.querySelectorAll(
"blockquote[data-callout][data-expandable=true]",
"blockquote[data-callout][data-expandable=true]"
);
for (const callout of callouts) {
const title = callout.querySelector(".callout-title");
Expand Down
2 changes: 1 addition & 1 deletion packages/astro-theme/lib/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function getLocaleBasePaths(currentLocale: string | undefined): {
*/
export function getLocalisedPaths(
path: string,
currentLocale: string | undefined,
currentLocale: string | undefined
): { [locale: string]: string } {
if (!currentLocale) return {};

Expand Down
16 changes: 8 additions & 8 deletions packages/astro-theme/lib/nav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export async function getRootNav(): Promise<NavEntry[]> {
const parentDirEntries = dirPathToEntries[parentDir];
if (!parentDirEntries) {
throw new Error(
`panic: parent directory ${parentDir} not found for file ${filename}`,
`panic: parent directory ${parentDir} not found for file ${filename}`
);
}
const slug = idToSlug(file.id); // note: we don't allow slug override
Expand Down Expand Up @@ -181,7 +181,7 @@ export async function getRootNav(): Promise<NavEntry[]> {
}
if (numFiles !== files.length) {
throw new Error(
`panic: number of files in root nav (${numFiles}) does not match number of files in collection (${files.length})`,
`panic: number of files in root nav (${numFiles}) does not match number of files in collection (${files.length})`
);
}

Expand All @@ -190,11 +190,11 @@ export async function getRootNav(): Promise<NavEntry[]> {

export function findNavDirectory(
nav: NavEntry[],
pathComponents: string[],
pathComponents: string[]
): NavDirectory | undefined {
if (pathComponents.length === 0) {
throw new Error(
"pathComponents must not be empty; use getRootNav() to get the entries of the root directory",
"pathComponents must not be empty; use getRootNav() to get the entries of the root directory"
);
}

Expand All @@ -212,7 +212,7 @@ export function findNavDirectory(
}

export async function findParentDirectoryOfId(
id: string,
id: string
): Promise<NavDirectory | undefined> {
const [parentDir] = splitPath(id);
return findNavDirectory(await getRootNav(), parentDir.split("/"));
Expand Down Expand Up @@ -284,7 +284,7 @@ export function flattenNav(entries: NavEntry[]): NavEntry[] {
/** Returns an array of NavEntries that path to the given entry ID. */
export function findEntryPath(
nav: NavEntry[],
id: string,
id: string
): NavEntry[] | undefined {
function dfsVisit(entry: NavEntry, path: NavEntry[]): NavEntry[] | undefined {
if (entry.id === id) {
Expand Down Expand Up @@ -316,7 +316,7 @@ export function findEntry(nav: NavEntry[], id: string): NavEntry | undefined {
export function getLocalisedProductNav(
nav: NavEntry[],
product: Product,
locale: string | undefined,
locale: string | undefined
) {
nav = findNavDirectory(nav, [product])?.entries ?? nav; // for labs (multiple products on one site)

Expand All @@ -341,7 +341,7 @@ export function getLocalisedProductNav(

// Remove all language directories
nav = nav.filter(
(entry) => entry.type !== "directory" || !entry.isLanguageDirectory,
(entry) => entry.type !== "directory" || !entry.isLanguageDirectory
);

return nav;
Expand Down
2 changes: 1 addition & 1 deletion packages/astro-theme/lib/terminal-os-tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function getOs() {
document.addEventListener("DOMContentLoaded", () => {
const figures = document.querySelectorAll(
// ```shell blocks
".expressive-code figure.is-terminal",
".expressive-code figure.is-terminal"
);

const updateFuncs = [];
Expand Down
2 changes: 1 addition & 1 deletion packages/astro-theme/pages/blog/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const [post1, post2, ...restPosts] = (
await getCollection(
"blog",
({ data }) =>
data.draft !== true && (!product || data?.tags?.includes(product.name)),
data.draft !== true && (!product || data?.tags?.includes(product.name))
)
).sort((a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf());
---
Expand Down
2 changes: 1 addition & 1 deletion packages/astro-theme/tailwind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import plugin from "tailwindcss/plugin";
const exportColorsAsCssVariables = plugin(({ addBase, theme }) => {
function extractColorVars(
colorObj: RecursiveKeyValuePair,
colorGroup = "",
colorGroup = ""
): CSSRuleObject {
return Object.keys(colorObj).reduce((vars, colorKey) => {
const value = colorObj[colorKey]!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ fetchBuffer("pong.wasm")
(bytes) =>
WebAssembly.compile(bytes).then(
(m) => new WebAssembly.Instance(m, importObject),
console.log,
console.log
),
console.log,
console.log
)
.then((instance) => {
HEAP8 = new Uint8Array(instance.exports.memory.buffer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ fetchBuffer("pong.wasm")
(bytes) =>
WebAssembly.compile(bytes).then(
(m) => new WebAssembly.Instance(m, importObject),
console.log,
console.log
),
console.log,
console.log
)
.then((instance) => {
HEAP8 = new Uint8Array(instance.exports.memory.buffer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ fetchBuffer("pong.wasm")
(bytes) =>
WebAssembly.compile(bytes).then(
(m) => new WebAssembly.Instance(m, importObject),
console.log,
console.log
),
console.log,
console.log
)
.then((instance) => {
HEAP8 = new Uint8Array(instance.exports.memory.buffer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ fetchBuffer("pong.wasm")
(bytes) =>
WebAssembly.compile(bytes).then(
(m) => new WebAssembly.Instance(m, importObject),
console.log,
console.log
),
console.log,
console.log
)
.then((instance) => {
HEAP8 = new Uint8Array(instance.exports.memory.buffer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@ fetchBuffer("pong.wasm")
(bytes) =>
WebAssembly.compile(bytes).then(
(m) => new WebAssembly.Instance(m, importObject),
console.log,
console.log
),
console.log,
console.log
)
.then((instance) => {
HEAP8 = new Uint8Array(instance.exports.memory.buffer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ instantiateFunction({ absPath: "/absolute/path/to/yourModule.wasm" }).then(
(module) => {
console.log("Module has been instantiated!");
module.someJSExportedFunc();
},
}
);
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Alternatively, if your application is not designed to be executed with the comma
```js
cheerpjRunMain(
"com.application.MyClassName",
"/app/my_application_archive.jar:/app/my_dependency_archive.jar",
"/app/my_application_archive.jar:/app/my_dependency_archive.jar"
);
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ Alternatively, if the class name is in the `.jnlp` file but not in the manifest,
```js
cheerpjRunMain(
"com.application.MyClassName",
"/app/my_application_archive.jar:/app/lib/my_dependency_archive.jar",
"/app/my_application_archive.jar:/app/lib/my_dependency_archive.jar"
);
```

Expand Down
2 changes: 1 addition & 1 deletion sites/cheerpj/src/content/docs/11-guides/library-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ async function iTextExample() {
const document = await new Document();
const writer = await PdfWriter.getInstance(
document,
await new FileOutputStream("/files/HelloIText.pdf"),
await new FileOutputStream("/files/HelloIText.pdf")
);

await document.open();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const exitCode = await cheerpjRunMain(
"fully.qualified.ClassName",
"/app/my_application_archive.jar:/app/my_dependency_archive.jar",
arg1,
arg2,
arg2
);
console.log(`Program exited with code ${exitCode}`);
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description: Display GUI elements
function cheerpjCreateDisplay(
width: number,
height: number,
parent?: HTMLElement,
parent?: HTMLElement
): HTMLElement;
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ mkdir directory_name
```js
cheerpjRunMain(
"com.application.MyClassName",
"/app/my_application_archive.jar:/app/my_dependency_archive.jar",
"/app/my_application_archive.jar:/app/my_dependency_archive.jar"
);
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ CheerpJランタイムが統合され、Javaアプリケーションが表示さ
```js
cheerpjRunMain(
"com.application.MyClassName",
"/app/my_application_archive.jar:/app/lib/my_dependency_archive.jar",
"/app/my_application_archive.jar:/app/lib/my_dependency_archive.jar"
);
```

Expand Down
Loading
Loading