mirror of
https://github.com/Kvan7/Exiled-Exchange-2.git
synced 2026-09-27 15:15:48 +00:00
lint WIP
This commit is contained in:
+2
-1
@@ -18,6 +18,7 @@ module.exports = {
|
||||
'@typescript-eslint/no-unused-vars': ['error'],
|
||||
// 'spaced-comment': ['error', 'always', { markers: ['#region'], exceptions: ['#endregion'] }],
|
||||
'quote-props': ['error', 'consistent-as-needed'],
|
||||
'@typescript-eslint/strict-boolean-expressions': 'off',
|
||||
// '@typescript-eslint/no-use-before-define': 'off',
|
||||
// 'vue/no-mutating-props': 'off',
|
||||
// '@typescript-eslint/member-delimiter-style': 'off',
|
||||
@@ -27,7 +28,7 @@ module.exports = {
|
||||
// 'vue/no-deprecated-filter': 'off',
|
||||
// 'vue/no-deprecated-slot-attribute': 'off',
|
||||
// 'no-unused-vars': 'off',
|
||||
// '@typescript-eslint/no-non-null-assertion': 'off'
|
||||
'@typescript-eslint/no-non-null-assertion': 'off'
|
||||
},
|
||||
parserOptions: {
|
||||
parser: '@typescript-eslint/parser',
|
||||
|
||||
@@ -88,7 +88,7 @@ export default defineComponent({
|
||||
const mapStats = computed(() => {
|
||||
return prepareMapStats(item.value!)
|
||||
})
|
||||
const image = computed (() => {
|
||||
const image = computed(() => {
|
||||
if (!item.value) return undefined
|
||||
|
||||
const entry = mapName.value && MAP_IMGS.get(mapName.value)
|
||||
|
||||
@@ -50,6 +50,6 @@ export default defineComponent({
|
||||
return {
|
||||
result
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -30,7 +30,7 @@ export default defineComponent({
|
||||
required: true
|
||||
}
|
||||
},
|
||||
setup (props, ctx) {
|
||||
setup (props) {
|
||||
const { t } = useI18n()
|
||||
|
||||
const label = computed(() => {
|
||||
|
||||
@@ -6,7 +6,7 @@ import { StatFilter } from './interfaces'
|
||||
import { getRollAsSingleNumber } from '@/parser/utils'
|
||||
import { Config } from '@/web/Config'
|
||||
|
||||
function isConstantMod (mod: UniqueItem['stats'][0]) {
|
||||
function isConstantMod (mod: UniqueItem['stats'][0]): boolean {
|
||||
return mod.bounds.every(b => b.min === b.max)
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ export function uniqueModFilterPartial (
|
||||
mod: ItemModifier,
|
||||
filter: Writeable<StatFilter>
|
||||
): void {
|
||||
const uniqueInfo = UNIQUES.get(`${item.name} ${item.baseType}`)
|
||||
const uniqueInfo = UNIQUES.get(`${item.name} ${item.baseType!}`)
|
||||
if (!uniqueInfo) return fallbackToExact(mod, filter)
|
||||
|
||||
const modInfo = uniqueInfo.stats.find(stat =>
|
||||
@@ -63,7 +63,7 @@ export function uniqueModFilterPartial (
|
||||
}
|
||||
}
|
||||
|
||||
function fallbackToExact (mod: ItemModifier, filter: Writeable<StatFilter>) {
|
||||
function fallbackToExact (mod: ItemModifier, filter: Writeable<StatFilter>): void {
|
||||
if (mod.values) {
|
||||
filter.roll = getRollAsSingleNumber(mod.values)
|
||||
filter.defaultMin = filter.roll
|
||||
|
||||
@@ -2,14 +2,14 @@ import { StatFilter } from './interfaces'
|
||||
import { rollCountDecimals } from '@/parser/utils'
|
||||
import { Config } from '@/web/Config'
|
||||
|
||||
function percentRoll (value: number, p: number, method: Math['floor'] | Math['ceil'], decimals?: number) {
|
||||
function percentRoll (value: number, p: number, method: Math['floor'] | Math['ceil'], decimals?: number): number {
|
||||
const res = value + value * p / 100
|
||||
|
||||
const rounding = Math.pow(10, decimals != null ? decimals : rollCountDecimals(value))
|
||||
return method((res + Number.EPSILON) * rounding) / rounding
|
||||
}
|
||||
|
||||
export function percentRollDelta (value: number, delta: number, p: number, method: Math['floor'] | Math['ceil']) {
|
||||
export function percentRollDelta (value: number, delta: number, p: number, method: Math['floor'] | Math['ceil']): number {
|
||||
const res = value + delta * p / 100
|
||||
|
||||
const rounding = Math.pow(10, rollCountDecimals(value))
|
||||
@@ -18,10 +18,8 @@ export function percentRollDelta (value: number, delta: number, p: number, metho
|
||||
|
||||
export function rollToFilter (
|
||||
roll: number,
|
||||
opts?: {
|
||||
neverNegated?: true
|
||||
decimals?: number
|
||||
}): Pick<StatFilter, 'roll' | 'min' | 'max' | 'defaultMin' | 'defaultMax'> {
|
||||
opts?: { neverNegated?: true, decimals?: number }
|
||||
): Pick<StatFilter, 'roll' | 'min' | 'max' | 'defaultMin' | 'defaultMax'> {
|
||||
const percent = Config.store.searchStatRange
|
||||
|
||||
// opts.neverNegated is false only in one case, but keep it
|
||||
|
||||
@@ -55,7 +55,7 @@ export async function requestPoeprices (item: ParsedItem): Promise<RareItemPrice
|
||||
}
|
||||
}
|
||||
|
||||
export function getExternalLink (item: ParsedItem) {
|
||||
export function getExternalLink (item: ParsedItem): string {
|
||||
const query = stringify({
|
||||
i: Buffer.from(item.rawText).toString('base64'),
|
||||
l: league.value,
|
||||
@@ -69,7 +69,7 @@ export async function sendFeedback (
|
||||
feedback: { text: string, option: 'fair' | 'low' | 'high' },
|
||||
prediction: { min: number, max: number, currency: 'chaos' | 'exalt' },
|
||||
item: ParsedItem
|
||||
) {
|
||||
): Promise<void> {
|
||||
const body = new FormData()
|
||||
body.append('selector', feedback.option)
|
||||
body.append('feedbacktxt', feedback.text)
|
||||
|
||||
@@ -24,7 +24,7 @@ export interface SearchResult {
|
||||
}
|
||||
|
||||
export function apiToSatisfySearch (item: ParsedItem, stats: StatFilter[]): 'trade' | 'bulk' {
|
||||
if (stats.some(s => s.disabled === false)) {
|
||||
if (stats.some(s => !s.disabled)) {
|
||||
return 'trade'
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ const ENDPOINT_BY_LANG = {
|
||||
ru: 'ru.pathofexile.com'
|
||||
}
|
||||
|
||||
export function getTradeEndpoint () {
|
||||
export function getTradeEndpoint (): string {
|
||||
return ENDPOINT_BY_LANG[Config.store.language]
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ export const RATE_LIMIT_RULES = {
|
||||
]
|
||||
}
|
||||
|
||||
export function adjustRateLimits (clientLimits: RateLimiter[], headers: Headers) {
|
||||
export function adjustRateLimits (clientLimits: RateLimiter[], headers: Headers): RateLimiter[] {
|
||||
if (!headers.has('x-rate-limit-rules')) return clientLimits
|
||||
|
||||
const rules = headers.get('x-rate-limit-rules')!.split(',')
|
||||
@@ -83,7 +83,7 @@ export function adjustRateLimits (clientLimits: RateLimiter[], headers: Headers)
|
||||
)
|
||||
}
|
||||
|
||||
function _adjustRateLimits (clientLimits: RateLimiter[], limitStr: string, stateStr: string) { /* eslint-disable no-console */
|
||||
function _adjustRateLimits (clientLimits: RateLimiter[], limitStr: string, stateStr: string): RateLimiter[] { /* eslint-disable no-console */
|
||||
const DEBUG = false
|
||||
const DESYNC_FIX = 0
|
||||
|
||||
@@ -137,6 +137,7 @@ function _adjustRateLimits (clientLimits: RateLimiter[], limitStr: string, state
|
||||
DEBUG && console.log('Add', rl.toString())
|
||||
|
||||
Array(serverLimit.state).fill(undefined).forEach(() => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
rl.wait()
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user