1
Fork 0

Chore: Update the dependencies.

This commit is contained in:
Bauke 2020-06-05 23:55:11 +02:00
parent 272ea0fe4b
commit 32cb433664
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
8 changed files with 1183 additions and 650 deletions

View File

@ -23,29 +23,29 @@
"debounce": "^1.2.0",
"modern-normalize": "^0.6.0",
"platform": "^1.3.5",
"webextension-polyfill-ts": "^0.12.0"
"webextension-polyfill-ts": "^0.16.0"
},
"devDependencies": {
"@types/debounce": "^1.2.0",
"@types/platform": "^1.3.2",
"@types/prompts": "^2.0.3",
"@types/semver": "^7.1.0",
"@types/prompts": "^2.0.8",
"@types/semver": "^7.2.0",
"parcel-bundler": "^1.12.4",
"parcel-plugin-web-extension": "^1.6.1",
"prompts": "^2.3.1",
"sass": "^1.26.2",
"semver": "^7.1.3",
"simple-git": "^1.131.0",
"stylelint": "^13.2.0",
"prompts": "^2.3.2",
"sass": "^1.26.8",
"semver": "^7.3.2",
"simple-git": "^2.5.0",
"stylelint": "^13.6.0",
"stylelint-config-xo-scss": "^0.12.0",
"stylelint-config-xo-space": "^0.14.0",
"trash-cli": "^3.0.0",
"ts-node": "^8.6.2",
"type-fest": "^0.11.0",
"typescript": "^3.8.3",
"web-ext": "^4.1.0",
"ts-node": "^8.10.2",
"type-fest": "^0.15.0",
"typescript": "^3.9.5",
"web-ext": "^4.2.0",
"web-ext-types": "^3.2.1",
"xo": "^0.27.2"
"xo": "^0.32.0"
},
"stylelint": {
"extends": [

View File

@ -11,15 +11,13 @@ import git from 'simple-git/promise';
);
const packageJSONPath: string = join(__dirname, '../package.json');
const manifestJSON: any = JSON.parse((await fs.readFile(
manifestJSONPath,
'UTF8'
)) as string);
const manifestJSON: any = JSON.parse(
await fs.readFile(manifestJSONPath, 'utf8')
);
const packageJSON: any = JSON.parse((await fs.readFile(
packageJSONPath,
'UTF8'
)) as string);
const packageJSON: any = JSON.parse(
await fs.readFile(packageJSONPath, 'utf8')
);
if (manifestJSON.version !== packageJSON.version) {
console.log(

View File

@ -30,6 +30,7 @@ export async function importFileHandler(event: Event): Promise<void> {
async (): Promise<void> => {
let data: Partial<Settings>;
try {
// eslint-disable-next-line @typescript-eslint/no-base-to-string
data = JSON.parse(reader.result!.toString());
} catch (error) {
log(error, true);
@ -56,7 +57,7 @@ export async function importFileHandler(event: Event): Promise<void> {
? label.color
: themeColors.white.backgroundAlt,
id: newSettings.data.userLabels.length + 1,
priority: isNaN(label.priority) ? 0 : label.priority,
priority: Number.isNaN(label.priority) ? 0 : label.priority,
text: typeof label.text === 'undefined' ? 'Label' : label.text,
username: label.username
});

View File

@ -59,11 +59,11 @@ window.addEventListener(
}
['comments', 'topics', 'own-comments', 'own-topics'].forEach(
(val: string): void => {
(value: string): void => {
const hideCheckbox: HTMLInputElement = querySelector(
`#hide-votes-${val}`
`#hide-votes-${value}`
);
const settingsKey: string = kebabToCamel(val);
const settingsKey: string = kebabToCamel(value);
hideCheckbox.checked = settings.data.hideVotes[settingsKey];
hideCheckbox.addEventListener(
'change',

View File

@ -147,7 +147,7 @@ function addToolbarToTextareas(): void {
// When the dropdown value changes, add the snippet.
markdownSelect.addEventListener('change', (): void => {
const snippet: MarkdownSnippet | undefined = markdownSnippets.find(
val => val.name === markdownSelect.value
(value) => value.name === markdownSelect.value
);
if (typeof snippet === 'undefined') {
return;

View File

@ -135,11 +135,11 @@ let theme: typeof themeColors[ThemeKey];
const commentObserver = new window.MutationObserver(
async (mutations: MutationRecord[]): Promise<void> => {
const commentElements: HTMLElement[] = mutations
.map(val => val.target as HTMLElement)
.map((value) => value.target as HTMLElement)
.filter(
val =>
val.classList.contains('comment-itself') ||
val.classList.contains('comment')
(value) =>
value.classList.contains('comment-itself') ||
value.classList.contains('comment')
);
if (commentElements.length === 0) {
return;
@ -205,7 +205,7 @@ function addLabelsToUsernames(settings: Settings): void {
}
const userLabels: UserLabel[] = settings.data.userLabels.filter(
val => val.username === username
(value) => value.username === username
);
if (userLabels.length === 0) {
if (
@ -285,7 +285,7 @@ async function saveUserLabel(): Promise<void> {
const existingID = Number(existingIDString);
const existingLabel: UserLabel | undefined = settings.data.userLabels.find(
val => val.id === existingID
(value) => value.id === existingID
);
if (typeof existingLabel === 'undefined') {
log(`Tried to find label with ID that doesn't exist: ${existingID}`, true);
@ -293,7 +293,7 @@ async function saveUserLabel(): Promise<void> {
}
const existingLabelIndex: number = settings.data.userLabels.findIndex(
val => val.id === existingID
(value) => value.id === existingID
);
settings.data.userLabels.splice(existingLabelIndex, 1);
settings.data.userLabels.push({
@ -320,7 +320,7 @@ async function removeUserLabel(): Promise<void> {
const settings: Settings = await getSettings();
const labelIndex: number = settings.data.userLabels.findIndex(
val => val.id === id
(value) => value.id === id
);
if (typeof findLabelByID(id) === 'undefined') {
log(
@ -345,7 +345,7 @@ export async function findLabelByID(
settings = await getSettings();
}
return settings.data.userLabels.find(val => val.id === id);
return settings.data.userLabels.find((value) => value.id === id);
}
async function getHighestLabelID(settings?: Settings): Promise<number> {
@ -357,5 +357,5 @@ async function getHighestLabelID(settings?: Settings): Promise<number> {
return 0;
}
return Math.max(...settings.data.userLabels.map(val => val.id));
return Math.max(...settings.data.userLabels.map((value) => value.id));
}

View File

@ -215,13 +215,13 @@ export function isColorBright(color: string): boolean {
if (color.length === 3) {
color = color
.split('')
.map(val => val.repeat(2))
.map((value) => value.repeat(2))
.join('');
}
const red: number = parseInt(color.slice(0, 2), 16);
const green: number = parseInt(color.slice(2, 4), 16);
const blue: number = parseInt(color.slice(4, 6), 16);
const red: number = Number.parseInt(color.slice(0, 2), 16);
const green: number = Number.parseInt(color.slice(2, 4), 16);
const blue: number = Number.parseInt(color.slice(4, 6), 16);
const brightness: number = 0.2126 * red + 0.7152 * green + 0.0722 * blue;
return brightness > 128;
}
@ -238,10 +238,10 @@ export function appendStyleAttribute(element: Element, styles: string): void {
export function isValidHexColor(color: string): boolean {
// Overly verbose validation for 3/4/6/8-character hex colors.
if (
/^#[a-f0-9]{6}$/i.exec(color) === null &&
/^#[a-f0-9]{3}$/i.exec(color) === null &&
/^#[a-f0-9]{8}$/i.exec(color) === null &&
/^#[a-f0-9]{4}$/i.exec(color) === null
/^#[a-f\d]{6}$/i.exec(color) === null &&
/^#[a-f\d]{3}$/i.exec(color) === null &&
/^#[a-f\d]{8}$/i.exec(color) === null &&
/^#[a-f\d]{4}$/i.exec(color) === null
) {
return false;
}
@ -289,6 +289,6 @@ export function isValidTildesUsername(username: string): boolean {
return (
username.length >= 3 &&
username.length <= 20 &&
/^[a-z0-9]([a-z0-9]|[_-](?![_-]))*[a-z0-9]$/i.exec(username) !== null
/^[a-z\d]([a-z\d]|[_-](?![_-]))*[a-z\d]$/i.exec(username) !== null
);
}

1744
yarn.lock

File diff suppressed because it is too large Load Diff