From 82f8c31b81cfc77dd9dbaa671619938e0fcece3e Mon Sep 17 00:00:00 2001 From: caranicas Date: Mon, 19 Sep 2022 15:37:21 -0400 Subject: [PATCH] fix some linting issues --- ui/frontend/build_src/.eslintrc.cjs | 38 +++++++----- ui/frontend/build_src/package.json | 1 - ui/frontend/build_src/src/App.tsx | 2 +- ui/frontend/build_src/src/api/index.ts | 2 +- .../components/atoms/modifierTag/index.tsx | 2 +- .../components/molecules/betaMode/index.tsx | 4 +- .../components/molecules/drawImage/index.tsx | 2 +- .../molecules/generatedImage/index.tsx | 2 +- .../advancedSettings/gpuSettings/index.tsx | 8 +-- .../improvementSettings/index.tsx | 10 +-- .../creationPanel/advancedSettings/index.tsx | 4 +- .../propertySettings/index.tsx | 16 ++--- .../workflowSettings/index.tsx | 8 +-- .../basicCreation/activeTags/index.tsx | 2 +- .../creationPanel/basicCreation/index.tsx | 2 +- .../basicCreation/makeButton/index.tsx | 3 +- .../basicCreation/seedImage/index.tsx | 6 +- .../creationPanel/imageModifiers/index.tsx | 6 +- .../organisms/creationPanel/index.tsx | 2 +- .../creationPanel/inpaintingPanel/index.tsx | 6 +- .../displayPanel/completedImages/index.tsx | 2 +- .../displayPanel/currentDisplay/index.tsx | 3 +- .../organisms/footerDisplay/index.tsx | 2 +- .../organisms/headerDisplay/index.tsx | 4 +- .../headerDisplay/statusDisplay/index.tsx | 2 +- .../src/pages/Experimental/index.tsx | 2 +- .../build_src/src/pages/Home/index.tsx | 2 +- .../build_src/src/pages/Settings/index.tsx | 2 +- .../build_src/src/stores/imageCreateStore.ts | 62 +++++++++---------- .../build_src/src/stores/imageQueueStore.ts | 4 +- .../build_src/src/styles/theme/index.css.ts | 2 +- 31 files changed, 112 insertions(+), 101 deletions(-) diff --git a/ui/frontend/build_src/.eslintrc.cjs b/ui/frontend/build_src/.eslintrc.cjs index 96de7b28..656195f8 100644 --- a/ui/frontend/build_src/.eslintrc.cjs +++ b/ui/frontend/build_src/.eslintrc.cjs @@ -9,40 +9,50 @@ module.exports = { parserOptions: { ecmaVersion: "latest", sourceType: "module", + ecmaFeatures: { + jsx: true, + }, tsconfigRootDir: __dirname, }, + plugins: ["react"], + extends: [ "plugin:react/recommended", "standard-with-typescript", "plugin:i18next/recommended", "plugin:i18n-json/recommended", ], + settings: { + react: { + version: "detect", + }, + }, rules: { // general things turned off for now - "prefer-const": "off", "no-debugger": "warn", "eol-last": "off", - "comma-dangle": ["off", "always-multiline"], "no-void": ["off"], "array-callback-return": ["off"], - - "react/display-name": "warn", - quotes: ["off", "double"], - semi: ["off", "always"], - "no-multiple-empty-lines": ["off", { max: 2, maxEOF: 1 }], - yoda: ["off"], - eqeqeq: ["off"], "spaced-comment": ["off"], "padded-blocks": ["off"], + "no-multiple-empty-lines": ["off", { max: 2, maxEOF: 1 }], + quotes: ["off", "double"], + semi: ["off", "always"], + yoda: ["off"], + eqeqeq: ["off"], + "react/display-name": "warn", + + // TS THINGS WE DONT WANT + "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/ban-ts-comment": "off", + + // TS WARNINGS WE WANT + "@typescript-eslint/no-unused-vars": "warn", // TS things turned off for now - "@typescript-eslint/ban-ts-comment": "off", - "@typescript-eslint/no-array-constructor": "off", - "@typescript-eslint/explicit-function-return-type": "off", - "@typescript-eslint/no-unused-vars": "off", - "@typescript-eslint/naming-convention": "off", + // "@typescript-eslint/naming-convention": "off", "@typescript-eslint/restrict-template-expressions": "off", "@typescript-eslint/prefer-optional-chain": "off", "@typescript-eslint/no-non-null-assertion": "off", diff --git a/ui/frontend/build_src/package.json b/ui/frontend/build_src/package.json index 97ae081a..46e6b350 100644 --- a/ui/frontend/build_src/package.json +++ b/ui/frontend/build_src/package.json @@ -4,7 +4,6 @@ "version": "0.0.0", "type": "module", "scripts": { - "lint": "eslint --ext .tsx --fix src", "pretty": "prettier --write .", "dev": "vite", "build": "tsc && vite build --emptyOutDir", diff --git a/ui/frontend/build_src/src/App.tsx b/ui/frontend/build_src/src/App.tsx index a3cd0b0b..fc245456 100644 --- a/ui/frontend/build_src/src/App.tsx +++ b/ui/frontend/build_src/src/App.tsx @@ -7,7 +7,7 @@ import { darkTheme, lightTheme } from "./styles/theme/index.css.ts"; import "./Translation/config"; const location = new ReactLocation(); -function App() { +function App () { // just check for the theme one 1 time // var { matches } = window.matchMedia('(prefers-color-scheme: dark)') diff --git a/ui/frontend/build_src/src/api/index.ts b/ui/frontend/build_src/src/api/index.ts index ad5b7843..5524b2e6 100644 --- a/ui/frontend/build_src/src/api/index.ts +++ b/ui/frontend/build_src/src/api/index.ts @@ -11,7 +11,7 @@ export const API_URL = import.meta.env.DEV ? "http://localhost:9000" : ""; export const HEALTH_PING_INTERVAL = 5000; // 5 seconds export const healthPing = async () => { const pingUrl = `${API_URL}/ping`; - let response = await fetch(pingUrl); + const response = await fetch(pingUrl); const data = await response.json(); return data; }; diff --git a/ui/frontend/build_src/src/components/atoms/modifierTag/index.tsx b/ui/frontend/build_src/src/components/atoms/modifierTag/index.tsx index 62e9f638..b794c986 100644 --- a/ui/frontend/build_src/src/components/atoms/modifierTag/index.tsx +++ b/ui/frontend/build_src/src/components/atoms/modifierTag/index.tsx @@ -5,7 +5,7 @@ interface ModifierTagProps { name: string; } -export default function ModifierTag({ name }: ModifierTagProps) { +export default function ModifierTag ({ name }: ModifierTagProps) { const hasTag = useImageCreate((state) => state.hasTag(name)) ? "selected" : ""; diff --git a/ui/frontend/build_src/src/components/molecules/betaMode/index.tsx b/ui/frontend/build_src/src/components/molecules/betaMode/index.tsx index 5c7eed6a..b76ef9ec 100644 --- a/ui/frontend/build_src/src/components/molecules/betaMode/index.tsx +++ b/ui/frontend/build_src/src/components/molecules/betaMode/index.tsx @@ -34,9 +34,9 @@ export default function BetaMode() { // TODO: make this a custom hook useEffect(() => { if (configStatus === "success") { - const { update_branch } = configData; + const { update_branch: updateBranch } = configData; - if (update_branch === "main") { + if (updateBranch === "main") { setBranchToGetNext("beta"); } else { // setIsBeta(true); diff --git a/ui/frontend/build_src/src/components/molecules/drawImage/index.tsx b/ui/frontend/build_src/src/components/molecules/drawImage/index.tsx index 5e236393..6595bb31 100644 --- a/ui/frontend/build_src/src/components/molecules/drawImage/index.tsx +++ b/ui/frontend/build_src/src/components/molecules/drawImage/index.tsx @@ -16,7 +16,7 @@ interface DrawImageProps { isErasing: boolean; } -export default function DrawImage({ +export default function DrawImage ({ imageData, brushSize, brushShape, diff --git a/ui/frontend/build_src/src/components/molecules/generatedImage/index.tsx b/ui/frontend/build_src/src/components/molecules/generatedImage/index.tsx index 23a28ce2..ef994c29 100644 --- a/ui/frontend/build_src/src/components/molecules/generatedImage/index.tsx +++ b/ui/frontend/build_src/src/components/molecules/generatedImage/index.tsx @@ -14,7 +14,7 @@ interface GeneretaedImageProps { // children: never[]; } -export default function GeneratedImage({ +export default function GeneratedImage ({ imageData, metadata, className, diff --git a/ui/frontend/build_src/src/components/organisms/creationPanel/advancedSettings/gpuSettings/index.tsx b/ui/frontend/build_src/src/components/organisms/creationPanel/advancedSettings/gpuSettings/index.tsx index 99a39321..2f58e629 100644 --- a/ui/frontend/build_src/src/components/organisms/creationPanel/advancedSettings/gpuSettings/index.tsx +++ b/ui/frontend/build_src/src/components/organisms/creationPanel/advancedSettings/gpuSettings/index.tsx @@ -14,10 +14,10 @@ import { export default function GpuSettings() { const turbo = useImageCreate((state) => state.getValueForRequestKey("turbo")); - const use_cpu = useImageCreate((state) => + const useCpu = useImageCreate((state) => state.getValueForRequestKey("use_cpu") ); - const use_full_precision = useImageCreate((state) => + const useFullPrecision = useImageCreate((state) => state.getValueForRequestKey("use_full_precision") ); @@ -48,7 +48,7 @@ export default function GpuSettings() {