Skip to content

Commit

Permalink
Everywhere: Run prettier on everything
Browse files Browse the repository at this point in the history
This commit also brings in the prettierrc file from serenity proper.
  • Loading branch information
alimpfard committed Nov 5, 2023
1 parent 08b7cd1 commit 8f01dfa
Show file tree
Hide file tree
Showing 12 changed files with 1,342 additions and 1,432 deletions.
13 changes: 13 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"arrowParens": "avoid",
"bracketSpacing": true,
"endOfLine": "lf",
"insertPragma": false,
"printWidth": 100,
"quoteProps": "as-needed",
"semi": true,
"singleQuote": false,
"tabWidth": 4,
"trailingComma": "es5",
"useTabs": false
}
60 changes: 30 additions & 30 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>LibJS JavaScript engine</title>
<link rel="shortcut icon" type="image/png" href="favicon.png" />
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>LibJS JavaScript engine</title>
<link rel="shortcut icon" type="image/png" href="favicon.png" />
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

body {
background-color: #191922;
padding: 20px;
font-size: 1rem;
}
body {
background-color: #191922;
padding: 20px;
font-size: 1rem;
}

code .comment {
color: #2aa62a;
}
code .comment {
color: #2aa62a;
}

code a,
code a:active,
code a:visited {
color: inherit;
}
</style>
</head>
code a,
code a:active,
code a:visited {
color: inherit;
}
</style>
</head>

<body>
<pre><code><span class="comment">// Website for SerenityOS's JavaScript engine, LibJS.
<body>
<pre><code><span class="comment">// Website for SerenityOS's JavaScript engine, LibJS.
//
// For details visit <a href="https://github.com/SerenityOS/serenity" target="_blank" rel="noopener noreferrer">https://github.com/SerenityOS/serenity</a>.
//
Expand All @@ -42,5 +42,5 @@
//
// If you're a SerenityOS contributor and want to change something
// here, open a PR in <a href="https://github.com/SerenityOS/libjs-website">this repository</a>.</span></code></pre>
</body>
</body>
</html>
141 changes: 67 additions & 74 deletions repl/index.html
Original file line number Diff line number Diff line change
@@ -1,78 +1,71 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>LibJS REPL</title>
<link rel="shortcut icon" type="image/png" href="../favicon.png" />
<link rel="stylesheet" href="main.css" />
<link rel="stylesheet" href="../test262/main.css" />
<link rel="preconnect" href="https://fonts.gstatic.com" />
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Montserrat:wght@700&family=Roboto:wght@400;700&display=swap"
/>
</head>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>LibJS REPL</title>
<link rel="shortcut icon" type="image/png" href="../favicon.png" />
<link rel="stylesheet" href="main.css" />
<link rel="stylesheet" href="../test262/main.css" />
<link rel="preconnect" href="https://fonts.gstatic.com" />
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Montserrat:wght@700&family=Roboto:wght@400;700&display=swap"
/>
</head>

<body>
<main>
<h1>LibJS REPL<span id="header-description"></span></h1>
<div id="main-content" style="display: none">
<small id="input-editor-tip">press 'ctrl+enter' to run</small>
<small id="input-tip" style="display: none">press 'enter' to run</small>
<div id="repl">
<div id="input">
<div id="input-textarea">
<textarea large id="input-textarea-editor"></textarea>
<body>
<main>
<h1>LibJS REPL<span id="header-description"></span></h1>
<div id="main-content" style="display: none">
<small id="input-editor-tip">press 'ctrl+enter' to run</small>
<small id="input-tip" style="display: none">press 'enter' to run</small>
<div id="repl">
<div id="input">
<div id="input-textarea">
<textarea large id="input-textarea-editor"></textarea>
</div>
</div>
<button id="input-toggle" class="input-shown" title="Toggle input editor">
&lt;
</button>
<button id="run">Run!</button>
<div id="repl-window">
<div id="repl-contents"></div>
</div>
</div>
</div>
</div>
<button
id="input-toggle"
class="input-shown"
title="Toggle input editor"
>
&lt;
</button>
<button id="run">Run!</button>
<div id="repl-window">
<div id="repl-contents"></div>
</div>
</div>
</div>
<div id="loading-content">
<span id="loading-text">Loading...</span>
<progress id="loading-progress"></progress>
</div>
</main>
<footer>
Made by
<a
href="https://twitter.com/the_semicolon_"
target="_blank"
rel="noopener noreferrer"
>CxByte</a
>.
</footer>
<template id="repl-input-template">
<div class="repl-input-line">
<pre>&gt;</pre>
<textarea></textarea>
</div>
</template>
<template id="repl-static-input-template">
<div class="repl-input-line">
<pre>&gt; </pre>
<pre class="content"></pre>
</div>
</template>
<template id="repl-output-template">
<div class="repl-output-line">
<pre></pre>
</div>
</template>
<script src="https://unpkg.com/unfetch/polyfill"></script>
<script src="https://serenityos.github.io/libjs-data/libjs.js"></script>
<script src="repl.js"></script>
<script src="main.js"></script>
</body>
<div id="loading-content">
<span id="loading-text">Loading...</span>
<progress id="loading-progress"></progress>
</div>
</main>
<footer>
Made by
<a href="https://twitter.com/the_semicolon_" target="_blank" rel="noopener noreferrer"
>CxByte</a
>.
</footer>
<template id="repl-input-template">
<div class="repl-input-line">
<pre>&gt;</pre>
<textarea></textarea>
</div>
</template>
<template id="repl-static-input-template">
<div class="repl-input-line">
<pre>&gt; </pre>
<pre class="content"></pre>
</div>
</template>
<template id="repl-output-template">
<div class="repl-output-line">
<pre></pre>
</div>
</template>
<script src="https://unpkg.com/unfetch/polyfill"></script>
<script src="https://serenityos.github.io/libjs-data/libjs.js"></script>
<script src="repl.js"></script>
<script src="main.js"></script>
</body>
</html>
100 changes: 49 additions & 51 deletions repl/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
const inputTemplate = document.getElementById("repl-input-template");
const staticInputTemplate = document.getElementById(
"repl-static-input-template"
);
const staticInputTemplate = document.getElementById("repl-static-input-template");
const outputTemplate = document.getElementById("repl-output-template");
const inputElement = document.getElementById("input");
const inputTextArea = inputElement.querySelector("textarea");
Expand All @@ -13,59 +11,59 @@ const loadingProgress = document.getElementById("loading-progress");
const headerDescriptionSpan = document.getElementById("header-description");

(async function () {
function updateLoading(name, { loaded, total, known }) {
loadingText.innerText = `Loading ${name}...`;
if (known) {
loadingProgress.max = total;
loadingProgress.value = loaded;
} else {
delete loadingProgress.max;
delete loadingProgress.value;
function updateLoading(name, { loaded, total, known }) {
loadingText.innerText = `Loading ${name}...`;
if (known) {
loadingProgress.max = total;
loadingProgress.value = loaded;
} else {
delete loadingProgress.max;
delete loadingProgress.value;
}
}
}

const repl = await createREPL({
inputTemplate,
staticInputTemplate,
outputTemplate,
inputElement,
inputTextArea,
outputElement,
updateLoading,
});
const repl = await createREPL({
inputTemplate,
staticInputTemplate,
outputTemplate,
inputElement,
inputTextArea,
outputElement,
updateLoading,
});

const buildHash = Module.SERENITYOS_COMMIT;
const shortenedBuildHash = buildHash.substring(0, 7);
headerDescriptionSpan.innerHTML = ` (built from <a href="https://github.com/serenityos/serenity/commit/${buildHash}">${shortenedBuildHash}</a>)`;
const buildHash = Module.SERENITYOS_COMMIT;
const shortenedBuildHash = buildHash.substring(0, 7);
headerDescriptionSpan.innerHTML = ` (built from <a href="https://github.com/serenityos/serenity/commit/${buildHash}">${shortenedBuildHash}</a>)`;

loadingContainer.style.display = "none";
mainContainer.style.display = "";
loadingContainer.style.display = "none";
mainContainer.style.display = "";

repl.display("Ready!");
inputTextArea.focus();
repl.display("Ready!");
inputTextArea.focus();

const inputToggleButton = document.getElementById("input-toggle");
const inputEditorTip = document.getElementById("input-editor-tip");
const inputTip = document.getElementById("input-tip");
const inputToggleButton = document.getElementById("input-toggle");
const inputEditorTip = document.getElementById("input-editor-tip");
const inputTip = document.getElementById("input-tip");

inputToggleButton.addEventListener("click", () => {
if (inputToggleButton.classList.contains("input-shown")) {
inputToggleButton.classList.remove("input-shown");
inputToggleButton.classList.add("input-hidden");
inputToggleButton.textContent = ">";
inputElement.style.display = "none";
inputEditorTip.style.display = "none";
inputTip.style.display = "";
repl.allowDirectInput();
} else {
inputToggleButton.classList.remove("input-hidden");
inputToggleButton.classList.add("input-shown");
inputToggleButton.textContent = "<";
inputElement.style.display = "";
inputEditorTip.style.display = "";
inputTip.style.display = "none";
repl.prohibitDirectInput();
inputTextArea.focus();
}
});
inputToggleButton.addEventListener("click", () => {
if (inputToggleButton.classList.contains("input-shown")) {
inputToggleButton.classList.remove("input-shown");
inputToggleButton.classList.add("input-hidden");
inputToggleButton.textContent = ">";
inputElement.style.display = "none";
inputEditorTip.style.display = "none";
inputTip.style.display = "";
repl.allowDirectInput();
} else {
inputToggleButton.classList.remove("input-hidden");
inputToggleButton.classList.add("input-shown");
inputToggleButton.textContent = "<";
inputElement.style.display = "";
inputEditorTip.style.display = "";
inputTip.style.display = "none";
repl.prohibitDirectInput();
inputTextArea.focus();
}
});
})();
Loading

0 comments on commit 8f01dfa

Please sign in to comment.