Skip to content

Commit 5093bb3

Browse files
committed
format
1 parent 3403f27 commit 5093bb3

46 files changed

Lines changed: 371 additions & 371 deletions

Some content is hidden

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

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ on:
44
push:
55
branches: [main]
66
paths-ignore:
7-
- "*.md"
7+
- '*.md'
88

99
pull_request:
1010
branches: [main]
1111
paths-ignore:
12-
- "*.md"
12+
- '*.md'
1313

1414
# Allows you to run this workflow manually from the Actions tab
1515
workflow_dispatch:
@@ -33,7 +33,7 @@ jobs:
3333
run: |
3434
pnpm install
3535
npx playwright install-deps chromium
36-
36+
3737
- name: Oxfmt
3838
run: |
3939
pnpm format:check

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
# the `language` matrix defined below to confirm you have the correct set of
1010
# supported CodeQL languages.
1111
#
12-
name: "CodeQL"
12+
name: 'CodeQL'
1313

1414
on:
1515
schedule:
16-
- cron: "39 18 * * 6"
16+
- cron: '39 18 * * 6'
1717

1818
jobs:
1919
analyze:
@@ -27,7 +27,7 @@ jobs:
2727
strategy:
2828
fail-fast: false
2929
matrix:
30-
language: ["javascript"]
30+
language: ['javascript']
3131
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
3232
# Learn more about CodeQL language support at https://git.io/codeql-language-support
3333

.releaserc.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ branches:
22
- main
33
- release-action
44
plugins:
5-
- - "@semantic-release/commit-analyzer"
5+
- - '@semantic-release/commit-analyzer'
66
- preset: conventionalcommits
7-
- "@semantic-release/release-notes-generator"
8-
- "@semantic-release/changelog"
9-
- - "@semantic-release/git"
7+
- '@semantic-release/release-notes-generator'
8+
- '@semantic-release/changelog'
9+
- - '@semantic-release/git'
1010
- assets:
1111
- CHANGELOG.md
12-
- - "@semantic-release/npm"
12+
- - '@semantic-release/npm'
1313
- pkgRoot: packages/code-kitchen/dist
14-
- "@semantic-release/github"
14+
- '@semantic-release/github'

docs/components/MDXPlayground.tsx

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
/* eslint-disable @typescript-eslint/no-var-requires */
22
/* eslint-disable react/prop-types */
3-
import cx from "classnames";
4-
import { Playground as ReactPlayground, setup } from "code-kitchen";
5-
import esbuildWasmMeta from "esbuild-wasm/package.json";
6-
import monacoEditorMeta from "monaco-editor/package.json";
7-
import React, { useId } from "react";
8-
import dependencies from "./dependencies";
9-
import { pre } from "./mdx";
10-
import { useInitMonaco } from "./use-init-monaco";
3+
import cx from 'classnames';
4+
import { Playground as ReactPlayground, setup } from 'code-kitchen';
5+
import esbuildWasmMeta from 'esbuild-wasm/package.json';
6+
import monacoEditorMeta from 'monaco-editor/package.json';
7+
import React, { useId } from 'react';
8+
import dependencies from './dependencies';
9+
import { pre } from './mdx';
10+
import { useInitMonaco } from './use-init-monaco';
1111

12-
const isProd = process.env.NODE_ENV === "production";
12+
const isProd = process.env.NODE_ENV === 'production';
1313

1414
setup({
1515
esbuildWasmPath:
16-
(isProd ? "/code-kitchen" : "") +
16+
(isProd ? '/code-kitchen' : '') +
1717
`/libs/esbuild-wasm/${esbuildWasmMeta.version}`,
1818
monacoEditorPath:
19-
(isProd ? "/code-kitchen" : "") +
19+
(isProd ? '/code-kitchen' : '') +
2020
`/libs/monaco-editor/${monacoEditorMeta.version}/min`
2121
});
2222

@@ -35,7 +35,7 @@ const customRequire = (key: string) => {
3535
return res;
3636
}
3737

38-
throw new Error("DEP: " + key + " not found");
38+
throw new Error('DEP: ' + key + ' not found');
3939
};
4040

4141
export const Playground = ({
@@ -52,7 +52,7 @@ export const Playground = ({
5252
name?: string;
5353
className?: string;
5454
live?: boolean;
55-
dir?: "v" | "h";
55+
dir?: 'v' | 'h';
5656
}) => {
5757
const hasMounted = useHasMounted();
5858

@@ -67,25 +67,25 @@ export const Playground = ({
6767

6868
const files = codeSnippets
6969
.map((codeSnippet: React.ReactElement, index) => {
70-
if (codeSnippet.type !== "pre" && codeSnippet.type !== pre) {
70+
if (codeSnippet.type !== 'pre' && codeSnippet.type !== pre) {
7171
return undefined;
7272
}
7373
const { props } = codeSnippet.props.children;
74-
const lang = props.className.split("language-")[1];
74+
const lang = props.className.split('language-')[1];
7575

76-
let filename = ""; // path in the folder structure
76+
let filename = ''; // path in the folder structure
7777
let hidden = false; // if the file is available as a tab
7878

7979
if (props.metastring) {
80-
const [_filename, ...params] = props.metastring.split(" ");
80+
const [_filename, ...params] = props.metastring.split(' ');
8181
filename = _filename;
82-
if (params.includes("hidden")) {
82+
if (params.includes('hidden')) {
8383
hidden = true;
8484
}
8585
} else {
8686
// The first file is always entryfile
87-
if (["ts", "tsx", "js", "jsx"].includes(lang) && index === 0) {
88-
filename = "App.jsx";
87+
if (['ts', 'tsx', 'js', 'jsx'].includes(lang) && index === 0) {
88+
filename = 'App.jsx';
8989
} else {
9090
throw new Error(
9191
`Code block is missing a filename: ${props.children}`
@@ -107,7 +107,7 @@ export const Playground = ({
107107
name={name}
108108
initialFiles={files}
109109
require={customRequire}
110-
className={cx(className, "my-8 h-[512px] relative")}
110+
className={cx(className, 'my-8 h-[512px] relative')}
111111
live={live}
112112
dir={dir}
113113
/>

docs/components/dependencies.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import * as React from "react";
2-
import * as demoLib from "demo-lib";
1+
import * as React from 'react';
2+
import * as demoLib from 'demo-lib';
33

44
const dependencies = {
55
react: React,
6-
"demo-lib": demoLib
6+
'demo-lib': demoLib
77
};
88

99
export default dependencies;

docs/components/mdx.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable react/prop-types */
2-
import * as React from "react";
2+
import * as React from 'react';
33

44
export const h1 = ({ children }) => {
55
return (
@@ -43,7 +43,7 @@ export const p = ({ children }) => {
4343

4444
export const ul = ({ children }) => {
4545
return (
46-
<ul className={"font-sans leading-relaxed list-disc pl-10 my-2"}>
46+
<ul className={'font-sans leading-relaxed list-disc pl-10 my-2'}>
4747
{children}
4848
</ul>
4949
);

docs/components/use-init-monaco.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
/* eslint-disable @typescript-eslint/no-var-requires */
2-
import { useMonaco } from "code-kitchen";
3-
import React from "react";
2+
import { useMonaco } from 'code-kitchen';
3+
import React from 'react';
44

55
let typesLoaded = false;
66

77
// Ref
88
// https://github1s.com/reactjs/reactjs.org/blob/main/beta/src/components/MDX/Sandpack/index.tsx
99

10-
const reactTyping = require("!raw-loader?esModule=false!../node_modules/@types/react/index.d.ts");
11-
const demoLibSrc = require("!raw-loader?esModule=false!../node_modules/demo-lib/index.tsx");
10+
const reactTyping = require('!raw-loader?esModule=false!../node_modules/@types/react/index.d.ts');
11+
const demoLibSrc = require('!raw-loader?esModule=false!../node_modules/demo-lib/index.tsx');
1212

13-
const filePrefix = "file:///";
14-
const typesPrefix = "node_modules/@types";
13+
const filePrefix = 'file:///';
14+
const typesPrefix = 'node_modules/@types';
1515

1616
export const useInitMonaco = () => {
1717
const monaco = useMonaco();

docs/lib/posts.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
import fsp from "fs/promises";
2-
import remarkGfm from "remark-gfm";
1+
import fsp from 'fs/promises';
2+
import remarkGfm from 'remark-gfm';
33

4-
import { serialize } from "next-mdx-remote/serialize";
4+
import { serialize } from 'next-mdx-remote/serialize';
55

6-
import path from "path";
6+
import path from 'path';
77

8-
import { codeMetaPlugin } from "./rehype-code-meta";
8+
import { codeMetaPlugin } from './rehype-code-meta';
99

10-
const postsDirectory = path.join(process.cwd(), "posts");
10+
const postsDirectory = path.join(process.cwd(), 'posts');
1111

1212
export async function getPostsData() {
1313
// Get file names under /posts
1414
const fileNames = await fsp.readdir(postsDirectory);
1515
const allPostsData = await Promise.all(
1616
fileNames.map(async (fileName) => {
1717
// Remove ".mdx" from file name to get id
18-
const id = fileName.replace(/\.mdx$/, "");
18+
const id = fileName.replace(/\.mdx$/, '');
1919

2020
// Combine the data with the id
2121
return {
@@ -30,7 +30,7 @@ export async function getPostsData() {
3030

3131
export async function getPostData(id: string) {
3232
const fullPath = path.join(postsDirectory, `${id}.mdx`);
33-
const source = await fsp.readFile(fullPath, "utf8");
33+
const source = await fsp.readFile(fullPath, 'utf8');
3434

3535
const mdxSource = await serialize(source, {
3636
mdxOptions: {

docs/lib/rehype-code-meta.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { visit } from "unist-util-visit";
1+
import { visit } from 'unist-util-visit';
22

33
export const codeMetaPlugin = () => {
44
return (tree) => {
5-
visit(tree, "element", (node) => {
6-
if (node.tagName === "code" && node.data && node.data.meta) {
5+
visit(tree, 'element', (node) => {
6+
if (node.tagName === 'code' && node.data && node.data.meta) {
77
node.properties.metastring = node.data.meta;
88
}
99
});

docs/lib/rehype-shiki.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// Credits: https://github.com/mdx-js/mdx/discussions/1939#discussioncomment-2214962
2-
import rehypeParse from "rehype-parse";
3-
import * as shiki from "shiki";
4-
import { unified } from "unified";
5-
import { visit } from "unist-util-visit";
2+
import rehypeParse from 'rehype-parse';
3+
import * as shiki from 'shiki';
4+
import { unified } from 'unified';
5+
import { visit } from 'unist-util-visit';
66

7-
const themes = ["github-light"];
7+
const themes = ['github-light'];
88

99
export const rehypeShiki = () => async (tree) => {
1010
const highlighter = await shiki.getHighlighter({ themes });
@@ -13,20 +13,20 @@ export const rehypeShiki = () => async (tree) => {
1313
// If child is pre, but it contains no code
1414
if (
1515
!(
16-
node.tagName === "pre" &&
17-
node.children?.[0]?.tagName === "code" &&
16+
node.tagName === 'pre' &&
17+
node.children?.[0]?.tagName === 'code' &&
1818
node.children?.[0]?.properties?.className?.[0].startsWith(
19-
"language-"
19+
'language-'
2020
) &&
21-
node.children?.[0]?.children?.[0]?.type === "text"
21+
node.children?.[0]?.children?.[0]?.type === 'text'
2222
)
2323
) {
2424
return;
2525
}
2626

2727
const code = node.children[0].children[0].value;
2828
const lang = node.children[0].properties.className[0].slice(
29-
"language-".length
29+
'language-'.length
3030
);
3131

3232
parent.children.splice(

0 commit comments

Comments
 (0)