[build] upgrade eslint to 9.37.0 (#88)
Co-authored-by: tobi <tobi.smethurst@protonmail.com> Reviewed-on: https://codeberg.org/superseriousbusiness/masto-fe-standalone/pulls/88 Co-authored-by: Zoë Bijl <moiety@noreply.codeberg.org> Co-committed-by: Zoë Bijl <moiety@noreply.codeberg.org>
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import * as base64 from '../base64';
|
||||
import * as base64 from "../base64";
|
||||
|
||||
describe('base64', () => {
|
||||
describe('decode', () => {
|
||||
it('returns a uint8 array', () => {
|
||||
const arr = base64.decode('dGVzdA==');
|
||||
describe("base64", () => {
|
||||
describe("decode", () => {
|
||||
it("returns a uint8 array", () => {
|
||||
const arr = base64.decode("dGVzdA==");
|
||||
expect(arr).toEqual(new Uint8Array([116, 101, 115, 116]));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import * as html from '../html';
|
||||
import * as html from "../html";
|
||||
|
||||
describe('html', () => {
|
||||
describe('unescapeHTML', () => {
|
||||
it('returns unescaped HTML', () => {
|
||||
const output = html.unescapeHTML('<p>lorem</p><p>ipsum</p><br><br>');
|
||||
expect(output).toEqual('lorem\n\nipsum\n<br>');
|
||||
describe("html", () => {
|
||||
describe("unescapeHTML", () => {
|
||||
it("returns unescaped HTML", () => {
|
||||
const output = html.unescapeHTML("<p>lorem</p><p>ipsum</p><br><br>");
|
||||
expect(output).toEqual("lorem\n\nipsum\n<br>");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import ready from '../ready';
|
||||
import ready from "../ready";
|
||||
|
||||
export let assetHost = '';
|
||||
export let assetHost = "";
|
||||
|
||||
ready(() => {
|
||||
const cdnHost = document.querySelector('meta[name=cdn-host]');
|
||||
const cdnHost = document.querySelector("meta[name=cdn-host]");
|
||||
if (cdnHost) {
|
||||
assetHost = cdnHost.content || '';
|
||||
assetHost = cdnHost.content || "";
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
export const toServerSideType = (columnType: string) => {
|
||||
switch (columnType) {
|
||||
case 'home':
|
||||
case 'notifications':
|
||||
case 'public':
|
||||
case 'thread':
|
||||
case 'account':
|
||||
case "home":
|
||||
case "notifications":
|
||||
case "public":
|
||||
case "thread":
|
||||
case "account":
|
||||
return columnType;
|
||||
default:
|
||||
if (columnType.includes('list:')) {
|
||||
return 'home';
|
||||
if (columnType.includes("list:")) {
|
||||
return "home";
|
||||
} else {
|
||||
return 'public'; // community, account, hashtag
|
||||
return "public"; // community, account, hashtag
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
const HASHTAG_SEPARATORS = '_\\u00b7\\u200c';
|
||||
const ALPHA = '\\p{L}\\p{M}';
|
||||
const WORD = '\\p{L}\\p{M}\\p{N}\\p{Pc}';
|
||||
const HASHTAG_SEPARATORS = "_\\u00b7\\u200c";
|
||||
const ALPHA = "\\p{L}\\p{M}";
|
||||
const WORD = "\\p{L}\\p{M}\\p{N}\\p{Pc}";
|
||||
|
||||
const buildHashtagPatternRegex = () => {
|
||||
try {
|
||||
return new RegExp(
|
||||
`(?:^|[^\\/\\)\\w])#(([${WORD}_][${WORD}${HASHTAG_SEPARATORS}]*[${ALPHA}${HASHTAG_SEPARATORS}][${WORD}${HASHTAG_SEPARATORS}]*[${WORD}_])|([${WORD}_]*[${ALPHA}][${WORD}_]*))`,
|
||||
'iu',
|
||||
"iu",
|
||||
);
|
||||
} catch {
|
||||
return /(?:^|[^/)\w])#(\w*[a-zA-Z·]\w*)/i;
|
||||
@@ -17,7 +17,7 @@ const buildHashtagRegex = () => {
|
||||
try {
|
||||
return new RegExp(
|
||||
`^(([${WORD}_][${WORD}${HASHTAG_SEPARATORS}]*[${ALPHA}${HASHTAG_SEPARATORS}][${WORD}${HASHTAG_SEPARATORS}]*[${WORD}_])|([${WORD}_]*[${ALPHA}][${WORD}_]*))$`,
|
||||
'iu',
|
||||
"iu",
|
||||
);
|
||||
} catch {
|
||||
return /^(\w*[a-zA-Z·]\w*)$/i;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// NB: This function can still return unsafe HTML
|
||||
export const unescapeHTML = (html) => {
|
||||
const wrapper = document.createElement('div');
|
||||
wrapper.innerHTML = html.replace(/<br\s*\/?>/g, '\n').replace(/<\/p><p>/g, '\n\n').replace(/<[^>]*>/g, '');
|
||||
const wrapper = document.createElement("div");
|
||||
wrapper.innerHTML = html.replace(/<br\s*\/?>/g, "\n").replace(/<\/p><p>/g, "\n\n").replace(/<[^>]*>/g, "");
|
||||
return wrapper.textContent;
|
||||
};
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
import Rails from '@rails/ujs';
|
||||
import Rails from "@rails/ujs";
|
||||
|
||||
export const logOut = () => {
|
||||
const form = document.createElement('form');
|
||||
const form = document.createElement("form");
|
||||
|
||||
const methodInput = document.createElement('input');
|
||||
methodInput.setAttribute('name', '_method');
|
||||
methodInput.setAttribute('value', 'delete');
|
||||
methodInput.setAttribute('type', 'hidden');
|
||||
const methodInput = document.createElement("input");
|
||||
methodInput.setAttribute("name", "_method");
|
||||
methodInput.setAttribute("value", "delete");
|
||||
methodInput.setAttribute("type", "hidden");
|
||||
form.appendChild(methodInput);
|
||||
|
||||
const csrfToken = Rails.csrfToken();
|
||||
const csrfParam = Rails.csrfParam();
|
||||
|
||||
if (csrfParam && csrfToken) {
|
||||
const csrfInput = document.createElement('input');
|
||||
csrfInput.setAttribute('name', csrfParam);
|
||||
csrfInput.setAttribute('value', csrfToken);
|
||||
csrfInput.setAttribute('type', 'hidden');
|
||||
const csrfInput = document.createElement("input");
|
||||
csrfInput.setAttribute("name", csrfParam);
|
||||
csrfInput.setAttribute("value", csrfToken);
|
||||
csrfInput.setAttribute("type", "hidden");
|
||||
form.appendChild(csrfInput);
|
||||
}
|
||||
|
||||
const submitButton = document.createElement('input');
|
||||
submitButton.setAttribute('type', 'submit');
|
||||
const submitButton = document.createElement("input");
|
||||
submitButton.setAttribute("type", "submit");
|
||||
form.appendChild(submitButton);
|
||||
|
||||
form.method = 'post';
|
||||
form.action = '/auth/sign_out';
|
||||
form.style.display = 'none';
|
||||
form.method = "post";
|
||||
form.action = "/auth/sign_out";
|
||||
form.style.display = "none";
|
||||
|
||||
document.body.appendChild(form);
|
||||
submitButton.click();
|
||||
|
||||
@@ -14,7 +14,7 @@ const checkNotificationPromise = () => {
|
||||
|
||||
const handlePermission = (permission, callback) => {
|
||||
// Whatever the user answers, we make sure Chrome stores the information
|
||||
if(!('permission' in Notification)) {
|
||||
if(!("permission" in Notification)) {
|
||||
Notification.permission = permission;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ValueOf } from '../../types/util';
|
||||
import { type ValueOf } from "../../types/util";
|
||||
|
||||
export const DECIMAL_UNITS = Object.freeze({
|
||||
ONE: 1,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { isMobile } from '../is_mobile';
|
||||
import { isMobile } from "../is_mobile";
|
||||
|
||||
/** @type {number | null} */
|
||||
let cachedScrollbarWidth = null;
|
||||
@@ -7,12 +7,12 @@ let cachedScrollbarWidth = null;
|
||||
* @returns {number}
|
||||
*/
|
||||
const getActualScrollbarWidth = () => {
|
||||
const outer = document.createElement('div');
|
||||
outer.style.visibility = 'hidden';
|
||||
outer.style.overflow = 'scroll';
|
||||
const outer = document.createElement("div");
|
||||
outer.style.visibility = "hidden";
|
||||
outer.style.overflow = "scroll";
|
||||
document.body.appendChild(outer);
|
||||
|
||||
const inner = document.createElement('div');
|
||||
const inner = document.createElement("div");
|
||||
outer.appendChild(inner);
|
||||
|
||||
const scrollbarWidth = outer.offsetWidth - inner.offsetWidth;
|
||||
|
||||
Reference in New Issue
Block a user