Skip to content

Commit

Permalink
fix: eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
SpikeHD committed Oct 25, 2024
1 parent 15d0997 commit 26cc2bb
Show file tree
Hide file tree
Showing 11 changed files with 81 additions and 82 deletions.
34 changes: 0 additions & 34 deletions .eslintrc.json

This file was deleted.

6 changes: 3 additions & 3 deletions components/KeybindInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function KeybindInput(props: Props) {
const [keysPressed, setKeysPressed] = createSignal<KeyStruct[]>([])

onCleanup(() => {
window.removeEventListener('keydown', keyDown),
window.removeEventListener('keydown', keyDown)
window.removeEventListener('keyup', keyUp)
})

Expand Down Expand Up @@ -85,7 +85,7 @@ export function KeybindInput(props: Props) {
const setRecordingState = () => {
if (recording()) {
// Remove all event listeners
window.removeEventListener('keydown', keyDown),
window.removeEventListener('keydown', keyDown)
window.removeEventListener('keyup', keyUp)

// Set the keybind
Expand All @@ -100,7 +100,7 @@ export function KeybindInput(props: Props) {
setKeybind([])

// Create event listeners to set the keybind based on what is being held down
window.addEventListener('keydown', keyDown),
window.addEventListener('keydown', keyDown)
window.addEventListener('keyup', keyUp)

setRecording(true)
Expand Down
42 changes: 42 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [
...compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended"),
{
plugins: {
"@typescript-eslint": typescriptEslint,
},

languageOptions: {
globals: {
...globals.browser,
},

parser: tsParser,
ecmaVersion: "latest",
sourceType: "module",
},

rules: {
indent: ["error", 2],
quotes: ["error", "single"],
semi: ["error", "never"],
"react/react-in-jsx-scope": "off",
"@typescript-eslint/no-explicit-any": "off",
},
},
];
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"devDependencies": {
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.13.0",
"@tauri-apps/api": "^1.6.0",
"@uwu/lune": "^1.4.2",
"@uwu/shelter-defs": "^1.4.1",
"globals": "^15.11.0",
"typescript": "^5.5.4"
},
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions plugins/dorion-settings/components/ClientModList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ let injectedCss = false
const getClientMods = async (): Promise<string> => {
try {
return await invoke('available_mods')
// eslint-disable-next-line
} catch (e) {
// function doesn't exist, version is too old
}
Expand Down
5 changes: 5 additions & 0 deletions plugins/dorion-settings/pages/PerformancePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,20 @@ export function PerformancePage() {
try {
const availableBlurs = await invoke('available_blurs')
setBlurOptions(availableBlurs)

// eslint-disable-next-line
} catch(e) { /* this can fail it's fine */ }

try {
const platform = await invoke('get_platform')
setPlatform(platform)

// eslint-disable-next-line
} catch(e) { /* this can fail it's fine */ }

try {
setState(JSON.parse(settings))
// eslint-disable-next-line
} catch (e) {
setState(JSON.parse(defaultConf))
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/dorion-settings/pages/SettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function SettingsPage() {
// If a restart is now required, set that
if (requiresRestart) {
setRestartRequired(true)
backendRestartRequired
backendRestartRequired(true)
}
}

Expand Down
1 change: 1 addition & 0 deletions plugins/invisible-typing/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const {
observeDom
} = shelter

// eslint-disable-next-line
false && tooltip

let injectedCss = false
Expand Down
2 changes: 2 additions & 0 deletions plugins/plugin-browser/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ export async function getPluginsLocation(site: string, plugins: string[]) {
workingPath = path
break
}

// eslint-disable-next-line
} catch (e) {
// If we get an error, its probably because the file doesn't exist
// So we can just ignore it
Expand Down
10 changes: 6 additions & 4 deletions plugins/shelteRPC/components/GameCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ let injectedCss = false

const deleteGame = (name: string) => {
// Remove from local detectables
backend !== 'None' && event.emit('remove_detectable', {
name,
exe: ''
})
if (backend !== 'None') {
event.emit('remove_detectable', {
name,
exe: ''
})
}

// Also remove from the plugin store
const key = Object.keys(store.previouslyPlayed).find(k => store.previouslyPlayed[k].name === name)
Expand Down
Loading

0 comments on commit 26cc2bb

Please sign in to comment.