Skip to content

Commit

Permalink
👷 ci: Fix eslint style
Browse files Browse the repository at this point in the history
  • Loading branch information
canisminor1990 committed Nov 27, 2023
1 parent e5bfa3c commit ef5c03e
Show file tree
Hide file tree
Showing 86 changed files with 2,785 additions and 2,770 deletions.
19 changes: 17 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const config = require('@lobehub/lint').eslint;

config.rules['no-undef'] = 0;
config.rules['unicorn/prefer-add-event-listener'] = 0;
config.rules['unicorn/no-negated-condition'] = 0;
config.rules['unicorn/prefer-type-error'] = 0;
Expand All @@ -15,4 +14,20 @@ config.rules['react/no-unknown-property'] = 0;
config.rules['unicorn/prefer-ternary'] = 0;
config.rules['unicorn/prefer-spread'] = 0;

module.exports = config;
config.rules['indent'] = ['off', 2];

module.exports = {
...config,
overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
'linebreak-style': 0,
'no-undef': 0,
'object-curly-spacing': 0,
'unicorn/prefer-add-event-listener': 0,
'unused-imports/no-unused-imports': 0,
},
},
],
};
2 changes: 1 addition & 1 deletion .github/workflows/issue-auto-comments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ jobs:
actions: 'remove-labels'
token: ${{ secrets.GH_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: 'Inactive'
labels: 'Inactive'
2 changes: 1 addition & 1 deletion .github/workflows/issue-close-require.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
with:
actions: 'close-issues'
token: ${{ secrets.GH_TOKEN }}
labels: "Inactive"
labels: 'Inactive'
inactive-day: 90
body: |
Since the issue was labeled with `Inactive`, and no response in 30 days. This issue will be closed. If you have any questions, you can comment and reply.
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/issues-translate.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Issue Translate
on:
issue_comment:
on:
issue_comment:
types: [created]
issues:
issues:
types: [opened]

jobs:
Expand All @@ -11,4 +11,4 @@ jobs:
steps:
- uses: usthe/[email protected]
with:
BOT_GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
BOT_GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:
- name: Test
run: bun run test

# - name: Build
# run: bun run build
# - name: Build
# run: bun run build

- name: Release
run: bun run release
Expand Down
2 changes: 1 addition & 1 deletion javascript/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
],
"*.{js,jsx}": [
"prettier --write",
"stylelint --fix --allow-empty-input",
"stylelint --fix",
"eslint --fix"
],
"*.{ts,tsx}": [
Expand Down
96 changes: 48 additions & 48 deletions src/app/index.tsx
Original file line number Diff line number Diff line change
@@ -1,68 +1,68 @@
import {LayoutHeader, LayoutMain, LayoutSidebar} from '@lobehub/ui';
import { LayoutHeader, LayoutMain, LayoutSidebar } from '@lobehub/ui';
import isEqual from 'fast-deep-equal';
import {memo, useEffect} from 'react';
import { memo, useEffect } from 'react';

import '@/locales/config';
import {PromptHighlight} from '@/modules/PromptHighlight';
import { PromptHighlight } from '@/modules/PromptHighlight';
import replaceIcon from '@/scripts/replaceIcon';
import {selectors, useAppStore} from '@/store';
import { selectors, useAppStore } from '@/store';
import GlobalStyle from '@/styles';

import Content from '../features/Content';
import ExtraNetworkSidebar from '../features/ExtraNetworkSidebar';
import Footer from '../features/Footer';
import Header from '../features/Header';
import QuickSettingSidebar from '../features/QuickSettingSidebar';
import {useStyles} from './style';
import { useStyles } from './style';

const HEADER_HEIGHT = 64;

const Index = memo(() => {
const setting = useAppStore(selectors.currentSetting, isEqual);
const {cx, styles} = useStyles({
headerHeight: HEADER_HEIGHT,
isPrimaryColor: Boolean(setting.primaryColor),
});
const setting = useAppStore(selectors.currentSetting, isEqual);
const { cx, styles } = useStyles({
headerHeight: HEADER_HEIGHT,
isPrimaryColor: Boolean(setting.primaryColor),
});

useEffect(() => {
if (setting.enableHighlight) {
PromptHighlight('#txt2img_prompt', '#lobe_txt2img_prompt');
PromptHighlight('#img2img_prompt', '#lobe_img2img_prompt');
}
if (setting.svgIcon) replaceIcon();
}, []);
useEffect(() => {
if (setting.enableHighlight) {
PromptHighlight('#txt2img_prompt', '#lobe_txt2img_prompt');
PromptHighlight('#img2img_prompt', '#lobe_img2img_prompt');
}
if (setting.svgIcon) replaceIcon();
}, []);

return (
<>
<GlobalStyle />
<LayoutHeader headerHeight={HEADER_HEIGHT}>
<Header />
</LayoutHeader>
<LayoutMain>
{<div className={setting.liteAnimation ? styles.backgroundLite : styles.background} />}
{setting.enableSidebar && (
<LayoutSidebar
className={styles.sidebar}
headerHeight={HEADER_HEIGHT}
style={{flex: 0, zIndex: 50}}
>
<QuickSettingSidebar headerHeight={HEADER_HEIGHT} />
</LayoutSidebar>
)}
<Content className={cx(!setting.enableSidebar && styles.quicksettings)} />
{setting?.enableExtraNetworkSidebar && (
<LayoutSidebar
className={styles.sidebar}
headerHeight={HEADER_HEIGHT}
style={{flex: 0, zIndex: 50}}
>
<ExtraNetworkSidebar headerHeight={HEADER_HEIGHT} />
</LayoutSidebar>
)}
</LayoutMain>
<Footer />
</>
);
return (
<>
<GlobalStyle />
<LayoutHeader headerHeight={HEADER_HEIGHT}>
<Header />
</LayoutHeader>
<LayoutMain>
{<div className={setting.liteAnimation ? styles.backgroundLite : styles.background} />}
{setting.enableSidebar && (
<LayoutSidebar
className={styles.sidebar}
headerHeight={HEADER_HEIGHT}
style={{ flex: 0, zIndex: 50 }}
>
<QuickSettingSidebar headerHeight={HEADER_HEIGHT} />
</LayoutSidebar>
)}
<Content className={cx(!setting.enableSidebar && styles.quicksettings)} />
{setting?.enableExtraNetworkSidebar && (
<LayoutSidebar
className={styles.sidebar}
headerHeight={HEADER_HEIGHT}
style={{ flex: 0, zIndex: 50 }}
>
<ExtraNetworkSidebar headerHeight={HEADER_HEIGHT} />
</LayoutSidebar>
)}
</LayoutMain>
<Footer />
</>
);
});

export default Index;
118 changes: 59 additions & 59 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,69 +1,69 @@
import {consola} from 'consola';
import {PropsWithChildren, Suspense, memo, useEffect, useState} from 'react';
import {Helmet} from 'react-helmet';
import {shallow} from 'zustand/shallow';
import { consola } from 'consola';
import { PropsWithChildren, Suspense, memo, useEffect, useState } from 'react';
import { Helmet } from 'react-helmet';
import { shallow } from 'zustand/shallow';

import {Loading} from '@/components';
import { Loading } from '@/components';
import Layout from '@/layouts';
import {useAppStore} from '@/store';
import { useAppStore } from '@/store';

import manifest from './manifest';

export const Layouts = memo<PropsWithChildren>(({children}) => {
const [loading, setLoading] = useState(true);
const {setCurrentTab, onInit, storeLoading} = useAppStore(
(st) => ({
onInit: st.onInit,
setCurrentTab: st.setCurrentTab,
storeLoading: st.loading,
}),
shallow,
);
export const Layouts = memo<PropsWithChildren>(({ children }) => {
const [loading, setLoading] = useState(true);
const { setCurrentTab, onInit, storeLoading } = useAppStore(
(st) => ({
onInit: st.onInit,
setCurrentTab: st.setCurrentTab,
storeLoading: st.loading,
}),
shallow,
);

useEffect(() => {
onInit();
onUiLoaded(() => {
setLoading(false);
consola.success('🤯 Lobe Theme loading');
});
onUiTabChange(() => {
setCurrentTab();
});
}, []);
useEffect(() => {
onInit();
onUiLoaded(() => {
setLoading(false);
consola.success('🤯 Lobe Theme loading');
});
onUiTabChange(() => {
setCurrentTab();
});
}, []);

return (
<Suspense fallback="loading...">
<Helmet>
<link
href="https://registry.npmmirror.com/@lobehub/assets-favicons/1.1.0/files/assets/apple-touch-icon.png"
rel="apple-touch-icon"
sizes="180x180"
/>
<link
href="https://registry.npmmirror.com/@lobehub/assets-favicons/1.1.0/files/assets/favicon-32x32.png"
rel="icon"
sizes="32x32"
type="image/png"
/>
<link
href="https://registry.npmmirror.com/@lobehub/assets-favicons/1.1.0/files/assets/favicon-16x16.png"
rel="icon"
sizes="16x16"
type="image/png"
/>
<link
href="https://registry.npmmirror.com/@lobehub/assets-favicons/1.1.0/files/assets/site.webmanifest"
rel="manifest"
/>
<meta content="Stable Diffusion · LobeHub" name="apple-mobile-web-app-title" />
<meta content="Stable Diffusion · LobeHub" name="application-name" />
<meta content="#000000" name="msapplication-TileColor" />
<meta content="#000000" name="theme-color" />
<link href={manifest} rel="manifest" />
</Helmet>
<Layout>{storeLoading === false && loading === false ? children : <Loading />}</Layout>
</Suspense>
);
return (
<Suspense fallback="loading...">
<Helmet>
<link
href="https://registry.npmmirror.com/@lobehub/assets-favicons/1.1.0/files/assets/apple-touch-icon.png"
rel="apple-touch-icon"
sizes="180x180"
/>
<link
href="https://registry.npmmirror.com/@lobehub/assets-favicons/1.1.0/files/assets/favicon-32x32.png"
rel="icon"
sizes="32x32"
type="image/png"
/>
<link
href="https://registry.npmmirror.com/@lobehub/assets-favicons/1.1.0/files/assets/favicon-16x16.png"
rel="icon"
sizes="16x16"
type="image/png"
/>
<link
href="https://registry.npmmirror.com/@lobehub/assets-favicons/1.1.0/files/assets/site.webmanifest"
rel="manifest"
/>
<meta content="Stable Diffusion · LobeHub" name="apple-mobile-web-app-title" />
<meta content="Stable Diffusion · LobeHub" name="application-name" />
<meta content="#000000" name="msapplication-TileColor" />
<meta content="#000000" name="theme-color" />
<link href={manifest} rel="manifest" />
</Helmet>
<Layout>{storeLoading === false && loading === false ? children : <Loading />}</Layout>
</Suspense>
);
});

export default Layouts;
46 changes: 23 additions & 23 deletions src/app/manifest.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
const manifest = {
background_color: '#000000',
description:
background_color: '#000000',
description:
'The modern theme for stable diffusion webui, exquisite interface design, highly customizable UI, and efficiency boosting features.',
display: 'standalone',
icons: [
{
sizes: '192x192',
src: 'https://registry.npmmirror.com/@lobehub/assets-favicons/1.1.0/files/assets/android-chrome-192x192.png',
type: 'image/png',
},
{
sizes: '512x512',
src: 'https://registry.npmmirror.com/@lobehub/assets-favicons/1.1.0/files/assets/android-chrome-512x512.png',
type: 'image/png',
},
],
id: '/',
name: 'Stable Diffusion',
orientation: 'portrait',
scope: '/',
short_name: 'Stable Diffusion',
splash_pages: null,
start_url: location.origin,
theme_color: '#000000',
display: 'standalone',
icons: [
{
sizes: '192x192',
src: 'https://registry.npmmirror.com/@lobehub/assets-favicons/1.1.0/files/assets/android-chrome-192x192.png',
type: 'image/png',
},
{
sizes: '512x512',
src: 'https://registry.npmmirror.com/@lobehub/assets-favicons/1.1.0/files/assets/android-chrome-512x512.png',
type: 'image/png',
},
],
id: '/',
name: 'Stable Diffusion',
orientation: 'portrait',
scope: '/',
short_name: 'Stable Diffusion',
splash_pages: null,
start_url: location.origin,
theme_color: '#000000',
};

export default `data:application/manifest+json;base64,${btoa(JSON.stringify(manifest))}`;
10 changes: 5 additions & 5 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import Index from './index';
import Layout from './layout';

export default () => {
return (
<Layout>
<Index />
</Layout>
);
return (
<Layout>
<Index />
</Layout>
);
};
Loading

0 comments on commit ef5c03e

Please sign in to comment.