Skip to content

Commit

Permalink
fix: improve lint
Browse files Browse the repository at this point in the history
  • Loading branch information
leaftail1880 committed Aug 27, 2024
1 parent 10b57bc commit 7a03350
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 23 deletions.
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default ts.config(
'@typescript-eslint/no-unsafe-enum-comparison': 'off',
'@typescript-eslint/no-misused-promises': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/class-literal-property-style': 'off',
'@typescript-eslint/naming-convention': [
'warn',
{
Expand Down
3 changes: 1 addition & 2 deletions src/lib/database/properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ if (!__VITEST__)

tables: DynamicPropertyDB.tables,
getRawTableData(tableId) {
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
return world.getDynamicProperty(tableId) + ''
return `${world.getDynamicProperty(tableId)}`
},
})
17 changes: 13 additions & 4 deletions src/lib/extensions/enviroment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,9 @@ expand(console, {
globalThis.verbose = false

Object.entriesStringKeys(MinecraftEntityTypes).forEach(([k, v]) => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
if (v.includes(':')) return

// @ts-expect-error We force add prefix because WHY IT DOES NOT HAVE ONE
MinecraftEntityTypes[k] = 'minecraft:' + v
})

Expand All @@ -195,7 +196,13 @@ declare global {
*/
format(seconds?: boolean): string

/** Converts date to format DD-MM-YYYY */
/**
* Converts date to format DD-MM-YYYY
*
* @example
* const date = new Date()
* date.toYYYYMMDD() 2024-12-04
*/
toYYYYMMDD(): string

/**
Expand All @@ -216,7 +223,9 @@ Date.prototype.toYYYYMMDD = function () {
Date.prototype.toHHMM = function () {
const date = new Date(this)
date.setHours(date.getHours() + 3)
return date.getHours().toString().padStart(2, '0') + ':' + date.getMinutes().toString().padStart(2, '0')
const hours = date.getHours().toString().padStart(2, '0')
const minutes = date.getMinutes().toString().padStart(2, '0')
return hours + ':' + minutes
}

Date.prototype.format = function () {
Expand Down
19 changes: 5 additions & 14 deletions src/lib/rpg/loot-table.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Container, EnchantmentType, ItemLockMode, ItemStack, system } from '@minecraft/server'
import { MinecraftEnchantmentTypes, MinecraftItemTypes } from '@minecraft/vanilla-data'
import { MinecraftEnchantmentTypes, MinecraftItemTypes, MinecraftItemTypesUnion } from '@minecraft/vanilla-data'
import { Command } from 'lib/command'
import { EventSignal } from 'lib/event-signal'
import { inspect, isKeyof } from 'lib/util'
Expand Down Expand Up @@ -66,23 +66,14 @@ export class Loot {
*
* @param type Keyof MinecraftItemTypes
*/
item(type: Exclude<keyof typeof MinecraftItemTypes, 'prototype' | 'string'>): this
item(type: MinecraftItemTypesUnion): this

/**
* Creates new item entry
* Creates new item entry from string type id
*
* @param type Type of the item
* @param type String type id
*/
// eslint-disable-next-line @typescript-eslint/unified-signatures
item(type: string): this

/**
* Creates new item entry
*
* @param type Type of the item
*/
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
item(type: string | Exclude<keyof typeof MinecraftItemTypes, 'prototype' | 'string'>) {
item(type: string) {
if (isKeyof(type, MinecraftItemTypes)) type = MinecraftItemTypes[type]
this.create(new ItemStack(type))

Expand Down
1 change: 0 additions & 1 deletion src/lib/shop/cost/cost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export abstract class Cost<T = unknown> {
return CostType.Action
}

// eslint-disable-next-line @typescript-eslint/class-literal-property-style
get multiline(): boolean {
return false
}
Expand Down
1 change: 0 additions & 1 deletion src/modules/places/minearea/minearea-region.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export class MineareaRegion extends RegionWithStructure {
return true
}

// eslint-disable-next-line @typescript-eslint/class-literal-property-style
get displayName() {
return '§7Зона добычи'
}
Expand Down
1 change: 0 additions & 1 deletion src/modules/places/mineshaft/mineshaft-region.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export class MineshaftRegion extends MineareaRegion {
return true
}

// eslint-disable-next-line @typescript-eslint/class-literal-property-style
get displayName() {
return '§7Шахта'
}
Expand Down

0 comments on commit 7a03350

Please sign in to comment.