From 39a8fca8fa1715e3f97a9e63b3082e7e0290d1de Mon Sep 17 00:00:00 2001 From: Jianmin Chen <59099858+jianmin-chen@users.noreply.github.com> Date: Thu, 30 Nov 2023 10:34:18 -0500 Subject: [PATCH] Run Prettier --- astro/.gitignore | 3 +- .prettierignore => astro/.prettierignore | 4 +- .prettierrc => astro/.prettierrc | 0 astro/astro.config.mjs | 8 +- astro/package.json | 2 +- astro/public/masonry.min.js | 56 +- astro/src/components/CodeMirror.module.css | 1 - astro/src/components/DropBox.tsx | 8 +- astro/src/components/Editor.module.css | 2 - astro/src/components/Editor.tsx | 20 +- astro/src/components/Error.tsx | 12 +- astro/src/components/Help.module.css | 2 +- astro/src/components/Help.tsx | 31 +- astro/src/components/Navbar.astro | 8 +- astro/src/components/Preview.tsx | 29 +- astro/src/components/Toolbar.tsx | 70 +- astro/src/components/landing/Background.astro | 32 +- .../src/components/landing/ThreeDModel.astro | 24 +- astro/src/css/global.css | 4 +- astro/src/css/reset.css | 41 +- astro/src/env.d.ts | 13 +- astro/src/layouts/Layout.astro | 6 +- astro/src/lib/codemirror/state.ts | 6 +- astro/src/lib/codemirror/widgetButtons.ts | 115 +- .../lib/drawingToolkit/drawingFns/simplify.js | 122 +- .../lib/drawingToolkit/flatten-svg/index.ts | 4 +- astro/src/lib/drawingToolkit/pipe.ts | 4 +- astro/src/lib/drawingToolkit/turtle.ts | 38 +- astro/src/lib/events/addBezierControl.js | 145 +- astro/src/lib/events/addMachineControl.js | 45 +- astro/src/lib/events/addNumberScrubbing.ts | 75 +- astro/src/lib/events/addSrcURLParam.js | 4 +- astro/src/lib/getBitmap.js | 98 +- astro/src/lib/init.js | 27 +- astro/src/lib/lineclip.ts | 12 +- astro/src/lib/removeQueryParam.js | 22 +- astro/src/lib/render.tsx | 4 +- astro/src/lib/run.ts | 69 +- astro/src/lib/runTextReturnTurtles.ts | 12 +- astro/src/lib/saveFile.ts | 63 +- astro/src/lib/state.ts | 8 +- astro/src/pages/assembly.astro | 1 - astro/src/pages/editor.astro | 13 +- astro/src/pages/gallery.astro | 42 +- astro/src/pages/guides.astro | 53 +- astro/src/pages/index.astro | 238 +- astro/src/pages/test.astro | 5 +- astro/src/ui/Button.tsx | 8 +- astro/tailwind.config.mjs | 10 +- astro/yarn-error.log | 6543 ----------------- 50 files changed, 847 insertions(+), 7315 deletions(-) rename .prettierignore => astro/.prettierignore (65%) rename .prettierrc => astro/.prettierrc (100%) delete mode 100644 astro/yarn-error.log diff --git a/astro/.gitignore b/astro/.gitignore index e555fbc8d..ee4be6c9a 100644 --- a/astro/.gitignore +++ b/astro/.gitignore @@ -1,4 +1,5 @@ node_modules .vercel .astro -dist \ No newline at end of file +dist +yarn-error.log \ No newline at end of file diff --git a/.prettierignore b/astro/.prettierignore similarity index 65% rename from .prettierignore rename to astro/.prettierignore index 2c4496072..2787b62ac 100644 --- a/.prettierignore +++ b/astro/.prettierignore @@ -3,6 +3,4 @@ package-lock.json public/* .next/* .vercel/* -*/.vercel -*/*/*.mdx -*/*/*/*.mdx \ No newline at end of file +*/.vercel \ No newline at end of file diff --git a/.prettierrc b/astro/.prettierrc similarity index 100% rename from .prettierrc rename to astro/.prettierrc diff --git a/astro/astro.config.mjs b/astro/astro.config.mjs index e4e8ace16..2fb05e00d 100644 --- a/astro/astro.config.mjs +++ b/astro/astro.config.mjs @@ -1,10 +1,10 @@ -import { defineConfig } from 'astro/config'; -import preact from '@astrojs/preact'; +import { defineConfig } from 'astro/config' +import preact from '@astrojs/preact' -import tailwind from "@astrojs/tailwind"; +import tailwind from '@astrojs/tailwind' // https://astro.build/config export default defineConfig({ site: 'https://blot.hackclub.com', integrations: [preact(), tailwind()] -}); \ No newline at end of file +}) diff --git a/astro/package.json b/astro/package.json index c0c3a854d..2233a5c86 100644 --- a/astro/package.json +++ b/astro/package.json @@ -10,7 +10,7 @@ "preview": "astro preview", "sync": "astro sync", "astro": "astro", - "format": "prettier --ignore-path ../.prettierignore --write . --plugin=prettier-plugin-astro" + "format": "prettier --ignore-path ./.prettierignore --write . --plugin=prettier-plugin-astro" }, "dependencies": { "@astrojs/check": "^0.2.0", diff --git a/astro/public/masonry.min.js b/astro/public/masonry.min.js index 54dc2f1d3..a476807c8 100644 --- a/astro/public/masonry.min.js +++ b/astro/public/masonry.min.js @@ -12,8 +12,8 @@ return e(t, i) }) : 'object' == typeof module && module.exports - ? (module.exports = e(t, require('jquery'))) - : (t.jQueryBridget = e(t, t.jQuery)) + ? (module.exports = e(t, require('jquery'))) + : (t.jQueryBridget = e(t, t.jQuery)) })(window, function (t, e) { 'use strict' function i(i, r, a) { @@ -74,8 +74,8 @@ 'function' == typeof define && define.amd ? define('ev-emitter/ev-emitter', e) : 'object' == typeof module && module.exports - ? (module.exports = e()) - : (t.EvEmitter = e()) + ? (module.exports = e()) + : (t.EvEmitter = e()) })('undefined' != typeof window ? window : this, function () { function t() {} var e = t.prototype @@ -128,8 +128,8 @@ 'function' == typeof define && define.amd ? define('get-size/get-size', e) : 'object' == typeof module && module.exports - ? (module.exports = e()) - : (t.getSize = e()) + ? (module.exports = e()) + : (t.getSize = e()) })(window, function () { 'use strict' function t(t) { @@ -256,8 +256,8 @@ 'function' == typeof define && define.amd ? define('desandro-matches-selector/matches-selector', e) : 'object' == typeof module && module.exports - ? (module.exports = e()) - : (t.matchesSelector = e()) + ? (module.exports = e()) + : (t.matchesSelector = e()) })(window, function () { 'use strict' var t = (function () { @@ -284,8 +284,8 @@ } ) : 'object' == typeof module && module.exports - ? (module.exports = e(t, require('desandro-matches-selector'))) - : (t.fizzyUIUtils = e(t, t.matchesSelector)) + ? (module.exports = e(t, require('desandro-matches-selector'))) + : (t.fizzyUIUtils = e(t, t.matchesSelector)) })(window, function (t, e) { var i = {} ;(i.extend = function (t, e) { @@ -397,8 +397,8 @@ e ) : 'object' == typeof module && module.exports - ? (module.exports = e(require('ev-emitter'), require('get-size'))) - : ((t.Outlayer = {}), (t.Outlayer.Item = e(t.EvEmitter, t.getSize))) + ? (module.exports = e(require('ev-emitter'), require('get-size'))) + : ((t.Outlayer = {}), (t.Outlayer.Item = e(t.EvEmitter, t.getSize))) })(window, function (t, e) { 'use strict' function i(t) { @@ -690,20 +690,20 @@ } ) : 'object' == typeof module && module.exports - ? (module.exports = e( - t, - require('ev-emitter'), - require('get-size'), - require('fizzy-ui-utils'), - require('./item') - )) - : (t.Outlayer = e( - t, - t.EvEmitter, - t.getSize, - t.fizzyUIUtils, - t.Outlayer.Item - )) + ? (module.exports = e( + t, + require('ev-emitter'), + require('get-size'), + require('fizzy-ui-utils'), + require('./item') + )) + : (t.Outlayer = e( + t, + t.EvEmitter, + t.getSize, + t.fizzyUIUtils, + t.Outlayer.Item + )) })(window, function (t, e, i, n, o) { 'use strict' function r(t, e) { @@ -1115,8 +1115,8 @@ 'function' == typeof define && define.amd ? define(['outlayer/outlayer', 'get-size/get-size'], e) : 'object' == typeof module && module.exports - ? (module.exports = e(require('outlayer'), require('get-size'))) - : (t.Masonry = e(t.Outlayer, t.getSize)) + ? (module.exports = e(require('outlayer'), require('get-size'))) + : (t.Masonry = e(t.Outlayer, t.getSize)) })(window, function (t, e) { var i = t.create('masonry') i.compatOptions.fitWidth = 'isFitWidth' diff --git a/astro/src/components/CodeMirror.module.css b/astro/src/components/CodeMirror.module.css index 260bee148..b0e8e28eb 100644 --- a/astro/src/components/CodeMirror.module.css +++ b/astro/src/components/CodeMirror.module.css @@ -6,4 +6,3 @@ height: 100%; width: 100%; } - diff --git a/astro/src/components/DropBox.tsx b/astro/src/components/DropBox.tsx index 41cf1bb79..4313a0d65 100644 --- a/astro/src/components/DropBox.tsx +++ b/astro/src/components/DropBox.tsx @@ -9,7 +9,8 @@ export default function DropBox() { }, []) // Empty dependency array means this effect runs once after initial render return ( -
-
+
+
{' '.repeat(pos.column)}
↑
{message && }
@@ -106,15 +106,11 @@ export default function Error() {
const { error } = getStore()
if (!error) return null
-
+
return (
{error.name}
-
+
)
}
diff --git a/astro/src/components/Help.module.css b/astro/src/components/Help.module.css
index e0e13f427..17093eb11 100644
--- a/astro/src/components/Help.module.css
+++ b/astro/src/components/Help.module.css
@@ -87,4 +87,4 @@ body[data-theme='dark'] .helpContent hr {
body[data-theme='dark'] .helpContent img {
background-color: white;
-}
\ No newline at end of file
+}
diff --git a/astro/src/components/Help.tsx b/astro/src/components/Help.tsx
index 1ef6cbe75..9dd7b28da 100644
--- a/astro/src/components/Help.tsx
+++ b/astro/src/components/Help.tsx
@@ -1,14 +1,14 @@
import styles from './Help.module.css'
import { useState, useEffect } from 'preact/hooks'
import { marked } from 'marked'
-import { loadCodeFromString } from "../lib/loadCodeFromString.ts";
+import { loadCodeFromString } from '../lib/loadCodeFromString.ts'
marked.setOptions({
- highlight: function (code, language) {
- const validLanguage = Prism.languages[language] ? language : 'markup';
- return Prism.highlight(code, Prism.languages[validLanguage], validLanguage);
- }
-});
+ highlight: function (code, language) {
+ const validLanguage = Prism.languages[language] ? language : 'markup'
+ return Prism.highlight(code, Prism.languages[validLanguage], validLanguage)
+ }
+})
export default function Help({
toggleClose,
@@ -28,7 +28,7 @@ export default function Help({
htmlContent: ''
})
- const [helpContent, setHelpContent] = useState("");
+ const [helpContent, setHelpContent] = useState('')
useEffect(() => {
const fetchData = async () => {
@@ -37,12 +37,12 @@ export default function Help({
)
const helpData = await helpRes.text()
- setHelpContent(marked(helpData));
+ setHelpContent(marked(helpData))
if (workshop === null) return
-
- if (confirm("Clear text editor?")) loadCodeFromString(`// Check the workshop tab to get started
+ if (confirm('Clear text editor?'))
+ loadCodeFromString(`// Check the workshop tab to get started
const width = 125;
const height = 125;
@@ -61,8 +61,7 @@ testTurtle.translate(
drawTurtles([
testTurtle
]);
-`);
-
+`)
const res = await fetch(
`https://raw.githubusercontent.com/hackclub/blot/main/guides/${workshop}.md`
@@ -71,8 +70,8 @@ drawTurtles([
const result = parseMDFrontMatter(data)
- setWorkshopContent(result);
- setTab('workshop');
+ setWorkshopContent(result)
+ setTab('workshop')
}
fetchData()
@@ -80,7 +79,9 @@ drawTurtles([
return (
<>
-
+