Skip to content

Commit

Permalink
eslint changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanpmartins committed Mar 22, 2023
1 parent aad6050 commit bc2de5d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function validateRestrictedInput(value: string, caller: string): boolean
return true;
}

export function validateRestrictedOptions(opt: VMoneyOptions | ExtractPropTypes<any>): boolean {
export function validateRestrictedOptions(opt: VMoneyOptions | ExtractPropTypes<never>): boolean {
for (const target of RESTRICTED_OPTIONS) {
const isValid = validateRestrictedInput(opt[target], target);
if (!isValid) {
Expand All @@ -49,7 +49,7 @@ export function validateRestrictedOptions(opt: VMoneyOptions | ExtractPropTypes<
}

// eslint-disable-next-line max-len
export function filterOptRestrictions(opt: VMoneyOptions | ExtractPropTypes<any>): VMoneyOptions | ExtractPropTypes<any> {
export function filterOptRestrictions(opt: VMoneyOptions | ExtractPropTypes<never>): VMoneyOptions | ExtractPropTypes<never> {
for (const option of RESTRICTED_OPTIONS) {
// Remove numbers from option prop
opt[option] = opt[option].replace(/\d+/g, '');
Expand Down Expand Up @@ -131,6 +131,6 @@ export function event(name: string): Event {

// eslint-disable-next-line max-len
// eslint-disable-next-line @typescript-eslint/no-shadow,@typescript-eslint/explicit-module-boundary-types,@typescript-eslint/no-explicit-any,no-shadow,max-len
export function debug({ debug = false }: VMoneyOptions | ExtractPropTypes<any>, ...args: any): void {
export function debug({ debug = false }: VMoneyOptions | ExtractPropTypes<never>, ...args: any): void {
if (debug) console.log(...args);
}
8 changes: 4 additions & 4 deletions src/directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import defaults, { VMoneyOptions } from './options';
// let opt: VMoneyOptions = defaults;

// eslint-disable-next-line max-len
const setValue = (el: HTMLInputElement, opt: VMoneyOptions | ExtractPropTypes<any>, caller: string) => {
const setValue = (el: HTMLInputElement, opt: VMoneyOptions | ExtractPropTypes<never>, caller: string) => {
debug(opt, 'directive setValue() - caller', caller);

if (!validateRestrictedOptions(opt)) {
Expand All @@ -37,7 +37,7 @@ const setValue = (el: HTMLInputElement, opt: VMoneyOptions | ExtractPropTypes<an
el.dispatchEvent(event('change')); // v-model.lazy
};

const onKeyDown = (e: KeyboardEvent, opt: VMoneyOptions | ExtractPropTypes<any>) => {
const onKeyDown = (e: KeyboardEvent, opt: VMoneyOptions | ExtractPropTypes<never>) => {
const el = e.currentTarget as HTMLInputElement;

const backspacePressed = e.code === 'Backspace' || e.code === 'Delete';
Expand Down Expand Up @@ -70,7 +70,7 @@ const onKeyDown = (e: KeyboardEvent, opt: VMoneyOptions | ExtractPropTypes<any>)
}
};

const onInput = (e: Event, opt: VMoneyOptions | ExtractPropTypes<any>) => {
const onInput = (e: Event, opt: VMoneyOptions | ExtractPropTypes<never>) => {
const el = e.currentTarget as HTMLInputElement;
debug(opt, 'directive oninput()', el.value);
if (/^[1-9]$/.test(el.value)) {
Expand All @@ -80,7 +80,7 @@ const onInput = (e: Event, opt: VMoneyOptions | ExtractPropTypes<any>) => {
setValue(el, opt, 'directive oninput');
};

const onFocus = (e: Event, opt: VMoneyOptions | ExtractPropTypes<any>) => {
const onFocus = (e: Event, opt: VMoneyOptions | ExtractPropTypes<never>) => {
const el = e.currentTarget as HTMLInputElement;
debug(opt, 'directive onFocus()', el.value);
if (opt.focusOnRight) {
Expand Down
2 changes: 1 addition & 1 deletion src/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {

export default function format(
input: string | number | null | undefined,
opt: VMoneyOptions | ExtractPropTypes<any> = defaults,
opt: VMoneyOptions | ExtractPropTypes<never> = defaults,
caller = '',
): string {
debug(opt, 'utils format() - caller', caller);
Expand Down
4 changes: 2 additions & 2 deletions src/unformat.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { ExtractPropTypes } from 'vue';
import defaults, { VMoneyOptions } from './options';
import BigNumber from './BigNumber';
import {
debug, fixed, numbersToCurrency, onlyNumbers,
} from './Utils';
import {ExtractPropTypes} from "vue";

export default function unformat(
input: string,
opt: VMoneyOptions | ExtractPropTypes<any> = defaults,
opt: VMoneyOptions | ExtractPropTypes<never> = defaults,
caller = '',
): string | number {
debug(opt, 'utils unformat() - caller', caller);
Expand Down

0 comments on commit bc2de5d

Please sign in to comment.