1
0
Fork 0
This commit is contained in:
chaos 2024-08-22 15:12:12 +01:00
parent 9d86d2d6d0
commit 7d6786a022
No known key found for this signature in database
14 changed files with 3375 additions and 3955 deletions

View file

@ -1,59 +0,0 @@
{
"plugins": ["sort-imports-es6-autofix", "@typescript-eslint", "prettier"],
"extends": [
"eslint:recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"prettier"
],
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module",
"experimentalObjectRestSpread": true,
"project": "./tsconfig.json"
},
"globals": {
"pageContent": "writable",
"module": "writable",
"process": "writable",
"BUILD_STRING": "writable"
},
"rules": {
"import/no-named-as-default-member": "off",
"no-unused-vars": ["off"],
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_"
}
],
"@typescript-eslint/no-misused-promises": [
"error",
{
"checksVoidReturn": false
}
],
"@typescript-eslint/require-await": ["off"],
"@typescript-eslint/no-empty-function": ["off"],
"@typescript-eslint/ban-ts-comment": ["off"],
"sort-imports-es6-autofix/sort-imports-es6": [2],
"@typescript-eslint/no-explicit-any": [2],
"prettier/prettier": 2
},
"env": {
"browser": true,
"es6": true
},
"root": true,
"parser": "@typescript-eslint/parser",
"settings": {
"import/ignore": ["preact"],
"import/resolver": {
"node": {
"extensions": [".js", ".ts", ".tsx"]
}
}
}
}

80
eslint.config.mjs Normal file
View file

@ -0,0 +1,80 @@
import { fixupConfigRules, fixupPluginRules } from "@eslint/compat";
import sortImportsEs6Autofix from "eslint-plugin-sort-imports-es6-autofix";
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import prettier from "eslint-plugin-prettier";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
export default [...fixupConfigRules(compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"prettier",
)), {
plugins: {
"sort-imports-es6-autofix": sortImportsEs6Autofix,
"@typescript-eslint": fixupPluginRules(typescriptEslint),
prettier,
},
languageOptions: {
globals: {
...globals.browser,
pageContent: "writable",
module: "writable",
process: "writable",
BUILD_STRING: "writable",
},
parser: tsParser,
ecmaVersion: 12,
sourceType: "module",
parserOptions: {
experimentalObjectRestSpread: true,
project: "./tsconfig.json",
},
},
settings: {
"import/ignore": ["preact"],
"import/resolver": {
node: {
extensions: [".js", ".ts", ".tsx"],
},
},
},
rules: {
"import/no-named-as-default-member": "off",
"no-unused-vars": ["off"],
"@typescript-eslint/no-unused-vars": ["error", {
argsIgnorePattern: "^_",
}],
"@typescript-eslint/no-misused-promises": ["error", {
checksVoidReturn: false,
}],
"@typescript-eslint/require-await": ["off"],
"@typescript-eslint/no-empty-function": ["off"],
"@typescript-eslint/ban-ts-comment": ["off"],
"sort-imports-es6-autofix/sort-imports-es6": [2],
"@typescript-eslint/no-explicit-any": [2],
"prettier/prettier": 2,
},
}];

View file

@ -18,11 +18,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1709150264, "lastModified": 1724224976,
"narHash": "sha256-HofykKuisObPUfj0E9CJVfaMhawXkYx3G8UIFR/XQ38=", "narHash": "sha256-Z/ELQhrSd7bMzTO8r7NZgi9g5emh+aRKoCdaAv5fiO0=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "9099616b93301d5cf84274b184a3a5ec69e94e08", "rev": "c374d94f1536013ca8e92341b540eba4c22f9c62",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -59,11 +59,11 @@
"systems": "systems" "systems": "systems"
}, },
"locked": { "locked": {
"lastModified": 1709126324, "lastModified": 1710146030,
"narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=", "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "d465f4819400de7c8d874d50b982301f28a84605", "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -5,54 +5,56 @@
"build": "webpack" "build": "webpack"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.24.0", "@babel/core": "^7.25.2",
"@babel/eslint-parser": "^7.23.10", "@babel/eslint-parser": "^7.25.1",
"@babel/plugin-proposal-decorators": "^7.24.0", "@babel/plugin-proposal-decorators": "^7.24.7",
"@babel/plugin-syntax-import-assertions": "^7.23.3", "@babel/plugin-syntax-import-assertions": "^7.24.7",
"@babel/plugin-transform-class-properties": "^7.23.3", "@babel/plugin-transform-class-properties": "^7.25.4",
"@babel/plugin-transform-runtime": "^7.24.0", "@babel/plugin-transform-runtime": "^7.25.4",
"@babel/preset-env": "^7.24.0", "@babel/preset-env": "^7.25.4",
"@eslint/compat": "^1.1.1",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.9.0",
"@types/file-saver": "^2.0.7", "@types/file-saver": "^2.0.7",
"@types/js-yaml": "^4.0.9", "@types/js-yaml": "^4.0.9",
"@types/prismjs": "^1.26.3", "@types/prismjs": "^1.26.4",
"@types/uikit": "^3.14.5", "@types/uikit": "^3.14.5",
"@typescript-eslint/eslint-plugin": "^7.1.0", "@typescript-eslint/eslint-plugin": "^8.2.0",
"@typescript-eslint/parser": "^7.1.0", "@typescript-eslint/parser": "^8.2.0",
"babel-loader": "^9.1.3", "babel-loader": "^9.1.3",
"css-loader": "^6.10.0", "css-loader": "^7.1.2",
"css-minimizer-webpack-plugin": "^6.0.0", "css-minimizer-webpack-plugin": "^7.0.0",
"eslint": "^8.57.0", "eslint": "^9.9.0",
"eslint-config-prettier": "^9.1.0", "eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1", "eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-sort-imports-es6-autofix": "^0.6.0", "eslint-plugin-sort-imports-es6-autofix": "^0.6.0",
"git-revision-webpack-plugin": "^5.0.0", "git-revision-webpack-plugin": "^5.0.0",
"globals": "^15.9.0",
"html-webpack-plugin": "^5.6.0", "html-webpack-plugin": "^5.6.0",
"node-sass": "^9.0.0", "prettier": "^3.3.3",
"prettier": "^3.2.5",
"raw-loader": "^4.0.2", "raw-loader": "^4.0.2",
"sass-loader": "^14.1.1", "sass-loader": "^16.0.1",
"ts-loader": "^9.5.1", "ts-loader": "^9.5.1",
"typescript": "^5.3.3", "typescript": "^5.5.4",
"webpack": "^5.90.3", "webpack": "^5.94.0",
"webpack-cli": "^5.1.4", "webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.2" "webpack-dev-server": "^5.0.4"
}, },
"dependencies": { "dependencies": {
"clipboard": "^2.0.11", "clipboard": "^2.0.11",
"codejar": "^4.2.0", "codejar": "^4.2.0",
"core-js": "^3.36.0", "core-js": "^3.38.1",
"date-fns": "^3.3.1", "date-fns": "^3.6.0",
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
"i18next": "^23.10.0", "i18next": "^23.14.0",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"json5": "^2.2.3", "json5": "^2.2.3",
"normalize.css": "^8.0.1", "normalize.css": "^8.0.1",
"preact": "^10.19.6", "preact": "^10.23.2",
"preact-router": "^4.1.2", "preact-router": "^4.1.2",
"prismjs": "^1.29.0", "prismjs": "^1.29.0",
"qr-scanner": "^1.4.2", "qr-scanner": "^1.4.2",
"sass": "^1.71.1", "sass": "^1.77.8",
"uikit": "^3.18.3" "uikit": "^3.21.11"
} }
} }

View file

@ -1,3 +1,3 @@
#!/usr/bin/env bash #!/usr/bin/env bash
npx eslint --cache -c .eslintrc.json --ext .js,.ts,.tsx src "$@" npx eslint --cache --config eslint.config.mjs src "$@"

View file

@ -2,7 +2,6 @@
// JS & CSS // JS & CSS
/* eslint-disable */
import UIkit from "uikit"; import UIkit from "uikit";
// Don't Sort These! // Don't Sort These!
import Icons from "uikit/dist/js/uikit-icons"; import Icons from "uikit/dist/js/uikit-icons";
@ -18,7 +17,6 @@ import "prismjs/components/prism-json5";
import "prismjs/components/prism-yaml"; import "prismjs/components/prism-yaml";
Prism.highlightAll(); Prism.highlightAll();
/* eslint-enable */
// @ts-ignore // @ts-ignore
import translations from "./translations/index.mjs"; import translations from "./translations/index.mjs";

View file

@ -33,6 +33,8 @@ export async function pageChecks(url: string, api: API, settings: Settings): Pro
try { try {
await api.lookupSelf(); await api.lookupSelf();
} catch (e) { } catch (e) {
console.log("Error looking up self", e);
route("/login", true); route("/login", true);
return true; return true;
} }

View file

@ -33,7 +33,7 @@ export class QRScanner extends Component<QRScannerProps, unknown> {
componentWillUnmount(): void { componentWillUnmount(): void {
try { try {
this.qrScanner.destroy(); this.qrScanner.destroy();
} catch (_) { } catch {
// Do Nothing // Do Nothing
} }
} }

View file

@ -45,7 +45,7 @@ export class Me extends Component<DefaultPageProps, MeState> {
try { try {
const caps = await this.props.api.getCapsPath("sys/seal"); const caps = await this.props.api.getCapsPath("sys/seal");
canSealVault = caps.includes("sudo") && caps.includes("update"); canSealVault = caps.includes("sudo") && caps.includes("update");
} catch (e) { } catch {
canSealVault = false; canSealVault = false;
} }

View file

@ -24,7 +24,7 @@ export function getKeyByObjectPropertyValue(
export function verifyJSONString(str: string): boolean { export function verifyJSONString(str: string): boolean {
try { try {
JSON.parse(str); JSON.parse(str);
} catch (e) { } catch {
return false; return false;
} }
return true; return true;

View file

@ -3,5 +3,5 @@ export const fileToBase64 = (file: File): Promise<string> =>
const reader = new FileReader(); const reader = new FileReader();
reader.readAsDataURL(file); reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result as string); reader.onload = () => resolve(reader.result as string);
reader.onerror = (error) => reject(error); reader.onerror = () => reject(new Error("Could not convert file to base64"));
}); });

View file

@ -1,5 +1,5 @@
import { de, enGB, fr, it, nl, ru } from "date-fns/locale";
import { Locale, formatDistance as formatDistanceReal } from "date-fns"; import { Locale, formatDistance as formatDistanceReal } from "date-fns";
import { de, enGB, fr, it, nl, ru } from "date-fns/locale";
function getLocale(language: string): Locale { function getLocale(language: string): Locale {
return { return {

5231
yarn.lock

File diff suppressed because it is too large Load diff

1876
yarn.nix

File diff suppressed because it is too large Load diff