reenable eslint

This commit is contained in:
Alexander Drozdov
2021-02-19 17:33:31 +02:00
parent 997aa94e0b
commit 2ecddf9890
35 changed files with 136 additions and 127 deletions
+27 -16
View File
@@ -4,8 +4,8 @@ module.exports = {
node: true
},
plugins: [
'@typescript-eslint',
'only-warn'
'@typescript-eslint'
// 'only-warn'
],
extends: [
'plugin:vue/base',
@@ -14,25 +14,36 @@ module.exports = {
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'quote-props': ['error', 'consistent-as-needed'],
'no-labels': ['error', { allowLoop: true }],
'multiline-ternary': 'off',
'no-unused-vars': 'off',
'@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',
// '@typescript-eslint/camelcase': 'off',
// '@typescript-eslint/no-inferrable-types': 'off',
// 'vue/no-deprecated-v-on-native-modifier': 'off',
// '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',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/prefer-nullish-coalescing': 'off',
'@typescript-eslint/prefer-optional-chain': 'off',
'@typescript-eslint/prefer-readonly': 'off',
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-misused-promises': 'off',
// TODO: refactor IPC and enable
'@typescript-eslint/consistent-type-assertions': 'off'
},
overrides: [{
files: ['src/main/**/*'],
env: {
node: true
}
}, {
files: ['*.ts'],
parserOptions: {
project: './tsconfig.json'
}
}],
parserOptions: {
parser: '@typescript-eslint/parser',
extraFileExtensions: ['.vue'],
project: './tsconfig.json'
extraFileExtensions: ['.vue']
}
}
+3 -1
View File
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-var-requires */
import type { TranslationDict } from '@/assets/data/en/client_strings'
import type { ClientLogDict } from '@/assets/data/en/client_log'
import type { BaseType, DropEntry, Stat, StatMatcher, UniqueItem } from './interfaces'
@@ -28,7 +30,7 @@ export let MAP_IMGS: Map<string, { img: string }>
export const ITEM_DROP = new Map<string, DropEntry>()
;(async function initData () { /* eslint-disable no-lone-blocks */
;(function initData () { /* eslint-disable no-lone-blocks */
{
CLIENT_STRINGS = (require(`./${Config.store.language}/client_strings`).default)
CLIENTLOG_STRINGS = (require(`./${Config.store.language}/client_log`).default)
+1 -1
View File
@@ -47,7 +47,7 @@ interface Widget {
wmTitle: string
wmWants: 'show' | 'hide'
wmZorder: number | 'exclusive' | null
wmFlags: (WidgetWellKnownFlag | string)[]
wmFlags: Array<WidgetWellKnownFlag | string>
// ---------------
[key: string]: any
}
+1
View File
@@ -11,6 +11,7 @@ const COMMON_PATH = [
'D:/Program Files (x86)/Steam/steamapps/common/Path of Exile/logs/Client.txt'
]
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
export class LogWatcher {
static offset = 0
static filePath?: string
+2 -2
View File
@@ -1,11 +1,11 @@
import { Rectangle, BrowserWindow, Point } from 'electron'
import type { Rectangle, BrowserWindow } from 'electron'
import { EventEmitter } from 'events'
import { logger } from './logger'
import { config } from './config'
import { overlayWindow as OW, AttachEvent } from 'electron-overlay-window'
interface PoeWindowClass {
on(event: 'active-change', listener: (isActive: boolean) => void): this
on: (event: 'active-change', listener: (isActive: boolean) => void) => this
}
class PoeWindowClass extends EventEmitter {
private _isActive: boolean = false
+1 -1
View File
@@ -13,7 +13,7 @@ export async function pollClipboard (): Promise<string> {
isPollingClipboard = true
elapsed = 0
if (clipboardPromise) {
return clipboardPromise
return await clipboardPromise
}
let textBefore = clipboard.readText()
+1 -1
View File
@@ -28,7 +28,7 @@ export function showWidget (opts: {
const poeBounds = PoeWindow.bounds!
activeAreaRect = {
x: getOffsetX(checkPressPosition!, poeBounds),
x: getOffsetX(checkPressPosition, poeBounds),
y: poeBounds.y,
width: Math.floor(WIDTH_96DPI * DPR * config.get('fontSize')),
height: poeBounds.height
+1 -1
View File
@@ -184,7 +184,7 @@ export function setupShortcuts () {
logger.debug('Keyup', { source: 'shortcuts', key: UiohookToName[e.keycode] || 'unknown' })
})
uIOhook.on('wheel', async (e) => {
uIOhook.on('wheel', (e) => {
if (!e.ctrlKey || !PoeWindow.bounds || !PoeWindow.isActive || !config.get('stashScroll')) return
const stashCheckX = PoeWindow.bounds.x + PoeWindow.uiSidebarWidth
+2 -2
View File
@@ -29,12 +29,12 @@ function leaguesMenuItem () {
const menuItem = new MenuItem({
label: 'League',
submenu: leagues.map(league => ({
submenu: leagues.map<MenuItemConstructorOptions>(league => ({
label: league.id,
type: 'checkbox',
checked: league.selected,
click: () => { selectLeague(league) }
} as MenuItemConstructorOptions))
}))
})
return [menuItem]
+1 -3
View File
@@ -20,9 +20,7 @@ type SectionParseResult =
typeof SECTION_SKIPPED |
typeof PARSER_SKIPPED
interface ParserFn {
(section: string[], item: ParsedItem): SectionParseResult
}
type ParserFn = (section: string[], item: ParsedItem) => SectionParseResult
const parsers: ParserFn[] = [
parseUnidentified,
+3 -3
View File
@@ -11,9 +11,9 @@ export enum ModifierType {
Fractured = 'fractured'
}
export interface ItemModifier extends Stat,
Pick<StatMatcher, 'string' | 'negate'>
{
export interface ItemModifier extends
Stat,
Pick<StatMatcher, 'string' | 'negate'> {
values?: number[]
type: ModifierType
}
+1
View File
@@ -10,4 +10,5 @@ declare module '*.json' {
export default value
}
// eslint-disable-next-line @typescript-eslint/naming-convention
declare const __static: string
+2 -2
View File
@@ -40,10 +40,10 @@ export async function load () {
}
}
MainProcess.sendLeaguesReady(tradeLeagues.value.map(league => ({
MainProcess.sendLeaguesReady(tradeLeagues.value.map<League>(league => ({
id: league.id,
selected: league.id === selected.value
} as League)))
})))
} catch (e) {
error.value = e.message
} finally {
+5 -5
View File
@@ -38,7 +38,7 @@ interface NinjaItemInfo {
artFilename: null
links: number
itemClass: number
sparkline: { data: number[], totalChange: number }
sparkline: { data: Array<number | null>, totalChange: number }
lowConfidenceSparkline: { data: number[], totalChange: number[] }
implicitModifiers: []
explicitModifiers: Array<{ text: string, optional: boolean }>
@@ -131,10 +131,10 @@ async function load (force: boolean = false) {
name: currency.currencyTypeName,
receive: {
chaosValue: currency.receive.value,
graphPoints: currency.receiveSparkLine.data.filter(d => d != null),
graphPoints: currency.receiveSparkLine.data.filter((point): point is number => point != null),
totalChange: currency.receiveSparkLine.totalChange
}
} as ItemInfo)
})
if (currency.detailsId === 'exalted-orb') {
chaosExaRate.value = currency.receive.value
@@ -155,10 +155,10 @@ async function load (force: boolean = false) {
name: item.name,
receive: {
chaosValue: item.chaosValue,
graphPoints: item.sparkline.data.filter(d => d != null),
graphPoints: item.sparkline.data.filter((point): point is number => point != null),
totalChange: item.sparkline.totalChange
}
} as ItemInfo)
})
}
}
+1 -1
View File
@@ -24,7 +24,7 @@
</template>
<script lang="ts">
import { defineComponent, PropType, computed, ref } from 'vue'
import { defineComponent, PropType, computed } from 'vue'
import ItemModifierText from '../ui/ItemModifierText.vue'
import { Config } from '@/web/Config'
import { PreparedStat } from './prepare-map-stats'
+2 -2
View File
@@ -17,7 +17,7 @@
import { defineComponent, ref } from 'vue'
import { useI18n } from 'vue-i18n'
export default {
export default defineComponent({
setup () {
const show = ref(false)
@@ -34,7 +34,7 @@ export default {
show
}
}
}
})
</script>
<style lang="postcss" module>
+2 -2
View File
@@ -154,8 +154,8 @@ export default {
isVisible:
this.hideUI ? false
: !this.active && w.wmFlags.includes('invisible-on-blur') ? false
: showExclusive ? w === showExclusive
: w.wmWants === 'show'
: showExclusive ? w === showExclusive
: w.wmWants === 'show'
}))
},
topmostWidget () {
+2 -2
View File
@@ -16,7 +16,7 @@ import Widget from './Widget.vue'
import { MainProcess } from '@/ipc/main-process-bindings'
import { parseClipboard } from '@/parser'
export default {
export default defineComponent({
components: { Widget },
setup () {
const wm = inject<WidgetManager>('wm')!
@@ -46,5 +46,5 @@ export default {
}
}
}
}
})
</script>
+2 -2
View File
@@ -33,7 +33,7 @@
</template>
<script lang="ts">
import { defineComponent, PropType, computed, inject, ref } from 'vue'
import { defineComponent, PropType, computed, inject } from 'vue'
import { Widget as IWidget, WidgetManager, WidgetMenu } from './interfaces'
import Widget from './Widget.vue'
import { useI18n } from 'vue-i18n'
@@ -55,7 +55,7 @@ export default defineComponent({
(props.config.alwaysShow || (widget.wmWants === 'hide'))
)
})
const { t } = useI18n()
return {
+8 -8
View File
@@ -30,14 +30,14 @@ export interface WidgetManager {
height: number
active: boolean
widgets: Widget[]
show (wmId: number): void
hide (wmId: number): void
remove (wmId: number): void
bringToTop (wmId: number): void
create (wmType: string): void
showBrowser (wmId: number, url: string): void
closeBrowser (wmId: number): void
setFlag (wmId: number, flag: string, state: boolean): void
show: (wmId: number) => void
hide: (wmId: number) => void
remove: (wmId: number) => void
bringToTop: (wmId: number) => void
create: (wmType: string) => void
showBrowser: (wmId: number, url: string) => void
closeBrowser: (wmId: number) => void
setFlag: (wmId: number, flag: string, state: boolean) => void
}
export interface WidgetMenu extends Widget {
@@ -170,7 +170,7 @@ export function createFilters (item: ParsedItem): ItemFilters {
value: 'nonunique'
}
}
if (item.isMirrored) {
filters.mirrored = {
value: true
@@ -10,7 +10,7 @@ import { filterUniqueItemProp } from './pseudo/item-property-unique'
export interface FiltersCreationContext {
readonly item: ParsedItem
filters: Writeable<StatFilter>[]
filters: Array<Writeable<StatFilter>>
modifiers: ParsedItem['modifiers']
}
+4 -14
View File
@@ -94,19 +94,7 @@ export interface StatFilter {
max: number | '' | undefined
}
export type INTERNAL_TRADE_ID =
'armour.armour' |
'armour.evasion_rating' |
'armour.energy_shield' |
'armour.block' |
'weapon.total_dps' |
'weapon.physical_dps' |
'weapon.elemental_dps' |
'weapon.crit' |
'weapon.aps' |
'map.no_elder_guardian'
export const INTERNAL_TRADE_ID = [
export const INTERNAL_TRADE_IDS = [
'armour.armour',
'armour.evasion_rating',
'armour.energy_shield',
@@ -117,4 +105,6 @@ export const INTERNAL_TRADE_ID = [
'weapon.crit',
'weapon.aps',
'map.no_elder_guardian'
]
] as const
export type InternalTradeId = typeof INTERNAL_TRADE_IDS[number]
@@ -82,7 +82,7 @@ function weaponProps (ctx: FiltersCreationContext) {
const { item } = ctx
if (item.props.physicalDamage) {
const physQ20 = variablePropAt20Quality(item.props.physicalDamage!, QUALITY_STATS.PHYSICAL_DAMAGE, item)
const physQ20 = variablePropAt20Quality(item.props.physicalDamage, QUALITY_STATS.PHYSICAL_DAMAGE, item)
const pdpsQ20 = Math.floor((physQ20[0] + physQ20[1]) / 2 * item.props.attackSpeed!)
ctx.filters.push({
@@ -114,7 +114,7 @@ export function filterResists (ctx: FiltersCreationContext) {
...CHAOS_RES.pseudo,
disabled: true, // NOTE: unlike EleRes it is disabled
hidden: hasBaseChaosRes ? undefined : 'Crafted Chaos Resistance without Explicit mod has no value',
...rollToFilter(chaosTotal!, { neverNegated: true })
...rollToFilter(chaosTotal, { neverNegated: true })
})
}
+5 -5
View File
@@ -1,6 +1,6 @@
import { STAT_BY_REF } from '@/assets/data'
import { ItemModifier, ModifierType } from '@/parser/modifiers'
import { INTERNAL_TRADE_ID } from '../interfaces'
import { InternalTradeId } from '../interfaces'
export function pseudoStat (ref: string) {
const stat = STAT_BY_REF.get(ref)!
@@ -13,7 +13,7 @@ export function pseudoStat (ref: string) {
}
}
export function internalPropStat (tradeId: INTERNAL_TRADE_ID, text: string, type: 'armour' | 'weapon') {
export function internalPropStat (tradeId: InternalTradeId, text: string, type: 'armour' | 'weapon') {
return {
text,
statRef: text,
@@ -22,8 +22,8 @@ export function internalPropStat (tradeId: INTERNAL_TRADE_ID, text: string, type
}
}
export function sumPseudoStats (modifiers: ItemModifier[], stats: string[]): number | undefined {
return modifiers.reduce((res, mod) => stats.includes(mod.stat.ref)
export function sumPseudoStats (modifiers: ItemModifier[], stats: string[]) {
return modifiers.reduce<number | undefined>((res, mod) => stats.includes(mod.stat.ref)
? (res || 0) + mod.values![0]
: res, undefined as number | undefined)
: res, undefined)
}
@@ -84,6 +84,7 @@ export async function sendFeedback (
method: 'POST',
body
})
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const text = await response.text()
// console.assert(text === `"${feedback.option}"`)
}
+8 -5
View File
@@ -1,3 +1,7 @@
/* eslint-disable @typescript-eslint/no-floating-promises,
@typescript-eslint/promise-function-async,
@typescript-eslint/return-await */
import { shallowReactive, shallowRef } from 'vue'
export class RateLimiter {
@@ -6,7 +10,6 @@ export class RateLimiter {
private _destroyed = false
// eslint-disable-next-line no-useless-constructor
constructor (
public max: number,
public window: number
@@ -55,7 +58,7 @@ export class RateLimiter {
}
if (_limiters.every(rl => !rl.isFullyUtilized)) {
_limiters.forEach(rl => rl.wait())
_limiters.forEach(rl => { rl.wait() })
} else {
return this.waitMulti(limiters)
}
@@ -143,9 +146,9 @@ class ResourceHandle {
this.borrowedAt = Date.now()
this.releasedAt = this.borrowedAt + millis
this._cb = cb
this.promise = new Promise((_resolve, _reject) => {
this._resolve = _resolve
this._reject = _reject
this.promise = new Promise((resolve, reject) => {
this._resolve = resolve
this._reject = reject
this._tmid = setTimeout(() => {
this._cb()
+1 -1
View File
@@ -132,7 +132,7 @@ function useTradeApi () {
let searchId = 0
const error = shallowRef<string | null>(null)
const searchResult = shallowRef<SearchResult | null>(null)
let fetchResults = shallowRef<PricingResult[]>([])
const fetchResults = shallowRef<PricingResult[]>([])
const groupedResults = computed(() => {
const out: Array<PricingResult & { listedTimes: number }> = []
@@ -6,7 +6,7 @@ export function artificialSlowdown (ms: number) {
let datakey: unknown = null
return {
reset (value: unknown = Symbol()) {
reset (value: unknown = Symbol('unique value')) {
if (datakey !== value) {
datakey = value
if (tmid !== null) {
+16 -16
View File
@@ -79,12 +79,12 @@ async function requestTradeResultList (body: TradeRequest): Promise<SearchResult
}
export async function requestResults (queryId: string, resultIds: string[]): Promise<PricingResult[]> {
type ResponseT = { result: FetchResult[], error: SearchResult['error'] }
interface ResponseT { result: FetchResult[], error: SearchResult['error'] }
let data = cache.get<ResponseT>(resultIds)
if (!data) {
await RateLimiter.waitMulti(RATE_LIMIT_RULES.FETCH)
const response = await fetch(`https://${getTradeEndpoint()}/api/trade/fetch/${resultIds.join(',')}?query=${queryId}&exchange`)
adjustRateLimits(RATE_LIMIT_RULES.FETCH, response.headers)
@@ -98,20 +98,20 @@ export async function requestResults (queryId: string, resultIds: string[]): Pro
return data.result
.filter(result => result != null) // { gone: true }
.map(result => {
return {
id: result.id,
listedAt: result.listing.indexed,
exchangeAmount: result.listing.price.exchange.amount,
itemAmount: result.listing.price.item.amount,
stock: result.listing.price.item.stock,
ign: result.listing.account.lastCharacterName,
accountName: result.listing.account.name,
accountStatus: result.listing.account.online
? (result.listing.account.online.status === 'afk' ? 'afk' : 'online')
: 'offline'
} as PricingResult
})
.map<PricingResult>(result => {
return {
id: result.id,
listedAt: result.listing.indexed,
exchangeAmount: result.listing.price.exchange.amount,
itemAmount: result.listing.price.item.amount,
stock: result.listing.price.item.stock,
ign: result.listing.account.lastCharacterName,
accountName: result.listing.account.name,
accountStatus: result.listing.account.online
? (result.listing.account.online.status === 'afk' ? 'afk' : 'online')
: 'offline'
}
})
}
export interface BulkSearch {
+15 -15
View File
@@ -1,5 +1,5 @@
import { ItemInfluence, ItemCategory, ParsedItem, ItemRarity } from '@/parser'
import { ItemFilters, StatFilter, INTERNAL_TRADE_ID } from '../filters/interfaces'
import { ItemFilters, StatFilter, INTERNAL_TRADE_IDS, InternalTradeId } from '../filters/interfaces'
import prop from 'dot-prop'
import { MainProcess } from '@/ipc/main-process-bindings'
import { SearchResult, Account, getTradeEndpoint, adjustRateLimits, RATE_LIMIT_RULES, preventQueueCreation } from './common'
@@ -48,8 +48,8 @@ export const CATEGORY_TO_TRADE_ID = new Map([
[ItemCategory.Trinket, 'accessory.trinket']
])
type FilterBoolean = { option?: 'true' | 'false' }
type FilterRange = { min?: number, max?: number }
interface FilterBoolean { option?: 'true' | 'false' }
interface FilterRange { min?: number, max?: number }
interface TradeRequest { /* eslint-disable camelcase */
query: {
@@ -57,7 +57,7 @@ interface TradeRequest { /* eslint-disable camelcase */
name?: string | { discriminator: string, option: string }
type?: string | { discriminator: string, option: string }
stats: Array<{
type: 'and' | 'if' | 'count' | 'not',
type: 'and' | 'if' | 'count' | 'not'
value?: FilterRange
filters: Array<{
id: string
@@ -167,9 +167,9 @@ interface FetchResult {
properties?: Array<{
values: [[string, number]]
type:
30 | // Spawns a Level %0 Monster when Harvested
6 | // Quality
5 // Level
30 | // Spawns a Level %0 Monster when Harvested
6 | // Quality
5 // Level
}>
}
listing: {
@@ -399,7 +399,7 @@ export function createTradeRequest (filters: ItemFilters, stats: StatFilter[], i
if (stat.disabled) continue
switch (stat.tradeId[0] as INTERNAL_TRADE_ID) {
switch (stat.tradeId[0] as InternalTradeId) {
case 'armour.armour':
prop.set(query.filters, 'armour_filters.filters.ar.min', typeof stat.min === 'number' ? stat.min : undefined)
prop.set(query.filters, 'armour_filters.filters.ar.max', typeof stat.max === 'number' ? stat.max : undefined)
@@ -439,7 +439,7 @@ export function createTradeRequest (filters: ItemFilters, stats: StatFilter[], i
}
}
stats = stats.filter(stat => !INTERNAL_TRADE_ID.includes(stat.tradeId[0]))
stats = stats.filter(stat => !INTERNAL_TRADE_IDS.includes(stat.tradeId[0] as any))
if (filters.veiled) {
const refs = filters.veiled.stat.split('<<and>>')
for (const statRef of refs) {
@@ -484,7 +484,7 @@ export async function requestTradeResultList (body: TradeRequest, leagueId: stri
])
await RateLimiter.waitMulti(RATE_LIMIT_RULES.SEARCH)
const response = await fetch(`${MainProcess.CORS}https://${getTradeEndpoint()}/api/trade/search/${leagueId}`, {
method: 'POST',
headers: {
@@ -507,12 +507,12 @@ export async function requestTradeResultList (body: TradeRequest, leagueId: stri
}
export async function requestResults (queryId: string, resultIds: string[]): Promise<PricingResult[]> {
type ResponseT = { result: FetchResult[], error: SearchResult['error'] }
interface ResponseT { result: FetchResult[], error: SearchResult['error'] }
let data = cache.get<ResponseT>(resultIds)
if (!data) {
await RateLimiter.waitMulti(RATE_LIMIT_RULES.FETCH)
const response = await fetch(`https://${getTradeEndpoint()}/api/trade/fetch/${resultIds.join(',')}?query=${queryId}`)
adjustRateLimits(RATE_LIMIT_RULES.FETCH, response.headers)
@@ -524,12 +524,12 @@ export async function requestResults (queryId: string, resultIds: string[]): Pro
cache.set<ResponseT>(resultIds, data, Cache.deriveTtl(...RATE_LIMIT_RULES.SEARCH, ...RATE_LIMIT_RULES.FETCH))
}
return data.result.map(result => {
return data.result.map<PricingResult>(result => {
return {
id: result.id,
itemLevel:
result.item.ilvl ||
result.item.properties?.find(prop => prop.type === 30)?.values[0][0],
Number(result.item.properties?.find(prop => prop.type === 30)?.values[0][0]),
stackSize: result.item.stackSize,
corrupted: result.item.corrupted,
quality: result.item.properties?.find(prop => prop.type === 6)?.values[0][0],
@@ -542,7 +542,7 @@ export async function requestResults (queryId: string, resultIds: string[]): Pro
accountStatus: result.listing.account.online
? (result.listing.account.online.status === 'afk' ? 'afk' : 'online')
: 'offline'
} as PricingResult
}
})
}
+2
View File
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/promise-function-async */
import { createRouter, createWebHashHistory } from 'vue-router'
export default createRouter({
+6 -6
View File
@@ -8,7 +8,7 @@
</template>
<script lang="ts">
import { defineComponent, PropType } from 'vue'
import { defineComponent } from 'vue'
import { useI18n } from 'vue-i18n'
import { KeyToCode, forbidden } from '@/ipc/KeyToCode'
@@ -36,16 +36,16 @@ export default defineComponent({
handleKeyup (e: KeyboardEvent) {
e.preventDefault()
e.stopPropagation()
if (e.code === 'Backspace') {
if (!props.required) {
ctx.emit('update:modelValue', null)
}
return
}
let { code, ctrlKey, shiftKey, altKey } = e
if (code.startsWith('Key')) {
code = code.substr('Key'.length)
} else if (code.startsWith('Digit')) {
@@ -53,7 +53,7 @@ export default defineComponent({
} else if (e.key === 'Cancel' && code === 'Pause') {
code = 'Cancel'
}
if (
(KeyToCode as Record<string, number>)[code] &&
(ctrlKey ? !props.forbidden.includes('Ctrl') : true) &&
@@ -66,7 +66,7 @@ export default defineComponent({
else if (altKey) code = `Alt + ${code}`
else if (ctrlKey) code = `Ctrl + ${code}`
else if (shiftKey) code = `Shift + ${code}`
if (!props.forbidden.includes(code)) {
ctx.emit('update:modelValue', code)
}
+5 -5
View File
@@ -60,11 +60,11 @@ export default defineComponent({
modifiers: [
...(props.boundary
? [{
name: 'preventOverflow',
options: {
boundary: document.querySelector(props.boundary)
}
}]
name: 'preventOverflow',
options: {
boundary: document.querySelector(props.boundary)
}
}]
: [])
]
}