1
Fork 0

Update dependencies and fix linting issues.

This commit is contained in:
Bauke 2024-01-12 12:42:42 +01:00
parent 028bee0327
commit 53ec36b216
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
13 changed files with 1499 additions and 2140 deletions

View File

@ -5,35 +5,35 @@
"@holllo/migration-helper": "^0.1.4", "@holllo/migration-helper": "^0.1.4",
"@holllo/webextension-storage": "^0.2.0", "@holllo/webextension-storage": "^0.2.0",
"caret-pos": "^2.0.0", "caret-pos": "^2.0.0",
"debounce": "^1.2.1", "debounce": "^2.0.0",
"fast-diff": "^1.3.0", "fast-diff": "^1.3.0",
"modern-normalize": "^2.0.0", "modern-normalize": "^2.0.0",
"platform": "^1.3.6", "platform": "^1.3.6",
"preact": "^10.15.1", "preact": "^10.19.3",
"webextension-polyfill": "^0.10.0" "webextension-polyfill": "^0.10.0"
}, },
"devDependencies": { "devDependencies": {
"@bauke/eslint-config": "^0.1.3", "@bauke/eslint-config": "^0.1.4",
"@bauke/prettier-config": "^0.1.3", "@bauke/prettier-config": "^0.1.4",
"@bauke/stylelint-config": "^0.1.3", "@bauke/stylelint-config": "^0.1.4",
"@holllo/test": "^0.2.1", "@holllo/test": "^0.2.1",
"@types/debounce": "^1.2.1", "@types/debounce": "^1.2.4",
"@types/node": "^20.3.3", "@types/node": "^20.11.0",
"@types/platform": "^1.3.4", "@types/platform": "^1.3.6",
"@types/webextension-polyfill": "^0.10.1", "@types/webextension-polyfill": "^0.10.7",
"concurrently": "^8.2.0", "concurrently": "^8.2.2",
"cssnano": "^6.0.1", "cssnano": "^6.0.3",
"esbuild": "^0.18.11", "esbuild": "^0.19.11",
"esbuild-copy-static-files": "^0.1.0", "esbuild-copy-static-files": "^0.1.0",
"esbuild-sass-plugin": "^2.10.0", "esbuild-sass-plugin": "^2.16.1",
"postcss": "^8.4.24", "postcss": "^8.4.33",
"sass": "^1.63.6", "sass": "^1.69.7",
"stylelint": "^15.9.0", "stylelint": "^15.9.0",
"trash-cli": "^5.0.0", "trash-cli": "^5.0.0",
"tsx": "^3.12.7", "tsx": "^4.7.0",
"typescript": "^5.1.6", "typescript": "^5.3.3",
"web-ext": "^7.6.2", "web-ext": "^7.10.0",
"xo": "^0.54.2" "xo": "^0.56.0"
}, },
"prettier": "@bauke/prettier-config", "prettier": "@bauke/prettier-config",
"stylelint": { "stylelint": {
@ -43,6 +43,7 @@
"extends": "@bauke/eslint-config", "extends": "@bauke/eslint-config",
"prettier": true, "prettier": true,
"rules": { "rules": {
"@typescript-eslint/no-unsafe-enum-comparison": "off",
"complexity": "off", "complexity": "off",
"no-await-in-loop": "off" "no-await-in-loop": "off"
}, },

File diff suppressed because it is too large Load Diff

View File

@ -41,7 +41,7 @@ async function generateReplacements(
data: AnonymizeUsernamesData, data: AnonymizeUsernamesData,
): Promise<Record<string, string>> { ): Promise<Record<string, string>> {
const usernames = new Set( const usernames = new Set(
elements.map((element) => usernameFromElement(element).replace(/@/g, "")), elements.map((element) => usernameFromElement(element).replaceAll("@", "")),
); );
const replacements: Record<string, string> = {}; const replacements: Record<string, string> = {};

View File

@ -39,7 +39,7 @@ function applyEnhancements(): number {
} }
// Remove any excess whitespace. // Remove any excess whitespace.
text = text.replace(/\s+/g, " ").trim(); text = text.replaceAll(/\s+/, " ").trim();
// Remove the editor's name too as we already have that. // Remove the editor's name too as we already have that.
text = text.slice(text.indexOf(" ") + 1); text = text.slice(text.indexOf(" ") + 1);
@ -166,7 +166,7 @@ function transformText(text: string): TransformedText {
); );
if (removed !== undefined) { if (removed !== undefined) {
const tags = removed.replace(/'/g, "").split(", "); const tags = removed.replaceAll("'", "").split(", ");
spans.push( spans.push(
...tags.map((tag) => ( ...tags.map((tag) => (
<> <>
@ -180,7 +180,7 @@ function transformText(text: string): TransformedText {
} }
if (added !== undefined) { if (added !== undefined) {
const tags = added.replace(/'/g, "").split(", "); const tags = added.replaceAll("'", "").split(", ");
spans.push( spans.push(
...tags.map((tag) => ( ...tags.map((tag) => (
<> <>

View File

@ -82,7 +82,7 @@ export class UserLabelsFeature extends Component<Props, State> {
}); });
for (const element of elements) { for (const element of elements) {
let username: string = element.textContent!.replace(/@/g, ""); let username: string = element.textContent!.replaceAll("@", "");
if (this.props.anonymizeUsernamesEnabled) { if (this.props.anonymizeUsernamesEnabled) {
username = element.dataset.trxUsername ?? username; username = element.dataset.trxUsername ?? username;

View File

@ -54,6 +54,7 @@ async function importFileHandler(event: Event): Promise<void> {
reader.abort(); reader.abort();
}); });
// eslint-disable-next-line unicorn/prefer-blob-reading-methods
reader.readAsText(fileList[0]); reader.readAsText(fileList[0]);
} }

View File

@ -47,8 +47,8 @@ export class AnonymizeUsernamesSetting extends Component<SettingProps, State> {
const replacementTypeOptions = Object.values(ReplacementType).map((key) => ( const replacementTypeOptions = Object.values(ReplacementType).map((key) => (
<option selected={key === replacementType} value={key}> <option selected={key === replacementType} value={key}>
{key {key
.replace(/-/g, " ") .replaceAll("-", " ")
.replace(/(\b[a-z])/gi, (character) => character.toUpperCase())} .replaceAll(/(\b[a-z])/gi, (character) => character.toUpperCase())}
</option> </option>
)); ));

View File

@ -135,8 +135,8 @@ export class HideTopicsSetting extends Component<SettingProps, State> {
const matcherOptions = Object.values(HideTopicMatcher).map((key) => ( const matcherOptions = Object.values(HideTopicMatcher).map((key) => (
<option selected={predicate.matcher === key} value={key}> <option selected={predicate.matcher === key} value={key}>
{key {key
.replace(/-/g, " ") .replaceAll("-", " ")
.replace(/(\b[a-z])/gi, (character) => character.toUpperCase())} .replaceAll(/(\b[a-z])/gi, (character) => character.toUpperCase())}
</option> </option>
)); ));

View File

@ -1,5 +1,4 @@
import {Component, type ComponentChildren, type JSX} from "preact"; import {Component, type ComponentChildren, type JSX} from "preact";
// eslint-disable-next-line n/file-extension-in-import
import {useContext} from "preact/hooks"; import {useContext} from "preact/hooks";
import {AppContext} from "../context.js"; import {AppContext} from "../context.js";
import {type Feature} from "../../storage/exports.js"; import {type Feature} from "../../storage/exports.js";

View File

@ -126,8 +126,10 @@ export class MiscellaneousSetting extends Component<SettingProps, State> {
onClick={clickHandler} onClick={clickHandler}
/> />
{feature {feature
.replace(/-/g, " ") .replaceAll("-", " ")
.replace(/(\b[a-z])/gi, (character) => character.toUpperCase())} .replaceAll(/(\b[a-z])/gi, (character) =>
character.toUpperCase(),
)}
</label> </label>
<FeatureDescription feature={feature} /> <FeatureDescription feature={feature} />
</li> </li>

View File

@ -3,8 +3,7 @@
border: 1px solid var(--border-color); border: 1px solid var(--border-color);
font-size: 80%; font-size: 80%;
max-height: 8rem; max-height: 8rem;
overflow-x: hidden; overflow: hidden;
overflow-y: hidden;
position: absolute; position: absolute;
li { li {

View File

@ -253,6 +253,6 @@ export function processSnippetShortcut(
alt: components.includes("alt"), alt: components.includes("alt"),
ctrl: components.includes("ctrl"), ctrl: components.includes("ctrl"),
shift: components.includes("shift"), shift: components.includes("shift"),
key: components[components.length - 1], key: components.at(-1),
} satisfies ProcessedSnippetShortcut; } satisfies ProcessedSnippetShortcut;
} }

View File

@ -53,7 +53,7 @@ export const migrations: Array<Migration<string>> = [
enabledFeatures.value.clear(); enabledFeatures.value.clear();
for (const [key, value] of Object.entries(data.features)) { for (const [key, value] of Object.entries(data.features)) {
if (value) { if (value) {
const snakeCasedKey = key.replace(/([A-Z])/g, "-$1").toLowerCase(); const snakeCasedKey = key.replaceAll(/([A-Z])/g, "-$1").toLowerCase();
if (Object.values(Feature).includes(snakeCasedKey as Feature)) { if (Object.values(Feature).includes(snakeCasedKey as Feature)) {
enabledFeatures.value.add(snakeCasedKey as Feature); enabledFeatures.value.add(snakeCasedKey as Feature);
} else { } else {