Skip to content

Commit

Permalink
Remove Prettier. (#269)
Browse files Browse the repository at this point in the history
I found that prettier was (still) not set up properly, and was
conflicting with some ESLint rules.
Also, all the rules we defined in Prettier were available and
autofixable in ESLint anyways, so I decided that it was more hassle than
it was worth, and removed it.
  • Loading branch information
adityaruplaha authored Mar 27, 2021
1 parent 327f1e5 commit 6940bed
Show file tree
Hide file tree
Showing 29 changed files with 209 additions and 254 deletions.
18 changes: 10 additions & 8 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
"plugin:@typescript-eslint/recommended"
],
"root": true,
"parser": "@typescript-eslint/parser",
Expand All @@ -33,15 +32,18 @@
}
},
"rules": {
"complexity": "off",
"no-trailing-spaces": "error",
"sort-keys-fix/sort-keys-fix": "error",
"typescript-sort-keys/interface": "error",
"sort-vars": "error",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-unused-vars": "error",
"complexity": "off",
"comma-dangle": ["error", "never"],
"indent": ["error", 2],
"no-trailing-spaces": "error",
"quotes": ["error", "single", { "avoidEscape": true, "allowTemplateLiterals": true }],
"sort-exports/sort-exports": ["error", { "sortDir": "asc" }],
"sort-imports-es6-autofix/sort-imports-es6": ["error", {}],
"sort-exports/sort-exports": ["error", { "sortDir": "asc" }]
"sort-keys-fix/sort-keys-fix": "error",
"sort-vars": "error",
"typescript-sort-keys/interface": "error"
}
}
4 changes: 0 additions & 4 deletions .prettierignore

This file was deleted.

6 changes: 0 additions & 6 deletions .prettierrc.json

This file was deleted.

10 changes: 5 additions & 5 deletions electron/legendary_utils/library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
heroicConfigPath,
isLoggedIn,
legendaryConfigPath,
writeDefaultconfig,
writeDefaultconfig
} from '../utils'

const statAsync = promisify(stat)
Expand All @@ -36,7 +36,7 @@ export async function getLegendaryConfig(file: string): Promise<unknown> {
.then(() => JSON.parse(readFileSync(installed, 'utf-8')))
.catch(() => []),
library: `${legendaryConfigPath}/metadata/`,
user: getUserInfo(),
user: getUserInfo()
}

if (file === 'user') {
Expand All @@ -62,7 +62,7 @@ export async function getLegendaryConfig(file: string): Promise<unknown> {
title,
developer,
dlcItemList,
customAttributes: { CloudSaveFolder, FolderName },
customAttributes: { CloudSaveFolder, FolderName }
} = metadata

const { namespace } = asset_info
Expand Down Expand Up @@ -109,7 +109,7 @@ export async function getLegendaryConfig(file: string): Promise<unknown> {
version = null,
install_size = null,
install_path = null,
is_dlc = dlc(),
is_dlc = dlc()
} = info as InstalledInfo

const convertedSize =
Expand All @@ -134,7 +134,7 @@ export async function getLegendaryConfig(file: string): Promise<unknown> {
namespace,
saveFolder,
title,
version,
version
}
})
.sort((a: { title: string }, b: { title: string }) => {
Expand Down
40 changes: 20 additions & 20 deletions electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
Tray,
app,
ipcMain,
powerSaveBlocker,
powerSaveBlocker
} from 'electron'
import { cpus, userInfo as user } from 'os'
import { exec, spawn } from 'child_process'
Expand All @@ -16,7 +16,7 @@ import {
readFileSync,
unlinkSync,
writeFile,
writeFileSync,
writeFileSync
} from 'graceful-fs'
import { promisify } from 'util'
import Backend from 'i18next-fs-backend'
Expand Down Expand Up @@ -55,7 +55,7 @@ import {
supportURL,
updateGame,
userInfo,
writeGameconfig,
writeGameconfig
} from './utils'

const execAsync = promisify(exec)
Expand All @@ -71,9 +71,9 @@ function createWindow(): BrowserWindow {
webPreferences: {
contextIsolation: false,
enableRemoteModule: true,
nodeIntegration: true,
nodeIntegration: true
},
width: isDev ? 1800 : 1280,
width: isDev ? 1800 : 1280
})

setTimeout(() => {
Expand Down Expand Up @@ -133,39 +133,39 @@ const contextMenu = () =>
click: function () {
mainWindow.show()
},
label: i18next.t('tray.show'),
label: i18next.t('tray.show')
},
{
click: function () {
showAboutWindow()
},
label: i18next.t('tray.about', 'About'),
label: i18next.t('tray.about', 'About')
},
{
click: function () {
openUrlOrFile(heroicGithubURL)
},
label: 'Github',
label: 'Github'
},
{
click: function () {
openUrlOrFile(supportURL)
},
label: i18next.t('tray.support', 'Support Us'),
label: i18next.t('tray.support', 'Support Us')
},
{
accelerator: 'ctrl + R',
click: function () {
mainWindow.reload()
},
label: i18next.t('tray.reload', 'Reload'),
label: i18next.t('tray.reload', 'Reload')
},
{
click: function () {
handleExit()
},
label: i18next.t('tray.quit', 'Quit'),
},
label: i18next.t('tray.quit', 'Quit')
}
])

if (!gotTheLock) {
Expand All @@ -184,7 +184,7 @@ if (!gotTheLock) {
backend: {
addPath: path.join(__dirname, '/locales/{{lng}}/{{ns}}'),
allowMultiLoading: false,
loadPath: path.join(__dirname, '/locales/{{lng}}/{{ns}}.json'),
loadPath: path.join(__dirname, '/locales/{{lng}}/{{ns}}.json')
},
debug: false,
fallbackLng: 'en',
Expand All @@ -199,8 +199,8 @@ if (!gotTheLock) {
'pt',
'ru',
'tr',
'hu',
],
'hu'
]
})

createWindow()
Expand All @@ -222,7 +222,7 @@ if (!gotTheLock) {
ipcMain.on('Notify', (event, args) => {
const notify = new Notification({
body: args[1],
title: args[0],
title: args[0]
})

notify.on('click', () => mainWindow.show())
Expand Down Expand Up @@ -280,12 +280,12 @@ ipcMain.on('quit', async () => handleExit())
const getProductSlug = async (namespace: string, game: string) => {
const graphql = JSON.stringify({
query: `{Catalog{catalogOffers( namespace:"${namespace}"){elements {productSlug}}}}`,
variables: {},
variables: {}
})
const result = await axios('https://www.epicgames.com/graphql', {
data: graphql,
headers: { 'Content-Type': 'application/json' },
method: 'POST',
method: 'POST'
})
const res = result.data.data.Catalog.catalogOffers
const slug = res.elements.find((e: { productSlug: string }) => e.productSlug)
Expand Down Expand Up @@ -316,15 +316,15 @@ ipcMain.handle('getGameInfo', async (event, game, namespace: string | null) => {
try {
const response = await axios({
method: 'GET',
url: epicUrl,
url: epicUrl
})
delete response.data.pages[0].data.requirements.systems[0].details[0]
const about = response.data.pages.find(
(e: { type: string }) => e.type === 'productHome'
)
return {
about: about.data.about,
reqs: about.data.requirements.systems[0].details,
reqs: about.data.requirements.systems[0].details
}
} catch (error) {
return {}
Expand Down
Loading

0 comments on commit 6940bed

Please sign in to comment.