fix all the linting errors i can

This commit is contained in:
caranicas 2022-09-20 14:21:21 -04:00
parent f04b5244fa
commit d84fb244d3
24 changed files with 156 additions and 154 deletions

View File

@ -54,20 +54,14 @@ module.exports = {
"@typescript-eslint/space-before-function-paren": "off", "@typescript-eslint/space-before-function-paren": "off",
"@typescript-eslint/quotes": "off", "@typescript-eslint/quotes": "off",
"@typescript-eslint/semi": "off", "@typescript-eslint/semi": "off",
"@typescript-eslint/brace-style": "off",
"@typescript-eslint/indent": "off",
"@typescript-eslint/member-delimiter-style": "off",
// TS WARNINGS WE WANT // TS WARNINGS WE WANT
"@typescript-eslint/no-unused-vars": "warn", "@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/no-non-null-assertion": "warn", "@typescript-eslint/no-non-null-assertion": "warn",
// TS things turned off for now
"@typescript-eslint/consistent-type-assertions": "off",
"@typescript-eslint/restrict-plus-operands": "off",
"@typescript-eslint/brace-style": "off",
"@typescript-eslint/prefer-ts-expect-error": "off",
"@typescript-eslint/indent": "off",
// "@typescript-eslint/member-delimiter-style": "off",
// i18n stuff no string literal works but turned off for now // i18n stuff no string literal works but turned off for now
"i18next/no-literal-string": "off", "i18next/no-literal-string": "off",
// still need to figure out how to get this to work // still need to figure out how to get this to work

View File

@ -12,16 +12,21 @@ export const resources = {
translation: ESTranslation, translation: ESTranslation,
}, },
} as const; } as const;
i18n.use(initReactI18next).init({ i18n
lng: "en", .use(initReactI18next)
interpolation: { .init({
escapeValue: false, lng: "en",
}, interpolation: {
resources, escapeValue: false,
}).then(() => { },
console.log("i18n initialized"); resources,
}).catch((err) => { })
console.error("i18n initialization failed", err); .then(() => {
}).finally(() => { console.log("i18n initialized");
console.log("i18n initialization finished"); })
}); .catch((err) => {
console.error("i18n initialization failed", err);
})
.finally(() => {
console.log("i18n initialization finished");
});

View File

@ -61,14 +61,14 @@ export interface ImageOutput {
data: string; data: string;
path_abs: string | null; path_abs: string | null;
seed: number; seed: number;
}; }
export interface ImageReturnType { export interface ImageReturnType {
output: ImageOutput[]; output: ImageOutput[];
request: {}; request: {};
status: string; status: string;
session_id: string; session_id: string;
}; }
export const MakeImageKey = "MakeImage"; export const MakeImageKey = "MakeImage";
export const doMakeImage = async (reqBody: ImageRequest) => { export const doMakeImage = async (reqBody: ImageRequest) => {
@ -82,4 +82,4 @@ export const doMakeImage = async (reqBody: ImageRequest) => {
const data = await res.json(); const data = await res.json();
return data; return data;
}; };

View File

@ -8,12 +8,12 @@ import {
// https://github.com/embiem/react-canvas-draw // https://github.com/embiem/react-canvas-draw
interface DrawImageProps { interface DrawImageProps {
imageData: string imageData: string;
brushSize: string brushSize: string;
brushShape: string brushShape: string;
brushColor: string brushColor: string;
isErasing: boolean isErasing: boolean;
} }
export default function DrawImage({ export default function DrawImage({
@ -99,7 +99,13 @@ export default function DrawImage({
} }
}; };
const _drawCursor = (x, y, brushSize, brushShape, brushColor) => { const _drawCursor = (
x: number,
y: number,
brushSize: number,
brushShape: string,
brushColor: string
) => {
const canvas = cursorRef.current; const canvas = cursorRef.current;
if (canvas != null) { if (canvas != null) {
const ctx = canvas.getContext("2d"); const ctx = canvas.getContext("2d");

View File

@ -1,6 +1,6 @@
import { style, globalStyle } from "@vanilla-extract/css"; import { style, globalStyle } from "@vanilla-extract/css";
// @ts-ignore // @ts-expect-error
import { vars } from "../../../../styles/theme/index.css.ts"; import { vars } from "../../../../styles/theme/index.css.ts";
// import { PanelBox } from "../../../../styles/shared.css.ts"; // import { PanelBox } from "../../../../styles/shared.css.ts";

View File

@ -48,7 +48,7 @@ export default function ImprovementSettings() {
// should probably be a store selector // should probably be a store selector
useEffect(() => { useEffect(() => {
// if either are true we arent disabled // if either are true we arent disabled
if (isUsingFaceCorrection || useUpscale != '') { if (isUsingFaceCorrection || useUpscale != "") {
setIsFilteringDisabled(false); setIsFilteringDisabled(false);
} else { } else {
setIsFilteringDisabled(true); setIsFilteringDisabled(true);

View File

@ -152,7 +152,7 @@ export default function PropertySettings() {
> >
{IMAGE_DIMENSIONS.map((dimension) => ( {IMAGE_DIMENSIONS.map((dimension) => (
<option <option
key={"width-option_" + dimension.value} key={`width-option_${dimension.value}`}
value={dimension.value} value={dimension.value}
> >
{dimension.label} {dimension.label}
@ -169,7 +169,7 @@ export default function PropertySettings() {
> >
{IMAGE_DIMENSIONS.map((dimension) => ( {IMAGE_DIMENSIONS.map((dimension) => (
<option <option
key={"height-option_" + dimension.value} key={`height-option_${dimension.value}`}
value={dimension.value} value={dimension.value}
> >
{dimension.label} {dimension.label}

View File

@ -1,6 +1,6 @@
import { style } from "@vanilla-extract/css"; import { style } from "@vanilla-extract/css";
// @ts-ignore // @ts-expect-error
import { vars } from "../../../../../styles/theme/index.css.ts"; import { vars } from "../../../../../styles/theme/index.css.ts";
export const MakeButtonStyle = style({ export const MakeButtonStyle = style({

View File

@ -1,6 +1,6 @@
import { style } from "@vanilla-extract/css"; import { style } from "@vanilla-extract/css";
// @ts-ignore // @ts-expect-error
import { vars } from "../../../../../styles/theme/index.css.ts"; import { vars } from "../../../../../styles/theme/index.css.ts";
export const ImageInputDisplay = style({ export const ImageInputDisplay = style({

View File

@ -3,27 +3,27 @@ import produce from "immer";
import { persist } from "zustand/middleware"; import { persist } from "zustand/middleware";
export interface ImageCreationUIOptions { export interface ImageCreationUIOptions {
isOpenAdvancedSettings: boolean isOpenAdvancedSettings: boolean;
isOpenAdvImprovementSettings: boolean isOpenAdvImprovementSettings: boolean;
isOpenAdvPropertySettings: boolean isOpenAdvPropertySettings: boolean;
isOpenAdvWorkflowSettings: boolean isOpenAdvWorkflowSettings: boolean;
isOpenAdvGPUSettings: boolean isOpenAdvGPUSettings: boolean;
isOpenImageModifier: boolean isOpenImageModifier: boolean;
imageMofidiersMap: object imageMofidiersMap: object;
toggleAdvancedSettings: () => void toggleAdvancedSettings: () => void;
toggleAdvImprovementSettings: () => void toggleAdvImprovementSettings: () => void;
toggleAdvPropertySettings: () => void toggleAdvPropertySettings: () => void;
toggleAdvWorkflowSettings: () => void toggleAdvWorkflowSettings: () => void;
toggleAdvGPUSettings: () => void toggleAdvGPUSettings: () => void;
toggleImageModifier: () => void toggleImageModifier: () => void;
// addImageModifier: (modifier: string) => void; // addImageModifier: (modifier: string) => void;
}; }
export const useCreateUI = create<ImageCreationUIOptions>( export const useCreateUI = create<ImageCreationUIOptions>(
//@ts-ignore //@ts-expect-error
persist( persist(
(set, get) => ({ (set, get) => ({
isOpenAdvancedSettings: false, isOpenAdvancedSettings: false,
@ -37,7 +37,7 @@ export const useCreateUI = create<ImageCreationUIOptions>(
toggleAdvancedSettings: () => { toggleAdvancedSettings: () => {
set( set(
produce((state: ImageCreationUIOptions) => { produce((state: ImageCreationUIOptions) => {
state.isOpenAdvancedSettings = !(state.isOpenAdvancedSettings); state.isOpenAdvancedSettings = !state.isOpenAdvancedSettings;
}) })
); );
}, },

View File

@ -1,5 +1,5 @@
import { style, globalStyle } from "@vanilla-extract/css"; import { style, globalStyle } from "@vanilla-extract/css";
// @ts-ignore // @ts-expect-error
import { vars } from "../../../../styles/theme/index.css.ts"; import { vars } from "../../../../styles/theme/index.css.ts";
export const ImagerModifierGroups = style({ export const ImagerModifierGroups = style({

View File

@ -16,7 +16,7 @@ import { useCreateUI } from "../creationPanelUIStore";
import ModifierTag from "../../../atoms/modifierTag"; import ModifierTag from "../../../atoms/modifierTag";
interface ModifierListProps { interface ModifierListProps {
tags: string[] tags: string[];
} }
function ModifierList({ tags }: ModifierListProps) { function ModifierList({ tags }: ModifierListProps) {
@ -32,8 +32,8 @@ function ModifierList({ tags }: ModifierListProps) {
} }
interface ModifierGroupingProps { interface ModifierGroupingProps {
title: string title: string;
tags: string[] tags: string[];
} }
function ModifierGrouping({ title, tags }: ModifierGroupingProps) { function ModifierGrouping({ title, tags }: ModifierGroupingProps) {
@ -78,14 +78,13 @@ export default function ImageModifers() {
<h3>Image Modifiers (art styles, tags, ect)</h3> <h3>Image Modifiers (art styles, tags, ect)</h3>
</button> </button>
{/* @ts-ignore */}
{imageModifierIsOpen && ( {imageModifierIsOpen && (
<ul className={ImagerModifierGroups}> <ul className={ImagerModifierGroups}>
{allModifiers.map((item, index) => { {allModifiers.map((item, index) => {
return ( return (
// @ts-ignore // @ts-expect-error
<li key={item[0]}> <li key={item[0]}>
{/* @ts-ignore */} {/* @ts-expect-error */}
<ModifierGrouping title={item[0]} tags={item[1]} /> <ModifierGrouping title={item[0]} tags={item[1]} />
</li> </li>
); );

View File

@ -1,6 +1,6 @@
import { style, globalStyle } from "@vanilla-extract/css"; import { style, globalStyle } from "@vanilla-extract/css";
// @ts-ignore // @ts-expect-error
import { vars } from "../../../../styles/theme/index.css.ts"; import { vars } from "../../../../styles/theme/index.css.ts";
export const completedImagesMain = style({ export const completedImagesMain = style({

View File

@ -2,10 +2,7 @@
/* eslint-disable @typescript-eslint/naming-convention */ /* eslint-disable @typescript-eslint/naming-convention */
import React from "react"; import React from "react";
import GeneratedImage from "../../../molecules/generatedImage"; import GeneratedImage from "../../../molecules/generatedImage";
import { import { useImageCreate } from "../../../../stores/imageCreateStore";
ImageRequest,
useImageCreate,
} from "../../../../stores/imageCreateStore";
import { CompletedImagesType } from "../index"; import { CompletedImagesType } from "../index";

View File

@ -1,6 +1,6 @@
import { style, globalStyle } from "@vanilla-extract/css"; import { style, globalStyle } from "@vanilla-extract/css";
// @ts-ignore // @ts-expect-error
import { vars } from "../../../styles/theme/index.css.ts"; import { vars } from "../../../styles/theme/index.css.ts";
export const FooterDisplayMain = style({ export const FooterDisplayMain = style({

View File

@ -2,7 +2,7 @@ import React from "react";
import { import {
FooterDisplayMain, FooterDisplayMain,
CoffeeButton, // @ts-ignore CoffeeButton, // @ts-expect-error
} from "./footerDisplay.css.ts"; } from "./footerDisplay.css.ts";
import { API_URL } from "../../../api"; import { API_URL } from "../../../api";

View File

@ -1,5 +1,5 @@
import { style, globalStyle } from "@vanilla-extract/css"; import { style, globalStyle } from "@vanilla-extract/css";
//@ts-ignore //@ts-expect-error
import { vars } from "../../../styles/theme/index.css.ts"; import { vars } from "../../../styles/theme/index.css.ts";
export const HeaderDisplayMain = style({ export const HeaderDisplayMain = style({

View File

@ -1,6 +1,6 @@
import { style } from "@vanilla-extract/css"; import { style } from "@vanilla-extract/css";
// @ts-ignore // @ts-expect-error
import { vars } from "../../../../styles/theme/index.css.ts"; import { vars } from "../../../../styles/theme/index.css.ts";
export const StartingStatus = style({ export const StartingStatus = style({

View File

@ -1,5 +1,5 @@
import { style } from "@vanilla-extract/css"; import { style } from "@vanilla-extract/css";
// @ts-ignore // @ts-expect-error
import { vars } from "../../styles/theme/index.css.ts"; import { vars } from "../../styles/theme/index.css.ts";
export const AppLayout = style({ export const AppLayout = style({

View File

@ -5,101 +5,101 @@ import { devtools } from "zustand/middleware";
import { useRandomSeed } from "../utils"; import { useRandomSeed } from "../utils";
export interface ImageCreationUiOptions { export interface ImageCreationUiOptions {
isUseRandomSeed: boolean isUseRandomSeed: boolean;
isUseAutoSave: boolean isUseAutoSave: boolean;
isSoundEnabled: boolean isSoundEnabled: boolean;
}; }
export interface ImageRequest { export interface ImageRequest {
prompt: string prompt: string;
seed: number seed: number;
num_outputs: number num_outputs: number;
num_inference_steps: number num_inference_steps: number;
guidance_scale: number guidance_scale: number;
width: width:
| 128 | 128
| 192 | 192
| 256 | 256
| 320 | 320
| 384 | 384
| 448 | 448
| 512 | 512
| 576 | 576
| 640 | 640
| 704 | 704
| 768 | 768
| 832 | 832
| 896 | 896
| 960 | 960
| 1024 | 1024;
height: height:
| 128 | 128
| 192 | 192
| 256 | 256
| 320 | 320
| 384 | 384
| 448 | 448
| 512 | 512
| 576 | 576
| 640 | 640
| 704 | 704
| 768 | 768
| 832 | 832
| 896 | 896
| 960 | 960
| 1024 | 1024;
// allow_nsfw: boolean // allow_nsfw: boolean
turbo: boolean turbo: boolean;
use_cpu: boolean use_cpu: boolean;
use_full_precision: boolean use_full_precision: boolean;
save_to_disk_path: null | string save_to_disk_path: null | string;
use_face_correction: null | "GFPGANv1.3" use_face_correction: null | "GFPGANv1.3";
use_upscale: null | "RealESRGAN_x4plus" | "RealESRGAN_x4plus_anime_6B" | "" use_upscale: null | "RealESRGAN_x4plus" | "RealESRGAN_x4plus_anime_6B" | "";
show_only_filtered_image: boolean show_only_filtered_image: boolean;
init_image: undefined | string init_image: undefined | string;
prompt_strength: undefined | number prompt_strength: undefined | number;
}; }
type ModifiersList = string[]; type ModifiersList = string[];
type ModifiersOptions = string | ModifiersList[]; type ModifiersOptions = string | ModifiersList[];
type ModifiersOptionList = ModifiersOptions[]; type ModifiersOptionList = ModifiersOptions[];
interface ImageCreateState { interface ImageCreateState {
parallelCount: number parallelCount: number;
requestOptions: ImageRequest requestOptions: ImageRequest;
allModifiers: ModifiersOptionList allModifiers: ModifiersOptionList;
tags: string[] tags: string[];
isInpainting: boolean isInpainting: boolean;
setParallelCount: (count: number) => void setParallelCount: (count: number) => void;
setRequestOptions: (key: keyof ImageRequest, value: any) => void setRequestOptions: (key: keyof ImageRequest, value: any) => void;
getValueForRequestKey: (key: keyof ImageRequest) => any getValueForRequestKey: (key: keyof ImageRequest) => any;
setAllModifiers: (modifiers: ModifiersOptionList) => void setAllModifiers: (modifiers: ModifiersOptionList) => void;
setModifierOptions: (key: string, value: any) => void setModifierOptions: (key: string, value: any) => void;
toggleTag: (tag: string) => void toggleTag: (tag: string) => void;
hasTag: (tag: string) => boolean hasTag: (tag: string) => boolean;
selectedTags: () => string[] selectedTags: () => string[];
builtRequest: () => ImageRequest builtRequest: () => ImageRequest;
uiOptions: ImageCreationUiOptions uiOptions: ImageCreationUiOptions;
toggleUseUpscaling: () => void toggleUseUpscaling: () => void;
// isUsingUpscaling: () => boolean // isUsingUpscaling: () => boolean
toggleUseFaceCorrection: () => void toggleUseFaceCorrection: () => void;
isUsingFaceCorrection: () => boolean isUsingFaceCorrection: () => boolean;
isUsingUpscaling: () => boolean isUsingUpscaling: () => boolean;
toggleUseRandomSeed: () => void toggleUseRandomSeed: () => void;
isRandomSeed: () => boolean isRandomSeed: () => boolean;
toggleUseAutoSave: () => void toggleUseAutoSave: () => void;
isUseAutoSave: () => boolean isUseAutoSave: () => boolean;
toggleSoundEnabled: () => void toggleSoundEnabled: () => void;
isSoundEnabled: () => boolean isSoundEnabled: () => boolean;
toggleInpainting: () => void toggleInpainting: () => void;
} }
// devtools breaks TS // devtools breaks TS
export const useImageCreate = create<ImageCreateState>( export const useImageCreate = create<ImageCreateState>(
// @ts-ignore // @ts-expect-error
devtools((set, get) => ({ devtools((set, get) => ({
parallelCount: 1, parallelCount: 1,
@ -120,7 +120,8 @@ export const useImageCreate = create<ImageCreateState>(
use_face_correction: "GFPGANv1.3", use_face_correction: "GFPGANv1.3",
use_upscale: "RealESRGAN_x4plus", use_upscale: "RealESRGAN_x4plus",
show_only_filtered_image: true, show_only_filtered_image: true,
} as ImageRequest, init_image: undefined,
},
// selected tags // selected tags
tags: [] as string[], tags: [] as string[],
@ -235,7 +236,7 @@ export const useImageCreate = create<ImageCreateState>(
produce((state) => { produce((state) => {
const isSeting = const isSeting =
typeof state.getValueForRequestKey("use_face_correction") === typeof state.getValueForRequestKey("use_face_correction") ===
"string" "string"
? null ? null
: "GFPGANv1.3"; : "GFPGANv1.3";
state.requestOptions.use_face_correction = isSeting; state.requestOptions.use_face_correction = isSeting;

View File

@ -35,7 +35,7 @@ export const useImageQueue = create<ImageQueueState>((set, get) => ({
}, },
firstInQueue: () => { firstInQueue: () => {
let first: ImageRequest | {} = get().images[0] let first: ImageRequest | {} = get().images[0];
first = void 0 !== first ? first : {}; first = void 0 !== first ? first : {};
return first; return first;
}, },

View File

@ -1,5 +1,5 @@
import { globalStyle } from "@vanilla-extract/css"; import { globalStyle } from "@vanilla-extract/css";
// @ts-ignore // @ts-expect-error
import { vars } from "./theme/index.css.ts"; import { vars } from "./theme/index.css.ts";
// baisc body style // baisc body style

View File

@ -1,5 +1,5 @@
import { style, globalStyle } from "@vanilla-extract/css"; import { style, globalStyle } from "@vanilla-extract/css";
// @ts-ignore // @ts-expect-error
import { vars } from "./theme/index.css.ts"; import { vars } from "./theme/index.css.ts";
export const PanelBox = style({ export const PanelBox = style({

File diff suppressed because one or more lines are too long