chore: replace ts-ignore with ts-expect-error

This commit is contained in:
Fernando Fernández 2021-02-15 22:16:47 +01:00
parent 9ae2169d18
commit 702b869068
12 changed files with 38 additions and 68 deletions

View File

@ -39,8 +39,7 @@
<script lang="ts">
import Vue, { PropType } from 'vue';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- Temporary module while waiting for fixes to language names on the server
// @ts-ignore
// @ts-expect-error - This module doesn't have typings. Temporary module while waiting for fixes to language names on the server
import langs from 'langs';
import {
BaseItemDto,

View File

@ -13,8 +13,7 @@
import Vue from 'vue';
import { stringify } from 'qs';
import { throttle } from 'lodash';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// @ts-expect-error - This module doesn't have typings
import muxjs from 'mux.js';
import { mapActions, mapGetters, mapState } from 'vuex';
import { PlaybackInfoResponse, RepeatMode } from '@jellyfin/client-axios';
@ -64,8 +63,7 @@ export default Vue.extend({
async mounted() {
try {
const { default: shaka } = await import(
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// @ts-expect-error - This module doesn't have typings
'shaka-player/dist/shaka-player.compiled'
);
@ -198,8 +196,7 @@ export default Vue.extend({
this.unpause();
},
onAudioProgressThrottled: throttle(function (_event?: Event) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// @ts-expect-error - TypeScript is confusing the typings with lodash's
this.onAudioProgress(_event);
}, 500),
onAudioProgress(_event?: Event): void {

View File

@ -1,8 +1,7 @@
<script lang="ts">
import Vue from 'vue';
import { VDialog } from 'vuetify/lib';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// @ts-expect-error - These typings are not declared
import { keyCodes } from 'vuetify/lib/util/helpers';
export default Vue.extend({

View File

@ -463,8 +463,7 @@ export default Vue.extend({
for (const [action, handler] of actionHandlers) {
try {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// @ts-expect-error - MediaSession is still a draft. Thus, it doesn't contain proper typings.
navigator.mediaSession.setActionHandler(action, handler);
} catch (error) {
// eslint-disable-next-line no-console
@ -490,8 +489,7 @@ export default Vue.extend({
for (const [action, handler] of actionHandlers) {
try {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// @ts-expect-error - MediaSession is still a draft. Thus, it doesn't contain proper typings.
navigator.mediaSession.setActionHandler(action, handler);
} catch (error) {
// eslint-disable-next-line no-console

View File

@ -16,8 +16,7 @@
import Vue from 'vue';
import { stringify } from 'qs';
import { throttle } from 'lodash';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// @ts-expect-error - This module doesn't have typings
import muxjs from 'mux.js';
import { mapActions, mapGetters, mapState } from 'vuex';
import {
@ -77,8 +76,7 @@ export default Vue.extend({
async mounted() {
try {
const { default: shaka } = await import(
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// @ts-expect-error - This module doesn't have typings
'shaka-player/dist/shaka-player.compiled'
);
@ -206,8 +204,7 @@ export default Vue.extend({
this.unpause();
},
onVideoProgressThrottled: throttle(function (_event?: Event) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// @ts-expect-error - TypeScript confuses the context with lodash's throttle typings
this.onVideoProgress(_event);
}, 500),
onVideoProgress(_event?: Event): void {

View File

@ -14,45 +14,35 @@ beforeEach(() => {
describe('BlurhashCanvas', () => {
test('has a hash property of type String', () => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
expect(wrapper.vm.$options.props.hash).toBeDefined();
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
expect(wrapper.vm.$options.props.hash.type).toBe(String);
// @ts-expect-error - props are not defined in the Vue type.
expect(wrapper?.vm?.$options?.props?.hash).toBeDefined();
// @ts-expect-error - props are not defined in the Vue type.
expect(wrapper?.vm?.$options?.props?.hash?.type).toBe(String);
});
test('has a width property of type Number', () => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
expect(wrapper.vm.$options.props.width).toBeDefined();
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
expect(wrapper.vm.$options.props.width.type).toBe(Number);
// @ts-expect-error - props are not defined in the Vue type.
expect(wrapper?.vm?.$options?.props?.width).toBeDefined();
// @ts-expect-error - props are not defined in the Vue type.
expect(wrapper?.vm?.$options?.props?.width?.type).toBe(Number);
});
test('has a height property of type Number', () => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
expect(wrapper.vm.$options.props.height).toBeDefined();
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
expect(wrapper.vm.$options.props.height.type).toBe(Number);
// @ts-expect-error - props are not defined in the Vue type.
expect(wrapper?.vm?.$options?.props?.height).toBeDefined();
// @ts-expect-error - props are not defined in the Vue type.
expect(wrapper?.vm?.$options?.props?.height.type).toBe(Number);
});
test('has a punch property of type Number', () => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
expect(wrapper.vm.$options.props.punch).toBeDefined();
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
expect(wrapper.vm.$options.props.punch.type).toBe(Number);
// @ts-expect-error - props are not defined in the Vue type.
expect(wrapper?.vm?.$options?.props?.punch).toBeDefined();
// @ts-expect-error - props are not defined in the Vue type.
expect(wrapper?.vm?.$options?.props?.punch?.type).toBe(Number);
});
test('requires a hash', () => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
expect(wrapper.vm.$options.props.hash.required).toBeTruthy();
// @ts-expect-error - props are not defined in the Vue type.
expect(wrapper?.vm?.$options?.props?.hash?.required).toBeTruthy();
});
test('has a default width and height', () => {

View File

@ -261,7 +261,7 @@ const config: NuxtConfig = {
** See https://nuxtjs.org/api/configuration-build/
*/
build: {
// @ts-ignore -- Undocumented options
// @ts-expect-error -- Undocumented options
loadingScreen: {
image: 'icon.png',
colors: {

View File

@ -1,6 +1,5 @@
import Vue from 'vue';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- Need to build a Type package for the module
// @ts-ignore
// @ts-expect-error - target typing doesn't exist as we declared it in params.
import { DynamicScroller, DynamicScrollerItem } from 'vue-virtual-scroller';
import 'vue-virtual-scroller/dist/vue-virtual-scroller.css';

View File

@ -1,7 +1,6 @@
import { Plugin } from '@nuxt/types';
import Vue from 'vue';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- Need to build a Type package for the module
// @ts-ignore
// @ts-expect-error - Need to build a Type package for the module
import VueNativeSock from 'vue-native-websocket';
declare module '@nuxt/types' {

View File

@ -11,8 +11,7 @@ extend('mustBeUrl', (value: string): boolean => {
extend('bothPasswordsSame', {
params: ['target'],
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// @ts-expect-error - target typing doesn't exist as we declared it in params.
validate(value, { target }) {
return value === target;
}
@ -21,7 +20,6 @@ extend('bothPasswordsSame', {
const veeValidate: Plugin = ({ app }) => {
configure({
defaultMessage: (_field, values) => {
// values._field_ = app.i18n.t(`fields.${field}`);
return app.i18n.t(`validation.${values._rule_}`, values);
}
});

View File

@ -16,8 +16,7 @@ function getGlobalMaxVideoBitrate(): number | null {
let isTizenFhd = false;
if (browserDetector.isTizen()) {
try {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// @ts-expect-error - Non-standard functions doesn't have typings
// eslint-disable-next-line no-undef
const isTizenUhd = webapis?.productinfo?.isUdPanelSupported();
isTizenFhd = !isTizenUhd;
@ -156,8 +155,7 @@ export function getCodecProfiles(
}
// Support H264 Level 52 (Tizen 5.0) - app only
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// @ts-expect-error - Non-standard functions doesn't have typings
if (browserDetector.isTizen5() && window.NativeShell) {
maxH264Level = 52;
}

View File

@ -17,18 +17,14 @@ export const getSupportedFeatures = (): SupportedFeaturesInterface => {
if (
// Check non-standard Safari PiP support
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// @ts-expect-error - Non-standard functions doesn't have typings
(typeof video.webkitSupportsPresentationMode === 'function' &&
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// @ts-expect-error - Non-standard functions doesn't have typings
video.webkitSupportsPresentationMode('picture-in-picture') &&
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// @ts-expect-error - Non-standard functions doesn't have typings
typeof video.webkitSetPresentationMode === 'function') ||
// Check standard PiP support
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// @ts-expect-error - Non-standard functions doesn't have typings
document.pictureInPictureEnabled
) {
supportedFeatures.pictureInPicture = true;