Skip to content

Commit dfaa4e4

Browse files
committed
feat: update lints
1 parent feade49 commit dfaa4e4

Some content is hidden

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

57 files changed

+231
-170
lines changed

biome.json

Lines changed: 65 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,80 @@
1010
"noForEach": "warn",
1111
"noStaticOnlyClass": "error",
1212
"noUselessSwitchCase": "error",
13-
"useFlatMap": "error"
13+
"useFlatMap": "error",
14+
"noExtraBooleanCast": "warn",
15+
"noMultipleSpacesInRegularExpressionLiterals": "error",
16+
"noThisInStatic": "warn",
17+
"noUselessCatch": "error",
18+
"noUselessConstructor": "error",
19+
"noUselessFragments": "error",
20+
"noUselessLabel": "error",
21+
"noUselessLoneBlockStatements": "error",
22+
"noUselessRename": "error",
23+
"noUselessTernary": "warn",
24+
"noUselessThisAlias": "error",
25+
"noWith": "error",
26+
"useArrowFunction": "warn",
27+
"useOptionalChain": "warn",
28+
"useSimpleNumberKeys": "error"
29+
},
30+
"performance": {
31+
"noAccumulatingSpread": "error",
32+
"noDelete": "warn"
1433
},
1534
"style": {
1635
"noNegationElse": "off",
1736
"useForOf": "error",
1837
"useNodejsImportProtocol": "error",
19-
"useNumberNamespace": "error"
38+
"useNumberNamespace": "error",
39+
"noInferrableTypes": "error",
40+
"noNonNullAssertion": "error",
41+
"noParameterAssign": "off",
42+
"noUnusedTemplateLiteral": "warn",
43+
"noUselessElse": "warn",
44+
"useConst": "warn",
45+
"useExponentiationOperator": "warn",
46+
"useNumericLiterals": "error",
47+
"useWhile": "error"
48+
},
49+
"security": {
50+
"noDangerouslySetInnerHtml": "error",
51+
"noDangerouslySetInnerHtmlWithChildren": "error",
52+
"noGlobalEval": "warn"
2053
},
2154
"suspicious": {
2255
"noDoubleEquals": "error",
2356
"noThenProperty": "error",
24-
"useIsArray": "error"
57+
"useIsArray": "error",
58+
"noApproximativeNumericConstant": "error",
59+
"noArrayIndexKey": "error",
60+
"noAsyncPromiseExecutor": "warn",
61+
"noCatchAssign": "error",
62+
"noClassAssign": "error",
63+
"noCommentText": "error",
64+
"noCompareNegZero": "error",
65+
"noConfusingLabels": "error",
66+
"noControlCharactersInRegex": "error",
67+
"noDuplicateClassMembers": "error",
68+
"noDuplicateJsxProps": "error",
69+
"noDuplicateObjectKeys": "error",
70+
"noDuplicateParameters": "error",
71+
"noEmptyBlockStatements": "warn",
72+
"noGlobalAssign": "error",
73+
"noGlobalIsFinite": "error",
74+
"noGlobalIsNan": "warn",
75+
"noMisrefactoredShorthandAssign": "error",
76+
"noPrototypeBuiltins": "warn",
77+
"noRedeclare": "error",
78+
"noRedundantUseStrict": "error",
79+
"noSelfCompare": "error",
80+
"noShadowRestrictedNames": "error",
81+
"noSparseArray": "error",
82+
"noSuspiciousSemicolonInJsx": "error",
83+
"noUnsafeNegation": "error",
84+
"useDefaultSwitchClauseLast": "error",
85+
"useGetterReturn": "error",
86+
"useValidTypeof": "error"
2587
}
2688
}
2789
},

src/ace/commands.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,9 @@ const commands = [
200200
name: "cut",
201201
description: "Cut",
202202
exec(editor) {
203-
let cutLine =
203+
const cutLine =
204204
editor.$copyWithEmptySelection && editor.selection.isEmpty();
205-
let range = cutLine
205+
const range = cutLine
206206
? editor.selection.getLineRange()
207207
: editor.selection.getRange();
208208
editor._emit("cut", range);
@@ -285,7 +285,7 @@ const commands = [
285285
name: "increaseFontSize",
286286
description: "Increase font size",
287287
exec(editor) {
288-
let size = Number.parseInt(editor.getFontSize(), 10) || 12;
288+
const size = Number.parseInt(editor.getFontSize(), 10) || 12;
289289
editor.setFontSize(size + 1);
290290
settings.value.fontSize = size + 1 + "px";
291291
settings.update(false);
@@ -295,7 +295,7 @@ const commands = [
295295
name: "decreaseFontSize",
296296
description: "Decrease font size",
297297
exec(editor) {
298-
let size = Number.parseInt(editor.getFontSize(), 10) || 12;
298+
const size = Number.parseInt(editor.getFontSize(), 10) || 12;
299299
editor.setFontSize(Math.max(size - 1 || 1));
300300
settings.value.fontSize = Math.max(size - 1 || 1) + "px";
301301
settings.update(false);

src/ace/modelist.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ export function initModes() {
55
ace.define(
66
"ace/ext/modelist",
77
["require", "exports", "module"],
8-
function (require, exports, module) {
8+
(require, exports, module) => {
99
module.exports = {
1010
getModeForPath(path) {
1111
let mode = modesByName.text;
12-
let fileName = path.split(/[\/\\]/).pop();
12+
const fileName = path.split(/[\/\\]/).pop();
1313
for (const iMode of modes) {
1414
if (iMode.supportsFile?.(fileName)) {
1515
mode = iMode;
@@ -81,9 +81,8 @@ class Mode {
8181

8282
if (/\^/.test(extensions)) {
8383
re =
84-
extensions.replace(/\|(\^)?/g, function (a, b) {
85-
return "$|" + (b ? "^" : "^.*\\.");
86-
}) + "$";
84+
extensions.replace(/\|(\^)?/g, (a, b) => "$|" + (b ? "^" : "^.*\\.")) +
85+
"$";
8786
} else {
8887
re = "^.*\\.(" + extensions + ")$";
8988
}

src/ace/touchHandler.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -548,9 +548,9 @@ export default function addTouchListeners(editor, minimal, onclick) {
548548
* @param {number} y
549549
*/
550550
function scroll(x, y) {
551-
let direction = reverseScrolling ? 1 : -1;
552-
let scrollX = direction * x;
553-
let scrollY = direction * y;
551+
const direction = reverseScrolling ? 1 : -1;
552+
const scrollX = direction * x;
553+
const scrollY = direction * y;
554554

555555
renderer.scrollBy(scrollX, scrollY);
556556
}

src/components/WebComponents/wcPage.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export default class WCPage extends HTMLElement {
6161
}
6262

6363
appendBody(...$els) {
64-
let $main = this.body;
64+
const $main = this.body;
6565
if (!$main) return;
6666
for (const $el of $els) {
6767
$main.append($el);
@@ -262,7 +262,7 @@ class PageHandler {
262262
*/
263263
function handlePagesForSmoothExperience() {
264264
const $pages = [...tag.getAll("wc-page")];
265-
for (let $page of $pages.slice(0, -1)) {
265+
for (const $page of $pages.slice(0, -1)) {
266266
$page.handler.replaceEl();
267267
}
268268
}

src/components/contextmenu/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export default function Contextmenu(content, options) {
121121
function addTabindex() {
122122
/**@type {Array<HTMLLIElement>} */
123123
const children = [...$el.children];
124-
for (let $el of children) $el.tabIndex = "0";
124+
for (const $el of children) $el.tabIndex = "0";
125125
}
126126

127127
function destroy() {

src/components/page.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import WCPage from "./WebComponents/wcPage";
99
* @returns {WCPage}
1010
*/
1111
function Page(title, options = {}) {
12-
let page = <wc-page />;
12+
const page = <wc-page />;
1313
page.append = page.appendBody;
1414
page.initializeIfNotAlreadyInitialized();
1515
page.settitle(title);

src/components/scrollbar/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export default function ScrollBar(options) {
5757
const isVertical = placement === "right" || placement === "left";
5858
const observer = new MutationObserver(observerCallback);
5959
let scroll = 0;
60-
let touchStartValue = {
60+
const touchStartValue = {
6161
x: 0,
6262
y: 0,
6363
};

src/components/sidebar/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import constants from "lib/constants";
55

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

1010
const events = {
1111
show: [],
@@ -247,7 +247,7 @@ function create($container, $toggler) {
247247
touch.totalX = touch.endX - touch.startX;
248248
touch.totalY = touch.endY - touch.startY;
249249

250-
let width = $el.getWidth();
250+
const width = $el.getWidth();
251251

252252
if (
253253
!$el.activated &&
@@ -347,7 +347,7 @@ function create($container, $toggler) {
347347
$el.hide = hide;
348348
$el.toggle = toggle;
349349
$el.onshow = () => {};
350-
$el.getWidth = function () {
350+
$el.getWidth = () => {
351351
const width = innerWidth * 0.7;
352352
return mode === "phone" ? (width >= 350 ? 350 : width) : MIN_WIDTH;
353353
};

src/dialogs/alert.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ function alert(titleText, message, onhide) {
1616

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

2422
const titleSpan = tag("strong", {

0 commit comments

Comments
 (0)