Make the build not fail

This commit is contained in:
phntxx 2022-04-10 21:31:40 +02:00
parent 765ab6d643
commit 3131110b4c
9 changed files with 214 additions and 434 deletions

View file

@ -1,5 +1,12 @@
module.exports = { module.exports = {
extends: ["eslint:recommended", "plugin:react-hooks/recommended"], root: true,
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
extends: [
"eslint:recommended",
"plugin:react-hooks/recommended",
"plugin:@typescript-eslint/recommended",
],
rules: { rules: {
maxClassesPerFile: 0, maxClassesPerFile: 0,
maxLineLength: 0, maxLineLength: 0,

View file

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2021 Bastian Meissner Copyright (c) 2022 Bastian Meissner
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View file

@ -3,30 +3,29 @@
"version": "1.0.0", "version": "1.0.0",
"license": "MIT", "license": "MIT",
"repository": "git@github.com:phntxx/dashboard", "repository": "git@github.com:phntxx/dashboard",
"contributors": [ "contributors": ["phntxx <hello@phntxx.com>"],
"phntxx <hello@phntxx.com>"
],
"private": false, "private": false,
"dependencies": { "dependencies": {
"@types/node": "^14.14.37", "@types/node": "^17.0.23",
"@types/react-dom": "^17.0.3", "@types/react-dom": "^18.0.0",
"@types/styled-components": "^5.1.9", "@types/styled-components": "^5.1.9",
"browserslist": "^4.16.6", "browserslist": "^4.16.6",
"http-server": "^14.1.0", "http-server": "^14.1.0",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"react": "^17.0.2", "react": "^18.0.0",
"react-dom": "^17.0.2", "react-dom": "^18.0.0",
"react-scripts": "^5.0.0", "react-scripts": "^5.0.0",
"styled-components": "^5.2.1", "styled-components": "^5.2.1",
"typescript": "^4.2.3" "typescript": "^4.2.3"
}, },
"devDependencies": { "devDependencies": {
"@testing-library/jest-dom": "^5.11.10", "@testing-library/jest-dom": "^5.11.10",
"@testing-library/react": "^11.2.7", "@testing-library/react": "^13.0.0",
"@testing-library/user-event": "^13.0.6", "@testing-library/user-event": "^14.0.4",
"@types/jest": "^26.0.22", "@types/jest": "^27.4.1",
"@typescript-eslint/parser": "^5.18.0",
"codecov": "^3.8.2", "codecov": "^3.8.2",
"eslint": "^7.28.0", "eslint": "^8.13.0",
"eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-react-hooks": "^4.2.0",
"prettier": "^2.3.1" "prettier": "^2.3.1"
}, },
@ -47,11 +46,7 @@
"extends": "react-app" "extends": "react-app"
}, },
"browserslist": { "browserslist": {
"production": [ "production": [">0.2%", "not dead", "not op_mini all"],
">0.2%",
"not dead",
"not op_mini all"
],
"development": [ "development": [
"last 1 chrome version", "last 1 chrome version",
"last 1 firefox version", "last 1 firefox version",

View file

@ -40,7 +40,7 @@ const App = () => {
} = useFetch(); } = useFetch();
const theme = getTheme(); const theme = getTheme();
let isDark = useMediaQuery("(prefers-color-scheme: dark)"); const isDark = useMediaQuery("(prefers-color-scheme: dark)");
setScheme(isDark ? "dark-theme" : "light-theme"); setScheme(isDark ? "dark-theme" : "light-theme");
return ( return (

View file

@ -55,7 +55,7 @@ export const isBetween = (a: number, b: number, c: number): boolean =>
* @returns {string} a greeting * @returns {string} a greeting
*/ */
export const getGreeting = (greetings: Array<IGreetingProps>): string => { export const getGreeting = (greetings: Array<IGreetingProps>): string => {
let hours = Math.floor(new Date().getHours()); const hours = Math.floor(new Date().getHours());
let result = ""; let result = "";
greetings.forEach((greeting) => { greetings.forEach((greeting) => {
@ -95,14 +95,14 @@ export const getDateString = (
months: Array<string>, months: Array<string>,
format: string, format: string,
) => { ) => {
let currentDate = new Date(); const currentDate = new Date();
let weekday = weekdays[currentDate.getDay()]; const weekday = weekdays[currentDate.getDay()];
let day = currentDate.getDate(); const day = currentDate.getDate();
let month = months[currentDate.getMonth()]; const month = months[currentDate.getMonth()];
let extension = getExtension(day); const extension = getExtension(day);
let year = currentDate.getFullYear(); const year = currentDate.getFullYear();
let isodate = currentDate.toISOString().slice(0, 10); const isodate = currentDate.toISOString().slice(0, 10);
return format return format
.replace("%wd", weekday) .replace("%wd", weekday)

View file

@ -56,14 +56,14 @@ export const handleQueryWithProvider = (
search: ISearchProps, search: ISearchProps,
query: string, query: string,
) => { ) => {
let queryArray: Array<string> = query.split(" "); const queryArray: Array<string> = query.split(" ");
let prefix: string = queryArray[0]; const prefix: string = queryArray[0];
queryArray.shift(); queryArray.shift();
let searchQuery: string = queryArray.join(" "); const searchQuery: string = queryArray.join(" ");
let providerFound: boolean = false; let providerFound = false;
if (search.providers) { if (search.providers) {
search.providers.forEach((provider: ISearchProviderProps) => { search.providers.forEach((provider: ISearchProviderProps) => {
if (provider.prefix === prefix) { if (provider.prefix === prefix) {
@ -81,15 +81,15 @@ export const handleQueryWithProvider = (
* @param {ISearchBarProps} search - The search providers for the search bar to use * @param {ISearchBarProps} search - The search providers for the search bar to use
*/ */
const SearchBar = ({ search }: ISearchBarProps) => { const SearchBar = ({ search }: ISearchBarProps) => {
let [input, setInput] = useState<string>(""); const [input, setInput] = useState<string>("");
let [buttonsHidden, setButtonsHidden] = useState<boolean>(true); const [buttonsHidden, setButtonsHidden] = useState<boolean>(true);
useEffect(() => setButtonsHidden(input === ""), [input]); useEffect(() => setButtonsHidden(input === ""), [input]);
if (search === undefined) return <></>; if (search === undefined) return <></>;
const handleSearchQuery = (e: React.FormEvent) => { const handleSearchQuery = (e: React.FormEvent) => {
var query: string = input || ""; const query: string = input || "";
if (query.split(" ")[0].includes("/")) { if (query.split(" ")[0].includes("/")) {
handleQueryWithProvider(search, query); handleQueryWithProvider(search, query);

View file

@ -49,7 +49,7 @@ interface IFetchProps {
* Fetches app, bookmark, search, theme and imprint data and returns it. * Fetches app, bookmark, search, theme and imprint data and returns it.
*/ */
export const useFetcher = (): IFetchProps => { export const useFetcher = (): IFetchProps => {
let defaults: IDataProps<any> = { error: true }; const defaults: IDataProps<any> = { error: true };
const [appData, setAppData] = useState<IDataProps<IAppListProps>>(defaults); const [appData, setAppData] = useState<IDataProps<IAppListProps>>(defaults);
const [bookmarkData, setBookmarkData] = const [bookmarkData, setBookmarkData] =
@ -64,7 +64,14 @@ export const useFetcher = (): IFetchProps => {
useState<IDataProps<IGreeterDataProps>>(defaults); useState<IDataProps<IGreeterDataProps>>(defaults);
const callback = useCallback(() => { const callback = useCallback(() => {
let files = ["apps", "bookmarks", "search", "themes", "imprint", "greeter"]; const files = [
"apps",
"bookmarks",
"search",
"themes",
"imprint",
"greeter",
];
Promise.all(files.map((f) => fetchFile(f))).then( Promise.all(files.map((f) => fetchFile(f))).then(
([apps, bookmarks, search, themes, imprint, greeter]: any) => { ([apps, bookmarks, search, themes, imprint, greeter]: any) => {

View file

@ -58,7 +58,7 @@ export const getTheme = (scheme?: string): IThemeProps => {
currentScheme = "dark-theme"; currentScheme = "dark-theme";
} }
let theme = const theme =
currentScheme === "dark-theme" currentScheme === "dark-theme"
? localStorage.getItem("dark-theme") ? localStorage.getItem("dark-theme")
: localStorage.getItem("light-theme"); : localStorage.getItem("light-theme");

565
yarn.lock

File diff suppressed because it is too large Load diff