Skip to content

Commit

Permalink
Quickly fix the linting :)
Browse files Browse the repository at this point in the history
  • Loading branch information
YeonV committed Dec 15, 2024
1 parent 00f2749 commit 7478f35
Show file tree
Hide file tree
Showing 153 changed files with 5,567 additions and 3,393 deletions.
14 changes: 7 additions & 7 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import type { StorybookConfig } from '@storybook/react-webpack5'

const config: StorybookConfig = {
stories: [
'../src/**/*.mdx',
'../src/components/SchemaForm/**/*.stories.tsx',
'../src/components/Icons/BladeIcon/BladeIcon.stories.tsx',
'../src/stories/Doc/Api.stories.tsx',
'../src/components/Popover/Popover.stories.tsx',
'../src/pages/Devices/DeviceCard/DeviceCard.stories.tsx',
],
'../src/**/*.mdx',
'../src/components/SchemaForm/**/*.stories.tsx',
'../src/components/Icons/BladeIcon/BladeIcon.stories.tsx',
'../src/stories/Doc/Api.stories.tsx',
'../src/components/Popover/Popover.stories.tsx',
'../src/pages/Devices/DeviceCard/DeviceCard.stories.tsx'
],
addons: [
'@storybook/preset-create-react-app',
// '@storybook/addon-onboarding',
Expand Down
39 changes: 24 additions & 15 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
import type { Preview } from '@storybook/react'
import { BladeDarkBlueTheme as darkTheme, BladeLightBlueTheme as lightTheme } from '../src/themes/AppThemes'
import {
BladeDarkBlueTheme as darkTheme,
BladeLightBlueTheme as lightTheme
} from '../src/themes/AppThemes'
import './globals.css'
import '../src/index.css'

import { ThemeProvider, CssBaseline } from '@mui/material';
import { withThemeFromJSXProvider } from '@storybook/addon-themes';

import { ThemeProvider, CssBaseline } from '@mui/material'
import { withThemeFromJSXProvider } from '@storybook/addon-themes'

const preview: Preview = {
decorators: [
withThemeFromJSXProvider({
GlobalStyles: CssBaseline,
Provider: ThemeProvider,
themes: {
// Provide your custom themes here
light: lightTheme,
dark: darkTheme,
},
defaultTheme: 'light',
})],
GlobalStyles: CssBaseline,
Provider: ThemeProvider,
themes: {
// Provide your custom themes here
light: lightTheme,
dark: darkTheme
},
defaultTheme: 'light'
})
],
parameters: {
options: {
storySort: {
Expand All @@ -27,7 +30,13 @@ const preview: Preview = {
'BladeBook',
['Introduction', 'Getting Started', 'App Structure', 'Guides'],
'UI Components',
['Examples', 'Schema Components', 'Base Components', 'Default', ['*', 'Color']],
[
'Examples',
'Schema Components',
'Base Components',
'Default',
['*', 'Color']
],
'Api'
]
}
Expand All @@ -40,7 +49,7 @@ const preview: Preview = {
}
}
},
tags: ['autodocs'],
tags: ['autodocs']
}

export default preview
28 changes: 17 additions & 11 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,22 @@ const compat = new FlatCompat({

export default [
{
ignores: ['**/build/*', '**/*.js', '**/*.jsx', 'extraResources/**']
ignores: [
'**/build/*',
'**/*.js',
'**/*.jsx',
'**/*.mjs',
'**/*.cjs',
'extraResources/**'
]
},
...compat.extends(
'standard',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended'
// 'plugin:react-hooks/recommended'
'plugin:react-hooks/recommended',
'plugin:prettier/recommended',
),
{
plugins: {
'@typescript-eslint': typescriptEslint,
'prettier/prettier': prettier
// 'react-hooks': reactHooks
},

languageOptions: {
parser: tsParser,
parserOptions: {
Expand Down Expand Up @@ -94,7 +95,7 @@ export default [
'no-nested-ternary': 0,
'import/extensions': 0,
'import/first': 0,
'@typescript-eslint/indent': [2, 2],
'@/indent': [2, 2, { SwitchCase: 1}],
'react/react-in-jsx-scope': 'off',
'react/function-component-definition': [0],
'react/jsx-props-no-spreading': 0,
Expand All @@ -107,6 +108,11 @@ export default [
'@typescript-eslint/no-explicit-any': 0,
'@prettier/trailing-comma': 0,
'jsx-a11y/label-has-associated-control': 0
}
},
plugins: {
'@typescript-eslint': typescriptEslint,
'prettier/prettier': prettier
// 'react-hooks': reactHooks
},
}
]
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@
"cross-env": "^7.0.3",
"electron": "^33.2.1",
"electron-builder": "^25.1.8",
"eslint": "8.57",
"eslint": "9.17.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-flowtype": "^8.0.3",
Expand All @@ -215,6 +215,7 @@
"eslint-plugin-n": "^17.14.0",
"eslint-plugin-promise": "^7.2.1",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-storybook": "^0.11.1",
"gh-pages": "^6.1.1",
"prettier": "^3.4.1",
Expand Down
130 changes: 73 additions & 57 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/indent */
/* eslint-disable @/indent */
import { useEffect, useMemo } from 'react'
import { createTheme, ThemeProvider } from '@mui/material/styles'
import { SnackbarProvider } from 'notistack'
Expand Down Expand Up @@ -38,11 +38,16 @@ export default function App() {
const reloadTheme = useStore((state) => state.ui.reloadTheme)

const theme = useMemo(
() => createTheme({
...ledfxThemes[window.localStorage.getItem('ledfx-theme') ?? ledfxTheme],
() =>
createTheme({
...ledfxThemes[
window.localStorage.getItem('ledfx-theme') ?? ledfxTheme
],
...common,
palette: {
...ledfxThemes[window.localStorage.getItem('ledfx-theme') ?? ledfxTheme].palette
...ledfxThemes[
window.localStorage.getItem('ledfx-theme') ?? ledfxTheme
].palette
}
}),
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand All @@ -59,7 +64,6 @@ export default function App() {
initFrontendConfig()

console.info(
// eslint-disable-next-line no-useless-concat
'%c Ledfx ' + '%c\n ReactApp by Blade ',
'padding: 10px 40px; color: #ffffff; border-radius: 5px 5px 0 0; background-color: #800000;',
'background: #fff; color: #800000; border-radius: 0 0 5px 5px;padding: 5px 0;'
Expand Down Expand Up @@ -159,41 +163,53 @@ export default function App() {
}
} else if (proto[1] === 'song') {
const v = proto[2]
const virtual = (Object.keys(virtuals).find((virt) => virtuals[virt].id === v))
const virtual = Object.keys(virtuals).find(
(virt) => virtuals[virt].id === v
)
if (virtual && proto[3].length > 3) {
setEffect(v, 'texter2d', {
"gradient": "linear-gradient(90deg, rgb(255, 0, 0) 0%, rgb(255, 120, 0) 14%, rgb(255, 200, 0) 28%, rgb(0, 255, 0) 42%, rgb(0, 199, 140) 56%, rgb(0, 0, 255) 70%, rgb(128, 0, 128) 84%, rgb(255, 0, 178) 98%)",
"option_2": false,
"flip": false,
"blur": 0,
"flip_horizontal": false,
"speed_option_1": 2,
"resize_method": "Fast",
"gradient_roll": 0,
"alpha": false,
"value_option_1": 0.5,
"font": "Blade-5x8",
"use_gradient": false,
"diag": false,
"test": false,
"impulse_decay": 0.1,
"mirror": false,
"flip_vertical": false,
"text_effect": "Side Scroll",
"multiplier": 1,
"brightness": 1,
"text_color": "#ff0000",
"background_brightness": 1,
"rotate": 0,
"dump": false,
"option_1": false,
"height_percent": 100,
"background_color": "#000000",
"text": proto[3]
}, true, true)
setEffect(
v,
'texter2d',
{
gradient:
'linear-gradient(90deg, rgb(255, 0, 0) 0%, rgb(255, 120, 0) 14%, rgb(255, 200, 0) 28%, rgb(0, 255, 0) 42%, rgb(0, 199, 140) 56%, rgb(0, 0, 255) 70%, rgb(128, 0, 128) 84%, rgb(255, 0, 178) 98%)',
option_2: false,
flip: false,
blur: 0,
flip_horizontal: false,
speed_option_1: 2,
resize_method: 'Fast',
gradient_roll: 0,
alpha: false,
value_option_1: 0.5,
font: 'Blade-5x8',
use_gradient: false,
diag: false,
test: false,
impulse_decay: 0.1,
mirror: false,
flip_vertical: false,
text_effect: 'Side Scroll',
multiplier: 1,
brightness: 1,
text_color: '#ff0000',
background_brightness: 1,
rotate: 0,
dump: false,
option_1: false,
height_percent: 100,
background_color: '#000000',
text: proto[3]
},
true,
true
)
}
} else {
showSnackbar('info', `External call: ${protoCall.replace('ledfx://', '')}`)
showSnackbar(
'info',
`External call: ${protoCall.replace('ledfx://', '')}`
)
}
setProtoCall('')
}
Expand Down Expand Up @@ -222,27 +238,27 @@ export default function App() {
height={height}
/>
)}
{new Date().getFullYear() === 2024 &&
new Date().getMonth() === 11 &&
{new Date().getFullYear() === 2024 &&
new Date().getMonth() === 11 &&
new Date().getDate() >= 24 && (
<div
style={{
margin: 'auto',
backgroundImage: `url(${xmas})`,
backgroundSize: 'cover',
backgroundRepeat: 'no-repeat',
backgroundPosition: 'bottom',
display: 'block',
zIndex: -1,
position: 'fixed',
top: 0,
right: 0,
bottom: 0,
left: 0,
opacity: 0.7
}}
/>
)}
<div
style={{
margin: 'auto',
backgroundImage: `url(${xmas})`,
backgroundSize: 'cover',
backgroundRepeat: 'no-repeat',
backgroundPosition: 'bottom',
display: 'block',
zIndex: -1,
position: 'fixed',
top: 0,
right: 0,
bottom: 0,
left: 0,
opacity: 0.7
}}
/>
)}
{new Date().getFullYear() === 2025 &&
new Date().getMonth() === 0 &&
new Date().getDate() === 1 && (
Expand Down
60 changes: 30 additions & 30 deletions src/app/app/media.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
const { execFile } = require('child_process');
const path = require('path');
import { fileURLToPath } from 'node:url';
import { execFile } from 'child_process'
import path from 'path'
import { fileURLToPath } from 'node:url'

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

const exePath = path.join(__dirname, 'path_to_dist_folder', 'media.exe');
const exePath = path.join(__dirname, 'path_to_dist_folder', 'media.exe')

interface MediaInfo {
title: string;
artist: string;
album: string;
error?: string;
title: string
artist: string
album: string
error?: string
}

execFile(exePath, (error: Error | null, stdout: string, stderr: string) => {
if (error) {
console.error(`Error: ${error.message}`);
return;
if (error) {
console.error(`Error: ${error.message}`)
return
}
if (stderr) {
console.error(`Stderr: ${stderr}`)
return
}
try {
const mediaInfo: MediaInfo = JSON.parse(stdout)
if (mediaInfo.error) {
console.log(mediaInfo.error)
} else {
console.log(`Title: ${mediaInfo.title}`)
console.log(`Artist: ${mediaInfo.artist}`)
console.log(`Album: ${mediaInfo.album}`)
}
if (stderr) {
console.error(`Stderr: ${stderr}`);
return;
}
try {
const mediaInfo: MediaInfo = JSON.parse(stdout);
if (mediaInfo.error) {
console.log(mediaInfo.error);
} else {
console.log(`Title: ${mediaInfo.title}`);
console.log(`Artist: ${mediaInfo.artist}`);
console.log(`Album: ${mediaInfo.album}`);
}
} catch (parseError) {
console.error(`JSON Parse Error: ${(parseError as Error).message}`);
}
});
} catch (parseError) {
console.error(`JSON Parse Error: ${(parseError as Error).message}`)
}
})
Loading

0 comments on commit 7478f35

Please sign in to comment.