Skip to content

Commit 0e073a0

Browse files
authored
Update eslint and add stylistic/jsx-self-closing-comp (#1607)
1 parent 4e9fdb2 commit 0e073a0

File tree

126 files changed

+915
-1056
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+915
-1056
lines changed

gui/eslint.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { FlatCompat } from '@eslint/eslintrc';
22
import eslint from '@eslint/js';
33
import globals from 'globals';
44
import tseslint from 'typescript-eslint';
5+
import stylistic from '@stylistic/eslint-plugin';
56

67
const compat = new FlatCompat();
78

@@ -41,6 +42,7 @@ export const gui = [
4142
files: ['src/**/*.{js,jsx,ts,tsx,json}'],
4243
plugins: {
4344
'@typescript-eslint': tseslint.plugin,
45+
'@stylistic': stylistic,
4446
},
4547
rules: {
4648
'react/react-in-jsx-scope': 'off',
@@ -60,6 +62,7 @@ export const gui = [
6062
ignoreRestSiblings: true,
6163
},
6264
],
65+
'@stylistic/jsx-self-closing-comp': 'error',
6366
},
6467
settings: {
6568
'import/resolver': {

gui/package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
"@dword-design/eslint-plugin-import-alias": "^4.0.9",
7373
"@openapi-codegen/cli": "^2.0.2",
7474
"@openapi-codegen/typescript": "^8.0.2",
75+
"@stylistic/eslint-plugin": "^5.5.0",
7576
"@tailwindcss/forms": "^0.5.9",
7677
"@tauri-apps/cli": "~2",
7778
"@types/file-saver": "^2.0.7",
@@ -88,12 +89,12 @@
8889
"autoprefixer": "^10.4.20",
8990
"cross-env": "^7.0.3",
9091
"dotenv": "^16.4.5",
91-
"eslint": "^8.57.1",
92+
"eslint": "^9.39.0",
9293
"eslint-config-airbnb": "^19.0.4",
93-
"eslint-import-resolver-typescript": "^3.6.3",
94-
"eslint-plugin-import": "^2.31.0",
95-
"eslint-plugin-jsx-a11y": "^6.10.0",
96-
"eslint-plugin-react": "^7.37.1",
94+
"eslint-import-resolver-typescript": "^3.10.1",
95+
"eslint-plugin-import": "^2.32.0",
96+
"eslint-plugin-jsx-a11y": "^6.10.2",
97+
"eslint-plugin-react": "^7.37.5",
9798
"eslint-plugin-react-hooks": "^4.6.2",
9899
"globals": "^15.10.0",
99100
"prettier": "^3.3.3",
@@ -102,7 +103,7 @@
102103
"spdx-satisfies": "^5.0.1",
103104
"tailwind-gradient-mask-image": "^1.2.0",
104105
"tailwindcss": "^3.4.13",
105-
"typescript-eslint": "^8.8.0",
106+
"typescript-eslint": "^8.46.2",
106107
"vite": "^5.4.8"
107108
}
108109
}

gui/src/App.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ function Layout() {
7575

7676
return (
7777
<>
78-
<SerialDetectionModal></SerialDetectionModal>
79-
<VersionUpdateModal></VersionUpdateModal>
80-
<UnknownDeviceModal></UnknownDeviceModal>
78+
<SerialDetectionModal />
79+
<VersionUpdateModal />
80+
<UnknownDeviceModal />
8181
<SentryRoutes>
8282
<Route element={<AppLayout />}>
8383
<Route
@@ -158,7 +158,7 @@ function Layout() {
158158
/>
159159
<Route path="trackers-assign" element={<TrackersAssignPage />} />
160160
<Route path="enter-vr" element={<EnterVRPage />} />
161-
<Route path="mounting/choose" element={<MountingChoose />}></Route>
161+
<Route path="mounting/choose" element={<MountingChoose />} />
162162
<Route path="mounting/auto" element={<AutomaticMountingPage />} />
163163
<Route path="mounting/manual" element={<ManualMountingPage />} />
164164
<Route path="reset-tutorial" element={<ResetTutorialPage />} />
@@ -177,7 +177,7 @@ function Layout() {
177177
<Route path="stay-aligned" element={<StayAlignedSetup />} />
178178
<Route path="done" element={<DonePage />} />
179179
</Route>
180-
<Route path="*" element={<TopBar></TopBar>}></Route>
180+
<Route path="*" element={<TopBar />} />
181181
</Route>
182182
</SentryRoutes>
183183
</>
@@ -301,10 +301,8 @@ export default function App() {
301301
<VersionContext.Provider value={updateFound}>
302302
<div className="h-full w-full text-standard bg-background-80 text-background-10">
303303
<Preload />
304-
{!websocketAPI.isConnected && (
305-
<ConnectionLost></ConnectionLost>
306-
)}
307-
{websocketAPI.isConnected && <Layout></Layout>}
304+
{!websocketAPI.isConnected && <ConnectionLost />}
305+
{websocketAPI.isConnected && <Layout />}
308306
</div>
309307
</VersionContext.Provider>
310308
</StatusProvider>

gui/src/components/BVHButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export function BVHButton(props: React.HTMLAttributes<HTMLButtonElement>) {
6464
'border',
6565
recording ? 'border-status-critical' : 'border-transparent'
6666
)}
67-
></BigButton>
67+
/>
6868
</Localized>
6969
);
7070
}

gui/src/components/EmptyLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export function EmptyLayout({ children }: { children: ReactNode }) {
66
return (
77
<div className="empty-layout h-full">
88
<div style={{ gridArea: 't' }}>
9-
<TopBar></TopBar>
9+
<TopBar />
1010
</div>
1111
<div style={{ gridArea: 'c' }} className="mt-2 relative">
1212
{children}

gui/src/components/ErrorConsentModal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ export function ErrorConsentModal({
3535
<Localized
3636
id={'error_collection_modal-description_v2'}
3737
elems={{
38-
b: <b></b>,
39-
h1: <span className="text-lg font-bold"></span>,
38+
b: <b />,
39+
h1: <span className="text-lg font-bold" />,
4040
}}
4141
>
4242
<Typography

gui/src/components/MainLayout.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ export function MainLayout({
6161
<div className="">
6262
<div className="main-layout w-full h-screen">
6363
<div style={{ gridArea: 't' }}>
64-
<TopBar></TopBar>
64+
<TopBar />
6565
</div>
6666
<div style={{ gridArea: 's' }} className="overflow-y-auto">
67-
<Navbar></Navbar>
67+
<Navbar />
6868
</div>
6969
<div
7070
style={{ gridArea: 'c' }}
@@ -81,7 +81,7 @@ export function MainLayout({
8181
style={{ gridArea: 'w' }}
8282
className="overflow-y-auto mr-2 my-2 rounded-xl bg-background-70 flex flex-col gap-2 p-2 widgets"
8383
>
84-
<WidgetsComponent></WidgetsComponent>
84+
<WidgetsComponent />
8585
</div>
8686
)}
8787
</div>

gui/src/components/Navbar.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,34 +70,34 @@ export function MainLinks() {
7070

7171
return (
7272
<>
73-
<NavButton to="/" icon={<CubeIcon></CubeIcon>}>
73+
<NavButton to="/" icon={<CubeIcon />}>
7474
{l10n.getString('navbar-home')}
7575
</NavButton>
7676
<NavButton
7777
to="/onboarding/trackers-assign"
7878
state={{ alonePage: true }}
79-
icon={<HumanIcon></HumanIcon>}
79+
icon={<HumanIcon />}
8080
>
8181
{l10n.getString('navbar-trackers_assign')}
8282
</NavButton>
8383
<NavButton
8484
to="/onboarding/mounting/choose"
8585
match="/onboarding/mounting/*"
8686
state={{ alonePage: true }}
87-
icon={<WrenchIcon></WrenchIcon>}
87+
icon={<WrenchIcon />}
8888
>
8989
{l10n.getString('navbar-mounting')}
9090
</NavButton>
9191
<NavButton
9292
to="/onboarding/body-proportions/scaled"
9393
match="/onboarding/body-proportions/*"
9494
state={{ alonePage: true }}
95-
icon={<RulerIcon></RulerIcon>}
95+
icon={<RulerIcon />}
9696
>
9797
{l10n.getString('navbar-body_proportions')}
9898
</NavButton>
9999
{config?.showNavbarOnboarding && (
100-
<NavButton to="/onboarding/home" icon={<SparkleIcon></SparkleIcon>}>
100+
<NavButton to="/onboarding/home" icon={<SparkleIcon />}>
101101
{l10n.getString('navbar-onboarding')}
102102
</NavButton>
103103
)}
@@ -111,18 +111,18 @@ export function Navbar() {
111111

112112
return isMobile ? (
113113
<div className="flex flex-row justify-around px-2 pt-2 bg-background-80 gap-2">
114-
<MainLinks></MainLinks>
114+
<MainLinks />
115115
</div>
116116
) : (
117117
<div className="flex flex-col h-full p-2 gap-2">
118118
<div className="flex flex-col flex-grow gap-2">
119-
<MainLinks></MainLinks>
119+
<MainLinks />
120120
</div>
121121
<NavButton
122122
to="/settings/trackers"
123123
match="/settings/*"
124124
state={{ scrollTo: 'steamvr' }}
125-
icon={<GearIcon></GearIcon>}
125+
icon={<GearIcon />}
126126
>
127127
{l10n.getString('navbar-settings')}
128128
</NavButton>

gui/src/components/SerialDetectionModal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export function SerialDetectionModal() {
6969
{!showWifiForm && (
7070
<>
7171
<div className="flex flex-col items-center gap-3 fill-accent-background-20">
72-
<USBIcon></USBIcon>
72+
<USBIcon />
7373
<div className="flex flex-col items-center gap-2">
7474
<Typography variant="main-title">
7575
{l10n.getString('serial_detection-new_device-p0')}
@@ -101,7 +101,7 @@ export function SerialDetectionModal() {
101101
>
102102
<div className="flex flex-col items-center gap-3">
103103
<div className="fill-background-10">
104-
<BulbIcon></BulbIcon>
104+
<BulbIcon />
105105
</div>
106106
<Typography variant="main-title">
107107
{l10n.getString('serial_detection-new_device-p0')}

gui/src/components/TopBar.tsx

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export function TopBar({
155155
return (
156156
<>
157157
<div className="flex gap-0 flex-col">
158-
<div className="h-[3px]"></div>
158+
<div className="h-[3px]" />
159159
<div data-tauri-drag-region className="flex gap-2 h-[38px] z-50">
160160
<div
161161
className="flex px-2 py-2 justify-around z-50"
@@ -168,7 +168,7 @@ export function TopBar({
168168
className="flex justify-around flex-col select-all"
169169
data-tauri-drag-region
170170
>
171-
<SlimeVRIcon></SlimeVRIcon>
171+
<SlimeVRIcon />
172172
</NavLink>
173173
)}
174174
{(isTauri || !isMobile) && !config?.decorations && (
@@ -181,7 +181,7 @@ export function TopBar({
181181
)}
182182
{(!(isMobile && !config?.decorations) || showVersionMobile) && (
183183
<>
184-
<VersionTag></VersionTag>
184+
<VersionTag />
185185
{doesMatchSettings && (
186186
<div
187187
className={classNames(
@@ -206,7 +206,7 @@ export function TopBar({
206206
openUrl(url).catch(() => window.open(url, '_blank'));
207207
}}
208208
>
209-
<DownloadIcon></DownloadIcon>
209+
<DownloadIcon />
210210
</div>
211211
)}
212212
</div>
@@ -222,11 +222,7 @@ export function TopBar({
222222
data-tauri-drag-region
223223
>
224224
{progress !== undefined && (
225-
<ProgressBar
226-
progress={progress}
227-
height={3}
228-
parts={3}
229-
></ProgressBar>
225+
<ProgressBar progress={progress} height={3} parts={3} />
230226
)}
231227
</div>
232228
</>
@@ -256,7 +252,7 @@ export function TopBar({
256252
data-tauri-drag-region
257253
state={{ scrollTo: 'steamvr' }}
258254
>
259-
<GearIcon></GearIcon>
255+
<GearIcon />
260256
</NavLink>
261257

262258
{!isMobile && (
@@ -271,7 +267,7 @@ export function TopBar({
271267
)
272268
}
273269
>
274-
<QuestionIcon></QuestionIcon>
270+
<QuestionIcon />
275271
</div>
276272
)}
277273

@@ -281,27 +277,27 @@ export function TopBar({
281277
className="flex items-center justify-center hover:bg-background-60 rounded-full w-7 h-7"
282278
onClick={() => getCurrentWindow().minimize()}
283279
>
284-
<MinimiseIcon></MinimiseIcon>
280+
<MinimiseIcon />
285281
</div>
286282
<div
287283
className="flex items-center justify-center hover:bg-background-60 rounded-full w-7 h-7"
288284
onClick={() => getCurrentWindow().toggleMaximize()}
289285
>
290-
<MaximiseIcon></MaximiseIcon>
286+
<MaximiseIcon />
291287
</div>
292288
<div
293289
className="flex items-center justify-center hover:bg-background-60 rounded-full w-7 h-7"
294290
onClick={() => tryCloseApp()}
295291
>
296-
<CloseIcon></CloseIcon>
292+
<CloseIcon />
297293
</div>
298294
</>
299295
)}
300296
</div>
301297
</div>
302298
{isMobile && progress !== undefined && (
303299
<div className="flex gap-2 px-2 h-6 mb-2 justify-center flex-col border-b border-accent-background-30">
304-
<ProgressBar progress={progress} height={3} parts={3}></ProgressBar>
300+
<ProgressBar progress={progress} height={3} parts={3} />
305301
</div>
306302
)}
307303
</div>
@@ -335,7 +331,7 @@ export function TopBar({
335331
setConnectedTrackerWarning(false);
336332
getCurrentWindow().requestUserAttention(null);
337333
}}
338-
></TrackersStillOnModal>
334+
/>
339335
<ErrorConsentModal
340336
isOpen={config?.errorTracking === null}
341337
accept={() => setConfig({ errorTracking: true })}

0 commit comments

Comments
 (0)