Skip to content

Commit 0f79f59

Browse files
committed
Update dependencies, eslint.
1 parent 3aacc4b commit 0f79f59

File tree

11 files changed

+836
-714
lines changed

11 files changed

+836
-714
lines changed

.eslintignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

.eslintrc.cjs

Lines changed: 0 additions & 59 deletions
This file was deleted.

eslint.config.cjs

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// @ts-check
2+
3+
const eslint = require('@eslint/js');
4+
const tseslint = require('typescript-eslint');
5+
const stylisticTs = require('@stylistic/eslint-plugin-ts');
6+
const { join } = require('path');
7+
8+
module.exports = tseslint.config(
9+
{
10+
ignores: ['**/dist/**', 'node_modules', 'eslint.config.cjs'],
11+
},
12+
eslint.configs.recommended,
13+
...tseslint.configs.recommendedTypeChecked,
14+
...tseslint.configs.stylisticTypeChecked,
15+
{
16+
files: ['**/*.{ts,mts,cts,tsx}'],
17+
plugins: {
18+
// @ts-ignore
19+
'@stylistic/ts': stylisticTs,
20+
'@typescript-eslint': tseslint.plugin,
21+
},
22+
languageOptions: {
23+
parser: tseslint.parser,
24+
parserOptions: {
25+
project: [
26+
join(__dirname, 'tsconfig.json'),
27+
join(__dirname, 'tsconfig.test.json')
28+
]
29+
},
30+
},
31+
rules: {
32+
'@stylistic/ts/semi': ['error', 'never'],
33+
'@stylistic/ts/quotes': ['error', 'single'],
34+
'@stylistic/ts/indent': ['error', 4],
35+
'@stylistic/ts/member-delimiter-style': ['error', {
36+
multiline: {
37+
delimiter: 'none',
38+
requireLast: false
39+
},
40+
singleline: {
41+
delimiter: 'comma',
42+
requireLast: false
43+
}
44+
}],
45+
'@typescript-eslint/consistent-indexed-object-style': 'off', // Don't need to enforce types be Record
46+
'@typescript-eslint/explicit-function-return-type': ['warn'], // Warn if no return type is set
47+
'@typescript-eslint/no-unsafe-call': 'off', // There are instances where internal types are ambigious but it doesnt matter
48+
'@typescript-eslint/no-unsafe-member-access': 'off', // Method calls, above reason
49+
'@typescript-eslint/no-unused-vars': ['error', { // Allow unused caught errors
50+
'caughtErrors': 'none'
51+
}],
52+
'@typescript-eslint/prefer-nullish-coalescing': 'off', // Logical OR is fine depending on the circumstance
53+
'@typescript-eslint/prefer-promise-reject-errors': 'off', // We reject with errors passed through event listeners that are untyped
54+
'@typescript-eslint/require-await': 'off', // This is literally broken
55+
'@typescript-eslint/restrict-template-expressions': 'off' // We make use of template expressions on objects
56+
}
57+
},
58+
{
59+
files: ['test/**/*.ts'],
60+
rules: {
61+
'@typescript-eslint/no-unused-expressions': 'off' // Chai uses these
62+
}
63+
}
64+
);

lib/dl/distribution/DistributionIndexProcessor.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ export class DistributionIndexProcessor extends IndexProcessor {
6868
}
6969
}
7070

71-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
7271
public async loadModLoaderVersionJson(): Promise<VersionJsonBase> {
7372

7473
const server: HeliosServer = this.distribution.getServerById(this.serverId)!

lib/java/JavaGuard.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,8 @@ export function rankApplicableJvms(details: JvmDetails[]): void {
433433
if(a.semver.patch === b.semver.patch){
434434

435435
// Same version, give priority to JRE.
436-
if(a.path.toLowerCase().indexOf('jdk') > -1){
437-
return b.path.toLowerCase().indexOf('jdk') > -1 ? 0 : 1
436+
if(a.path.toLowerCase().includes('jdk')){
437+
return b.path.toLowerCase().includes('jdk') ? 0 : 1
438438
} else {
439439
return -1
440440
}
@@ -626,7 +626,7 @@ export async function extractJdk(archivePath: string): Promise<string> {
626626
// Get the first
627627
if(javaExecPath == null) {
628628
let h = header.name
629-
if(h.indexOf('/') > -1){
629+
if(h.includes('/')){
630630
h = h.substring(0, h.indexOf('/'))
631631
}
632632
javaExecPath = javaExecFromRoot(join(dirname(archivePath), h))

lib/microsoft/rest/MicrosoftResponse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export function decipherErrorCode(body: any): MicrosoftErrorCode {
6868
if(body) {
6969
if(body.XErr) {
7070
const xErr: number = body.XErr as number
71-
switch(xErr) {
71+
switch(xErr as MicrosoftErrorCode) {
7272
case MicrosoftErrorCode.NO_XBOX_ACCOUNT:
7373
return MicrosoftErrorCode.NO_XBOX_ACCOUNT
7474
case MicrosoftErrorCode.XBL_BANNED:

lib/mojang/net/ServerStatusAPI.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-control-regex */
21
import { SrvRecord } from 'dns'
32
import { resolveSrv } from 'dns/promises'
43
import { connect } from 'net'

lib/mojang/rest/MojangRestAPI.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export class MojangRestAPI {
145145
* to our project which represents an unknown status.
146146
*/
147147
public static statusToHex(status: string): string {
148-
switch(status.toLowerCase()){
148+
switch(status.toLowerCase() as MojangStatusColor){
149149
case MojangStatusColor.GREEN:
150150
return '#a5c325'
151151
case MojangStatusColor.YELLOW:

0 commit comments

Comments
 (0)