1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #3313 from thornbill/fix-eslint-ts

Fix eslint polyfills for typescript files
This commit is contained in:
Bill Thornton 2022-01-11 13:57:46 -05:00 committed by GitHub
commit b0bb836ec7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 86 additions and 91 deletions

View file

@ -70,7 +70,92 @@ module.exports = {
], ],
'import/parsers': { 'import/parsers': {
'@typescript-eslint/parser': [ '.ts', '.tsx' ] '@typescript-eslint/parser': [ '.ts', '.tsx' ]
} },
polyfills: [
// Native Promises Only
'Promise',
// whatwg-fetch
'fetch',
// document-register-element
'document.registerElement',
// resize-observer-polyfill
'ResizeObserver',
// fast-text-encoding
'TextEncoder',
// intersection-observer
'IntersectionObserver',
// Core-js
'Object.assign',
'Object.is',
'Object.setPrototypeOf',
'Object.toString',
'Object.freeze',
'Object.seal',
'Object.preventExtensions',
'Object.isFrozen',
'Object.isSealed',
'Object.isExtensible',
'Object.getOwnPropertyDescriptor',
'Object.getPrototypeOf',
'Object.keys',
'Object.entries',
'Object.getOwnPropertyNames',
'Function.name',
'Function.hasInstance',
'Array.from',
'Array.arrayOf',
'Array.copyWithin',
'Array.fill',
'Array.find',
'Array.findIndex',
'Array.iterator',
'String.fromCodePoint',
'String.raw',
'String.iterator',
'String.codePointAt',
'String.endsWith',
'String.includes',
'String.repeat',
'String.startsWith',
'String.trim',
'String.anchor',
'String.big',
'String.blink',
'String.bold',
'String.fixed',
'String.fontcolor',
'String.fontsize',
'String.italics',
'String.link',
'String.small',
'String.strike',
'String.sub',
'String.sup',
'RegExp',
'Number',
'Math',
'Date',
'async',
'Symbol',
'Map',
'Set',
'WeakMap',
'WeakSet',
'ArrayBuffer',
'DataView',
'Int8Array',
'Uint8Array',
'Uint8ClampedArray',
'Int16Array',
'Uint16Array',
'Int32Array',
'Uint32Array',
'Float32Array',
'Float64Array',
'Reflect',
// Temporary while eslint-compat-plugin is buggy
'document.querySelector'
]
}, },
overrides: [ overrides: [
{ {
@ -122,93 +207,6 @@ module.exports = {
'Windows': 'readonly' 'Windows': 'readonly'
}, },
rules: { rules: {
},
settings: {
polyfills: [
// Native Promises Only
'Promise',
// whatwg-fetch
'fetch',
// document-register-element
'document.registerElement',
// resize-observer-polyfill
'ResizeObserver',
// fast-text-encoding
'TextEncoder',
// intersection-observer
'IntersectionObserver',
// Core-js
'Object.assign',
'Object.is',
'Object.setPrototypeOf',
'Object.toString',
'Object.freeze',
'Object.seal',
'Object.preventExtensions',
'Object.isFrozen',
'Object.isSealed',
'Object.isExtensible',
'Object.getOwnPropertyDescriptor',
'Object.getPrototypeOf',
'Object.keys',
'Object.entries',
'Object.getOwnPropertyNames',
'Function.name',
'Function.hasInstance',
'Array.from',
'Array.arrayOf',
'Array.copyWithin',
'Array.fill',
'Array.find',
'Array.findIndex',
'Array.iterator',
'String.fromCodePoint',
'String.raw',
'String.iterator',
'String.codePointAt',
'String.endsWith',
'String.includes',
'String.repeat',
'String.startsWith',
'String.trim',
'String.anchor',
'String.big',
'String.blink',
'String.bold',
'String.fixed',
'String.fontcolor',
'String.fontsize',
'String.italics',
'String.link',
'String.small',
'String.strike',
'String.sub',
'String.sup',
'RegExp',
'Number',
'Math',
'Date',
'async',
'Symbol',
'Map',
'Set',
'WeakMap',
'WeakSet',
'ArrayBuffer',
'DataView',
'Int8Array',
'Uint8Array',
'Uint8ClampedArray',
'Int16Array',
'Uint16Array',
'Int32Array',
'Uint32Array',
'Float32Array',
'Float64Array',
'Reflect',
// Temporary while eslint-compat-plugin is buggy
'document.querySelector'
]
} }
}, },
{ {

View file

@ -68,7 +68,6 @@ const NewUserPage: FunctionComponent = () => {
IsHidden: false IsHidden: false
})); }));
const promiseChannels = window.ApiClient.getJSON(window.ApiClient.getUrl('Channels')); const promiseChannels = window.ApiClient.getJSON(window.ApiClient.getUrl('Channels'));
// eslint-disable-next-line compat/compat
Promise.all([promiseFolders, promiseChannels]).then(function (responses) { Promise.all([promiseFolders, promiseChannels]).then(function (responses) {
loadMediaFolders(responses[0].Items); loadMediaFolders(responses[0].Items);
loadChannels(responses[1].Items); loadChannels(responses[1].Items);

View file

@ -117,14 +117,12 @@ const UserLibraryAccessPage: FunctionComponent = () => {
const loadData = useCallback(() => { const loadData = useCallback(() => {
loading.show(); loading.show();
const userId = appRouter.param('userId'); const userId = appRouter.param('userId');
// eslint-disable-next-line compat/compat
const promise1 = userId ? window.ApiClient.getUser(userId) : Promise.resolve({ Configuration: {} }); const promise1 = userId ? window.ApiClient.getUser(userId) : Promise.resolve({ Configuration: {} });
const promise2 = window.ApiClient.getJSON(window.ApiClient.getUrl('Library/MediaFolders', { const promise2 = window.ApiClient.getJSON(window.ApiClient.getUrl('Library/MediaFolders', {
IsHidden: false IsHidden: false
})); }));
const promise3 = window.ApiClient.getJSON(window.ApiClient.getUrl('Channels')); const promise3 = window.ApiClient.getJSON(window.ApiClient.getUrl('Channels'));
const promise4 = window.ApiClient.getJSON(window.ApiClient.getUrl('Devices')); const promise4 = window.ApiClient.getJSON(window.ApiClient.getUrl('Devices'));
// eslint-disable-next-line compat/compat
Promise.all([promise1, promise2, promise3, promise4]).then(function (responses) { Promise.all([promise1, promise2, promise3, promise4]).then(function (responses) {
loadUser(responses[0], responses[1].Items, responses[2].Items, responses[3].Items); loadUser(responses[0], responses[1].Items, responses[2].Items, responses[3].Items);
}); });