Skip to content
Closed
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
1 change: 1 addition & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ contaienr = "contaienr"
formate = "formate"
collapsable = "collapsable"
styl = "styl"
Inferrable = "Inferrable"
68 changes: 65 additions & 3 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,80 @@
"noForEach": "warn",
"noStaticOnlyClass": "error",
"noUselessSwitchCase": "error",
"useFlatMap": "error"
"useFlatMap": "error",
"noExtraBooleanCast": "warn",
"noMultipleSpacesInRegularExpressionLiterals": "error",
"noThisInStatic": "warn",
"noUselessCatch": "error",
"noUselessConstructor": "error",
"noUselessFragments": "error",
"noUselessLabel": "error",
"noUselessLoneBlockStatements": "error",
"noUselessRename": "error",
"noUselessTernary": "warn",
"noUselessThisAlias": "error",
"noWith": "error",
"useArrowFunction": "warn",
"useOptionalChain": "warn",
"useSimpleNumberKeys": "error"
},
"performance": {
"noAccumulatingSpread": "error",
"noDelete": "warn"
},
"style": {
"noNegationElse": "off",
"useForOf": "error",
"useNodejsImportProtocol": "error",
"useNumberNamespace": "error"
"useNumberNamespace": "error",
"noInferrableTypes": "error",
"noNonNullAssertion": "error",
"noParameterAssign": "off",
"noUnusedTemplateLiteral": "warn",
"noUselessElse": "warn",
"useConst": "warn",
"useExponentiationOperator": "warn",
"useNumericLiterals": "error",
"useWhile": "error"
},
"security": {
"noDangerouslySetInnerHtml": "error",
"noDangerouslySetInnerHtmlWithChildren": "error",
"noGlobalEval": "warn"
},
"suspicious": {
"noDoubleEquals": "error",
"noThenProperty": "error",
"useIsArray": "error"
"useIsArray": "error",
"noApproximativeNumericConstant": "error",
"noArrayIndexKey": "error",
"noAsyncPromiseExecutor": "warn",
"noCatchAssign": "error",
"noClassAssign": "error",
"noCommentText": "error",
"noCompareNegZero": "error",
"noConfusingLabels": "error",
"noControlCharactersInRegex": "error",
"noDuplicateClassMembers": "error",
"noDuplicateJsxProps": "error",
"noDuplicateObjectKeys": "error",
"noDuplicateParameters": "error",
"noEmptyBlockStatements": "warn",
"noGlobalAssign": "error",
"noGlobalIsFinite": "error",
"noGlobalIsNan": "warn",
"noMisrefactoredShorthandAssign": "error",
"noPrototypeBuiltins": "warn",
"noRedeclare": "error",
"noRedundantUseStrict": "error",
"noSelfCompare": "error",
"noShadowRestrictedNames": "error",
"noSparseArray": "error",
"noSuspiciousSemicolonInJsx": "error",
"noUnsafeNegation": "error",
"useDefaultSwitchClauseLast": "error",
"useGetterReturn": "error",
"useValidTypeof": "error"
}
}
},
Expand Down
8 changes: 4 additions & 4 deletions src/ace/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,9 @@ const commands = [
name: "cut",
description: "Cut",
exec(editor) {
let cutLine =
const cutLine =
editor.$copyWithEmptySelection && editor.selection.isEmpty();
let range = cutLine
const range = cutLine
? editor.selection.getLineRange()
: editor.selection.getRange();
editor._emit("cut", range);
Expand Down Expand Up @@ -285,7 +285,7 @@ const commands = [
name: "increaseFontSize",
description: "Increase font size",
exec(editor) {
let size = Number.parseInt(editor.getFontSize(), 10) || 12;
const size = Number.parseInt(editor.getFontSize(), 10) || 12;
editor.setFontSize(size + 1);
settings.value.fontSize = size + 1 + "px";
settings.update(false);
Expand All @@ -295,7 +295,7 @@ const commands = [
name: "decreaseFontSize",
description: "Decrease font size",
exec(editor) {
let size = Number.parseInt(editor.getFontSize(), 10) || 12;
const size = Number.parseInt(editor.getFontSize(), 10) || 12;
editor.setFontSize(Math.max(size - 1 || 1));
settings.value.fontSize = Math.max(size - 1 || 1) + "px";
settings.update(false);
Expand Down
9 changes: 4 additions & 5 deletions src/ace/modelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ export function initModes() {
ace.define(
"ace/ext/modelist",
["require", "exports", "module"],
function (require, exports, module) {
(require, exports, module) => {
module.exports = {
getModeForPath(path) {
let mode = modesByName.text;
let fileName = path.split(/[\/\\]/).pop();
const fileName = path.split(/[\/\\]/).pop();
for (const iMode of modes) {
if (iMode.supportsFile?.(fileName)) {
mode = iMode;
Expand Down Expand Up @@ -81,9 +81,8 @@ class Mode {

if (/\^/.test(extensions)) {
re =
extensions.replace(/\|(\^)?/g, function (a, b) {
return "$|" + (b ? "^" : "^.*\\.");
}) + "$";
extensions.replace(/\|(\^)?/g, (a, b) => "$|" + (b ? "^" : "^.*\\.")) +
"$";
} else {
re = "^.*\\.(" + extensions + ")$";
}
Expand Down
6 changes: 3 additions & 3 deletions src/ace/touchHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -548,9 +548,9 @@ export default function addTouchListeners(editor, minimal, onclick) {
* @param {number} y
*/
function scroll(x, y) {
let direction = reverseScrolling ? 1 : -1;
let scrollX = direction * x;
let scrollY = direction * y;
const direction = reverseScrolling ? 1 : -1;
const scrollX = direction * x;
const scrollY = direction * y;

renderer.scrollBy(scrollX, scrollY);
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/WebComponents/wcPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default class WCPage extends HTMLElement {
}

appendBody(...$els) {
let $main = this.body;
const $main = this.body;
if (!$main) return;
for (const $el of $els) {
$main.append($el);
Expand Down Expand Up @@ -262,7 +262,7 @@ class PageHandler {
*/
function handlePagesForSmoothExperience() {
const $pages = [...tag.getAll("wc-page")];
for (let $page of $pages.slice(0, -1)) {
for (const $page of $pages.slice(0, -1)) {
$page.handler.replaceEl();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/contextmenu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export default function Contextmenu(content, options) {
function addTabindex() {
/**@type {Array<HTMLLIElement>} */
const children = [...$el.children];
for (let $el of children) $el.tabIndex = "0";
for (const $el of children) $el.tabIndex = "0";
}

function destroy() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import WCPage from "./WebComponents/wcPage";
* @returns {WCPage}
*/
function Page(title, options = {}) {
let page = <wc-page />;
const page = <wc-page />;
page.append = page.appendBody;
page.initializeIfNotAlreadyInitialized();
page.settitle(title);
Expand Down
2 changes: 1 addition & 1 deletion src/components/scrollbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default function ScrollBar(options) {
const isVertical = placement === "right" || placement === "left";
const observer = new MutationObserver(observerCallback);
let scroll = 0;
let touchStartValue = {
const touchStartValue = {
x: 0,
y: 0,
};
Expand Down
6 changes: 3 additions & 3 deletions src/components/sidebar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import constants from "lib/constants";

let $sidebar;
/**@type {Array<(el:HTMLElement)=>boolean>} */
let preventSlideTests = [];
const preventSlideTests = [];

const events = {
show: [],
Expand Down Expand Up @@ -247,7 +247,7 @@ function create($container, $toggler) {
touch.totalX = touch.endX - touch.startX;
touch.totalY = touch.endY - touch.startY;

let width = $el.getWidth();
const width = $el.getWidth();

if (
!$el.activated &&
Expand Down Expand Up @@ -347,7 +347,7 @@ function create($container, $toggler) {
$el.hide = hide;
$el.toggle = toggle;
$el.onshow = () => {};
$el.getWidth = function () {
$el.getWidth = () => {
const width = innerWidth * 0.7;
return mode === "phone" ? (width >= 350 ? 350 : width) : MIN_WIDTH;
};
Expand Down
4 changes: 1 addition & 3 deletions src/dialogs/alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ function alert(titleText, message, onhide) {

const regex = /(https?:\/\/[^\s]+)/g;
if (regex.test(message)) {
message = message.replace(regex, function (url) {
return `<a href='${url}'>${url}</a>`;
});
message = message.replace(regex, (url) => `<a href='${url}'>${url}</a>`);
}

const titleSpan = tag("strong", {
Expand Down
5 changes: 3 additions & 2 deletions src/dialogs/box.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ function box(titleText, html, hideButtonText, cancelButtonText) {
};

let cancelBtn;
let hideButton = typeof hideButtonText === "boolean" ? hideButtonText : false;
const hideButton =
typeof hideButtonText === "boolean" ? hideButtonText : false;

if (cancelButtonText) {
cancelBtn = tag("button", {
Expand Down Expand Up @@ -117,7 +118,7 @@ function box(titleText, html, hideButtonText, cancelButtonText) {
if (waitFor) return;
const imgs = box.getAll("img");
if (imgs) {
for (let img of imgs) {
for (const img of imgs) {
URL.revokeObjectURL(img.src);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/dialogs/color.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function color(defaultColor, onhide) {
});
const okBtn = tag("button", {
textContent: strings.ok,
onclick: function () {
onclick: () => {
hide();
lastPicked = color;
localStorage.__picker_last_picked = color;
Expand Down
4 changes: 2 additions & 2 deletions src/dialogs/confirm.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ function confirm(titleText, message, isHTML) {
});
const okBtn = tag("button", {
textContent: strings.ok,
onclick: function () {
onclick: () => {
hide();
resolve(true);
},
});
const cancelBtn = tag("button", {
textContent: strings.cancel,
onclick: function () {
onclick: () => {
hide();
resolve(false);
},
Expand Down
8 changes: 4 additions & 4 deletions src/dialogs/multiPrompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ export default function multiPrompt(message, inputs, help) {
const okBtn = tag("button", {
type: "submit",
textContent: strings.ok,
onclick: function (e) {
onclick: (e) => {
e.preventDefault();
e.stopPropagation();
const inputAr = [...$body.getAll("input")];

for (let $input of inputAr) {
for (const $input of inputAr) {
if ($input.isRequired && !$input.value) {
$errorMessage.textContent = strings.required.capitalize();
const $sibling = $input.nextElementSibling;
Expand All @@ -73,7 +73,7 @@ export default function multiPrompt(message, inputs, help) {
const cancelBtn = tag("button", {
textContent: strings.cancel,
type: "button",
onclick: function () {
onclick: () => {
reject();
hide();
},
Expand Down Expand Up @@ -215,7 +215,7 @@ export default function multiPrompt(message, inputs, help) {
} = input;

const inputType = type === "textarea" ? "textarea" : "input";
let _type = type === "filename" ? "text" : type || "text";
const _type = type === "filename" ? "text" : type || "text";

let $input;

Expand Down
6 changes: 3 additions & 3 deletions src/dialogs/prompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function prompt(
type: "submit",
textContent: strings.ok,
disabled: !defaultValue,
onclick: function () {
onclick: () => {
if (options.required && !input.value) {
errorMessage.textContent = strings.required;
return;
Expand All @@ -56,7 +56,7 @@ export default function prompt(
const cancelBtn = tag("button", {
textContent: strings.cancel,
type: "button",
onclick: function () {
onclick: () => {
hide();
resolve(null);
},
Expand Down Expand Up @@ -97,7 +97,7 @@ export default function prompt(
}
}

input.oninput = function () {
input.oninput = () => {
const { match, test } = options;
let isValid = true;

Expand Down
4 changes: 2 additions & 2 deletions src/dialogs/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function select(title, options, opts = {}) {

$item.tabIndex = "0";

$item.onclick = function () {
$item.onclick = () => {
if (value === undefined) return;
if (opts.hideOnSelect) hide();
resolve(value);
Expand Down Expand Up @@ -124,7 +124,7 @@ function select(title, options, opts = {}) {
if (typeof opts.onHide === "function") opts.onHide();
actionStack.remove("select");
hideSelect();
let listItems = [...$list.children];
const listItems = [...$list.children];
listItems.map((item) => (item.onclick = null));
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/fileSystem/internalFs.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ const internalFs = {
};

function setMessage(reject) {
return function (err) {
return (err) => {
if (err.code) {
const message = getErrorMessage(err.code);
err.message = message;
Expand Down
4 changes: 2 additions & 2 deletions src/handlers/editorFileTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ function getClientPos(e) {
function updateFileList($parent) {
const children = [...$parent.children];
const newFileList = [];
for (let el of children) {
for (let file of editorManager.files) {
for (const el of children) {
for (const file of editorManager.files) {
if (file.tab === el) {
newFileList.push(file);
break;
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/purchase.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default function purchaseListener(onpurchase, onerror) {
return;
}

let message =
const message =
error === iap.USER_CANCELED ? strings.failed : strings.canceled;

if (typeof onerror === "function") onerror(message);
Expand Down
Loading