From 2c3381ee5a55ba0d5e2d4d445470238cc7861bdb Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Tue, 11 Jan 2022 10:03:06 -0500 Subject: [PATCH] Fix eslint polyfills for typescript files --- .eslintrc.js | 174 +++++++++--------- src/components/pages/NewUserPage.tsx | 1 - .../pages/UserLibraryAccessPage.tsx | 2 - 3 files changed, 86 insertions(+), 91 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 2851fd803f..19ccd168df 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -70,7 +70,92 @@ module.exports = { ], 'import/parsers': { '@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: [ { @@ -122,93 +207,6 @@ module.exports = { 'Windows': 'readonly' }, 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' - ] } }, { diff --git a/src/components/pages/NewUserPage.tsx b/src/components/pages/NewUserPage.tsx index 96275908ff..e26c2c8546 100644 --- a/src/components/pages/NewUserPage.tsx +++ b/src/components/pages/NewUserPage.tsx @@ -68,7 +68,6 @@ const NewUserPage: FunctionComponent = () => { IsHidden: false })); const promiseChannels = window.ApiClient.getJSON(window.ApiClient.getUrl('Channels')); - // eslint-disable-next-line compat/compat Promise.all([promiseFolders, promiseChannels]).then(function (responses) { loadMediaFolders(responses[0].Items); loadChannels(responses[1].Items); diff --git a/src/components/pages/UserLibraryAccessPage.tsx b/src/components/pages/UserLibraryAccessPage.tsx index f2fc33b5e5..9454793a11 100644 --- a/src/components/pages/UserLibraryAccessPage.tsx +++ b/src/components/pages/UserLibraryAccessPage.tsx @@ -117,14 +117,12 @@ const UserLibraryAccessPage: FunctionComponent = () => { const loadData = useCallback(() => { loading.show(); const userId = appRouter.param('userId'); - // eslint-disable-next-line compat/compat const promise1 = userId ? window.ApiClient.getUser(userId) : Promise.resolve({ Configuration: {} }); const promise2 = window.ApiClient.getJSON(window.ApiClient.getUrl('Library/MediaFolders', { IsHidden: false })); const promise3 = window.ApiClient.getJSON(window.ApiClient.getUrl('Channels')); const promise4 = window.ApiClient.getJSON(window.ApiClient.getUrl('Devices')); - // eslint-disable-next-line compat/compat Promise.all([promise1, promise2, promise3, promise4]).then(function (responses) { loadUser(responses[0], responses[1].Items, responses[2].Items, responses[3].Items); });