Add more @type packages.
This commit is contained in:
parent
a347939896
commit
799931f31a
|
@ -1,6 +1,8 @@
|
|||
{
|
||||
"devDependencies": {
|
||||
"@babel/eslint-parser": "^7.13.14",
|
||||
"@types/prismjs": "^1.16.5",
|
||||
"@types/uikit": "^3.3.1",
|
||||
"@typescript-eslint/eslint-plugin": "^4.22.1",
|
||||
"@typescript-eslint/parser": "^4.22.1",
|
||||
"clipboard": "^2.0.8",
|
||||
|
@ -15,7 +17,7 @@
|
|||
"html-webpack-plugin": "^5.3.1",
|
||||
"i18next": "^20.2.2",
|
||||
"mini-css-extract-plugin": "^1.6.0",
|
||||
"node-sass": "^6.0.0",
|
||||
"node-sass": "^5.0.0",
|
||||
"prismjs": "^1.23.0",
|
||||
"qr-scanner": "^1.2.0",
|
||||
"raw-loader": "^4.0.2",
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
npx eslint -c .eslintrc.json "$@" --fix --ext .js,.ts
|
||||
npx eslint -c .eslintrc.json "$@" --ext .js,.ts
|
|
@ -2,7 +2,7 @@ import { addClipboardNotifications } from "../pageUtils";
|
|||
import { makeElement } from "../htmlUtils";
|
||||
import ClipboardJS from "clipboard";
|
||||
import FileSaver from 'file-saver';
|
||||
import UIkit from 'uikit/dist/js/uikit.min.js';
|
||||
import UIkit from 'uikit';
|
||||
import i18next from 'i18next';
|
||||
|
||||
type FileSaverType = {
|
||||
|
@ -93,7 +93,7 @@ export function CopyableModal(name: string, contentString: string): ModalType {
|
|||
})
|
||||
}) as ModalType;
|
||||
modal.show = () => {
|
||||
(UIkit as { modal: (ModalType) => { show: () => void } }).modal(modal).show();
|
||||
UIkit.modal(modal).show();
|
||||
}
|
||||
return modal;
|
||||
}
|
||||
|
|
|
@ -4,14 +4,13 @@
|
|||
|
||||
/* eslint-disable */
|
||||
import "./scss/main.scss";
|
||||
import Icons from 'uikit/dist/js/uikit-icons.min.js';
|
||||
import UIkit from 'uikit/dist/js/uikit.min.js';
|
||||
import UIkit from 'uikit';
|
||||
import Icons from 'uikit/dist/js/uikit-icons';
|
||||
// @ts-ignore
|
||||
UIkit.use(Icons);
|
||||
|
||||
import Prism from "prismjs";
|
||||
import "prismjs/components/prism-json";
|
||||
// @ts-ignore
|
||||
Prism.highlightAll();
|
||||
/* eslint-enable */
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import { lookupSelf } from "./api/sys/lookupSelf";
|
|||
import { makeElement } from "./htmlUtils";
|
||||
import { pageState } from "./globalPageState";
|
||||
import ClipboardJS from "clipboard";
|
||||
import UIkit from 'uikit/dist/js/uikit.min.js';
|
||||
import UIkit from 'uikit';
|
||||
import i18next from 'i18next';
|
||||
|
||||
async function prePageChecksReal() {
|
||||
|
@ -42,17 +42,15 @@ export async function prePageChecks(): Promise<boolean> {
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function addClipboardNotifications(clipboard: ClipboardJS, timeout = 1000): void {
|
||||
clipboard.on('success', () => {
|
||||
(UIkit as {notification: (title: unknown, options: unknown) => void}).notification(i18next.t("notification_copy_success"), {
|
||||
UIkit.notification(i18next.t("notification_copy_success"), {
|
||||
status: 'success',
|
||||
timeout: timeout
|
||||
});
|
||||
});
|
||||
clipboard.on('error', function (e: Error) {
|
||||
(UIkit as {notification: (title: unknown, options: unknown) => void}).notification(i18next.t("notification_copy_error", {
|
||||
UIkit.notification(i18next.t("notification_copy_error", {
|
||||
"error": e.message
|
||||
}), {
|
||||
status: 'danger',
|
||||
|
@ -64,9 +62,12 @@ export function addClipboardNotifications(clipboard: ClipboardJS, timeout = 1000
|
|||
export function setErrorText(text: string): void {
|
||||
const errorTextElement = document.querySelector("#errorText");
|
||||
if (errorTextElement) {
|
||||
(document.querySelector("#errorText") as HTMLParagraphElement).innerText = `Error: ${text}`;
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */
|
||||
const p = document.querySelector("#errorText") as HTMLParagraphElement;
|
||||
p.innerText = `Error: ${text}`;
|
||||
/* eslint-enable @typescript-eslint/no-unnecessary-type-assertion */
|
||||
}
|
||||
(UIkit as {notification: (options: unknown) => void}).notification({
|
||||
UIkit.notification({
|
||||
message: `Error: ${text}`,
|
||||
status: 'danger',
|
||||
pos: 'top-center',
|
||||
|
|
|
@ -141,7 +141,7 @@ export class KeyValueSecretPage extends Page {
|
|||
kvList.appendChild(makeElement({
|
||||
tag: "pre",
|
||||
class: ["code-block", "language-json", "line-numbers"],
|
||||
html: (Prism as { highlight: (text: string, language: null, languageStr: string) => string }).highlight(jsonText, null, 'json')
|
||||
html: Prism.highlight(jsonText, Prism.languages.json, 'json')
|
||||
}));
|
||||
} else {
|
||||
secretsMap.forEach((value: string, key: string) => {
|
||||
|
|
Loading…
Reference in a new issue