From 10374c4fe23b6128f36729a37ae6764008822b5a Mon Sep 17 00:00:00 2001 From: minjee <104430030+iammminzzy@users.noreply.github.com> Date: Sat, 23 Mar 2024 15:16:48 +0000 Subject: [PATCH 1/9] [core] Remove some IE11 support --- .../src/useAutocomplete/useAutocomplete.js | 24 ++++--------------- .../mui-base/src/useSnackbar/useSnackbar.ts | 3 +-- packages/mui-joy/src/Tooltip/Tooltip.tsx | 3 +-- packages/mui-material/src/Tooltip/Tooltip.js | 3 +-- .../src/styles/createTransitions.js | 4 +--- .../getDisplayName/getDisplayName.test.tsx | 12 +--------- .../src/getDisplayName/getDisplayName.ts | 11 +-------- .../mui-utils/src/getDisplayName/index.ts | 1 - .../src/integerPropType/integerPropType.js | 10 +------- 9 files changed, 12 insertions(+), 59 deletions(-) diff --git a/packages/mui-base/src/useAutocomplete/useAutocomplete.js b/packages/mui-base/src/useAutocomplete/useAutocomplete.js index 344b2cce0efe0f..45caa7dd2123dc 100644 --- a/packages/mui-base/src/useAutocomplete/useAutocomplete.js +++ b/packages/mui-base/src/useAutocomplete/useAutocomplete.js @@ -10,11 +10,8 @@ import { } from '@mui/utils'; // https://stackoverflow.com/questions/990904/remove-accents-diacritics-in-a-string-in-javascript -// Give up on IE11 support for this feature function stripDiacritics(string) { - return typeof string.normalize !== 'undefined' - ? string.normalize('NFD').replace(/[\u0300-\u036f]/g, '') - : string; + return string.normalize('NFD').replace(/[\u0300-\u036f]/g, ''); } export function createFilterOptions(config = {}) { @@ -56,17 +53,6 @@ export function createFilterOptions(config = {}) { }; } -// To replace with .findIndex() once we stop IE11 support. -function findIndex(array, comp) { - for (let i = 0; i < array.length; i += 1) { - if (comp(array[i])) { - return i; - } - } - - return -1; -} - const defaultFilterOptions = createFilterOptions(); // Number of options to jump in list box when `Page Up` and `Page Down` keys are used. @@ -498,7 +484,7 @@ export function useAutocomplete(props) { const previousHighlightedOption = previousProps.filteredOptions[highlightedIndexRef.current]; if (previousHighlightedOption) { - return findIndex(filteredOptions, (option) => { + return filteredOptions.findIndex((option) => { return getOptionLabel(option) === getOptionLabel(previousHighlightedOption); }); } @@ -539,12 +525,12 @@ export function useAutocomplete(props) { if ( multiple && currentOption && - findIndex(value, (val) => isOptionEqualToValue(currentOption, val)) !== -1 + value.findIndex((val) => isOptionEqualToValue(currentOption, val)) !== -1 ) { return; } - const itemIndex = findIndex(filteredOptions, (optionItem) => + const itemIndex = filteredOptions.findIndex((optionItem) => isOptionEqualToValue(optionItem, valueItem), ); if (itemIndex === -1) { @@ -685,7 +671,7 @@ export function useAutocomplete(props) { } } - const itemIndex = findIndex(newValue, (valueItem) => isOptionEqualToValue(option, valueItem)); + const itemIndex = newValue.findIndex((valueItem) => isOptionEqualToValue(option, valueItem)); if (itemIndex === -1) { newValue.push(option); diff --git a/packages/mui-base/src/useSnackbar/useSnackbar.ts b/packages/mui-base/src/useSnackbar/useSnackbar.ts index d2d73cf641af1f..4b9de6ad0754bb 100644 --- a/packages/mui-base/src/useSnackbar/useSnackbar.ts +++ b/packages/mui-base/src/useSnackbar/useSnackbar.ts @@ -44,8 +44,7 @@ export function useSnackbar(parameters: UseSnackbarParameters = {}): UseSnackbar */ function handleKeyDown(nativeEvent: KeyboardEvent) { if (!nativeEvent.defaultPrevented) { - // IE11, Edge (prior to using Blink?) use 'Esc' - if (nativeEvent.key === 'Escape' || nativeEvent.key === 'Esc') { + if (nativeEvent.key === 'Escape') { // not calling `preventDefault` since we don't know if people may ignore this event e.g. a permanently open snackbar onClose?.(nativeEvent, 'escapeKeyDown'); } diff --git a/packages/mui-joy/src/Tooltip/Tooltip.tsx b/packages/mui-joy/src/Tooltip/Tooltip.tsx index 531d3a8b288c1b..22c560f0ecf439 100644 --- a/packages/mui-joy/src/Tooltip/Tooltip.tsx +++ b/packages/mui-joy/src/Tooltip/Tooltip.tsx @@ -409,8 +409,7 @@ const Tooltip = React.forwardRef(function Tooltip(inProps, ref) { } function handleKeyDown(nativeEvent: KeyboardEvent) { - // IE11, Edge (prior to using Bink?) use 'Esc' - if (nativeEvent.key === 'Escape' || nativeEvent.key === 'Esc') { + if (nativeEvent.key === 'Escape') { handleClose(nativeEvent); } } diff --git a/packages/mui-material/src/Tooltip/Tooltip.js b/packages/mui-material/src/Tooltip/Tooltip.js index 05cea653d79888..dc71ddee0481ff 100644 --- a/packages/mui-material/src/Tooltip/Tooltip.js +++ b/packages/mui-material/src/Tooltip/Tooltip.js @@ -473,8 +473,7 @@ const Tooltip = React.forwardRef(function Tooltip(inProps, ref) { * @param {KeyboardEvent} nativeEvent */ function handleKeyDown(nativeEvent) { - // IE11, Edge (prior to using Bink?) use 'Esc' - if (nativeEvent.key === 'Escape' || nativeEvent.key === 'Esc') { + if (nativeEvent.key === 'Escape') { handleClose(nativeEvent); } } diff --git a/packages/mui-material/src/styles/createTransitions.js b/packages/mui-material/src/styles/createTransitions.js index a98b2c2357458e..9f92f9f2d8c4df 100644 --- a/packages/mui-material/src/styles/createTransitions.js +++ b/packages/mui-material/src/styles/createTransitions.js @@ -64,9 +64,7 @@ export default function createTransitions(inputTransitions) { if (process.env.NODE_ENV !== 'production') { const isString = (value) => typeof value === 'string'; - // IE11 support, replace with Number.isNaN - // eslint-disable-next-line no-restricted-globals - const isNumber = (value) => !isNaN(parseFloat(value)); + const isNumber = (value) => !Number.isNaN(parseFloat(value)); if (!isString(props) && !Array.isArray(props)) { console.error('MUI: Argument "props" must be a string or Array.'); } diff --git a/packages/mui-utils/src/getDisplayName/getDisplayName.test.tsx b/packages/mui-utils/src/getDisplayName/getDisplayName.test.tsx index 4d30daac79c0fe..6d2aba0f362085 100644 --- a/packages/mui-utils/src/getDisplayName/getDisplayName.test.tsx +++ b/packages/mui-utils/src/getDisplayName/getDisplayName.test.tsx @@ -1,7 +1,7 @@ /* eslint-disable react/prefer-stateless-function */ import * as React from 'react'; import { expect } from 'chai'; -import getDisplayName, { getFunctionName } from './getDisplayName'; +import getDisplayName from './getDisplayName'; describe('utils/getDisplayName.js', () => { describe('getDisplayName', () => { @@ -75,14 +75,4 @@ describe('utils/getDisplayName.js', () => { expect(getDisplayName(false)).to.equal(undefined); }); }); - - describe('getFunctionName', () => { - it('gets the name of a function', () => { - function SomeFunction() { - return
; - } - - expect(getFunctionName(SomeFunction)).to.equal('SomeFunction'); - }); - }); }); diff --git a/packages/mui-utils/src/getDisplayName/getDisplayName.ts b/packages/mui-utils/src/getDisplayName/getDisplayName.ts index 02164eed56390f..5290cabeea2e29 100644 --- a/packages/mui-utils/src/getDisplayName/getDisplayName.ts +++ b/packages/mui-utils/src/getDisplayName/getDisplayName.ts @@ -1,20 +1,11 @@ import * as React from 'react'; import { ForwardRef, Memo } from 'react-is'; -// Simplified polyfill for IE11 support -// https://github.com/JamesMGreene/Function.name/blob/58b314d4a983110c3682f1228f845d39ccca1817/Function.name.js#L3 -const fnNameMatchRegex = /^\s*function(?:\s|\s*\/\*.*\*\/\s*)+([^(\s/]*)\s*/; -export function getFunctionName(fn: Function): string { - const match = `${fn}`.match(fnNameMatchRegex); - const name = match && match[1]; - return name || ''; -} - function getFunctionComponentName( Component: React.FunctionComponent | React.ComponentClass, fallback = '', ) { - return Component.displayName || Component.name || getFunctionName(Component) || fallback; + return Component.displayName || Component.name || fallback; } function getWrappedName(outerType: any, innerType: any, wrapperName: string) { diff --git a/packages/mui-utils/src/getDisplayName/index.ts b/packages/mui-utils/src/getDisplayName/index.ts index 601cc5db1f7b67..64a7a4597931fb 100644 --- a/packages/mui-utils/src/getDisplayName/index.ts +++ b/packages/mui-utils/src/getDisplayName/index.ts @@ -1,2 +1 @@ export { default } from './getDisplayName'; -export * from './getDisplayName'; diff --git a/packages/mui-utils/src/integerPropType/integerPropType.js b/packages/mui-utils/src/integerPropType/integerPropType.js index 99105c3d03cd79..ca3afc0fab0583 100644 --- a/packages/mui-utils/src/integerPropType/integerPropType.js +++ b/packages/mui-utils/src/integerPropType/integerPropType.js @@ -24,18 +24,10 @@ export function getTypeByValue(value) { } } -// IE 11 support -function ponyfillIsInteger(x) { - // eslint-disable-next-line no-restricted-globals - return typeof x === 'number' && isFinite(x) && Math.floor(x) === x; -} - -const isInteger = Number.isInteger || ponyfillIsInteger; - function requiredInteger(props, propName, componentName, location) { const propValue = props[propName]; - if (propValue == null || !isInteger(propValue)) { + if (propValue == null || !Number.isInteger(propValue)) { const propType = getTypeByValue(propValue); return new RangeError( From e6725107af9115c573b250b23273cc4b04780fac Mon Sep 17 00:00:00 2001 From: minjee <104430030+iammminzzy@users.noreply.github.com> Date: Tue, 26 Mar 2024 13:38:46 +0000 Subject: [PATCH 2/9] Remove legacy build and update docs --- .browserslistrc | 60 ---------------------- babel.config.js | 8 +-- packages/mui-base/package.json | 3 +- packages/mui-docs/package.json | 3 +- packages/mui-icons-material/package.json | 1 - packages/mui-lab/package.json | 3 +- packages/mui-material-nextjs/package.json | 3 +- packages/mui-material/package.json | 3 +- packages/mui-private-theming/package.json | 3 +- packages/mui-styled-engine-sc/package.json | 3 +- packages/mui-styled-engine/package.json | 3 +- packages/mui-styles/package.json | 3 +- packages/mui-system/package.json | 3 +- packages/mui-utils/package.json | 3 +- scripts/build.mjs | 3 -- scripts/sizeSnapshot/webpack.config.js | 4 -- 16 files changed, 12 insertions(+), 97 deletions(-) diff --git a/.browserslistrc b/.browserslistrc index 6ab4c0c15806ec..6bf6f0e0e1e601 100644 --- a/.browserslistrc +++ b/.browserslistrc @@ -72,66 +72,6 @@ safari 15.4 samsung 23 samsung 22 -[legacy] -ie 11 -and_chr 122 -and_chr 121 -and_ff 123 -and_ff 122 -and_qq 14.9 -and_uc 15.5 -android 122 -android 121 -chrome 122 -chrome 121 -chrome 120 -chrome 119 -chrome 109 -edge 122 -edge 121 -firefox 123 -firefox 122 -firefox 115 -ios_saf 17.4 -ios_saf 17.3 -ios_saf 17.2 -ios_saf 17.1 -ios_saf 17.0 -ios_saf 16.6-16.7 -ios_saf 16.5 -ios_saf 16.4 -ios_saf 16.3 -ios_saf 16.2 -ios_saf 16.1 -ios_saf 16.0 -ios_saf 15.6-15.8 -ios_saf 15.5 -ios_saf 15.4 -kaios 3.0-3.1 -kaios 2.5 -op_mini all -op_mob 80 -opera 108 -opera 107 -opera 106 -safari 17.4 -safari 17.3 -safari 17.2 -safari 17.1 -safari 17.0 -safari 16.6 -safari 16.5 -safari 16.4 -safari 16.3 -safari 16.2 -safari 16.1 -safari 16.0 -safari 15.6 -safari 15.5 -safari 15.4 -samsung 23 -samsung 22 - # snapshot of `npx browserslist "maintained node versions"` # On update check all #stable-snapshot markers [node] diff --git a/babel.config.js b/babel.config.js index 48ca2abea4ce50..ad22418643bf84 100644 --- a/babel.config.js +++ b/babel.config.js @@ -13,7 +13,7 @@ const productionPlugins = [ ]; module.exports = function getBabelConfig(api) { - const useESModules = api.env(['regressions', 'legacy', 'modern', 'stable', 'rollup']); + const useESModules = api.env(['regressions', 'modern', 'stable', 'rollup']); const defaultAlias = { '@mui/material': resolveAliasPath('./packages/mui-material/src'), @@ -153,12 +153,6 @@ module.exports = function getBabelConfig(api) { ], ], }, - legacy: { - plugins: [ - // IE11 support - '@babel/plugin-transform-object-assign', - ], - }, test: { sourceMaps: 'both', plugins: [ diff --git a/packages/mui-base/package.json b/packages/mui-base/package.json index e9a512b10d2faa..13f4e6d9a82f56 100644 --- a/packages/mui-base/package.json +++ b/packages/mui-base/package.json @@ -27,8 +27,7 @@ "url": "https://opencollective.com/mui-org" }, "scripts": { - "build": "pnpm build:legacy && pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files", - "build:legacy": "node ../../scripts/build.mjs legacy", + "build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files", "build:modern": "node ../../scripts/build.mjs modern", "build:node": "node ../../scripts/build.mjs node", "build:stable": "node ../../scripts/build.mjs stable", diff --git a/packages/mui-docs/package.json b/packages/mui-docs/package.json index 83df3edba09fc0..b698cee4cce783 100644 --- a/packages/mui-docs/package.json +++ b/packages/mui-docs/package.json @@ -23,8 +23,7 @@ }, "homepage": "https://github.com/mui/material-ui/tree/master/packages/mui-docs", "scripts": { - "build": "pnpm build:legacy && pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files", - "build:legacy": "node ../../scripts/build.mjs legacy", + "build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files", "build:modern": "echo 'Skip modern build'", "build:node": "node ../../scripts/build.mjs node", "build:stable": "node ../../scripts/build.mjs stable", diff --git a/packages/mui-icons-material/package.json b/packages/mui-icons-material/package.json index 26a1ac8334359a..a2c20ec5e3c6a1 100644 --- a/packages/mui-icons-material/package.json +++ b/packages/mui-icons-material/package.json @@ -31,7 +31,6 @@ "build": "shx cp -r lib/ build/ && pnpm build:typings && pnpm build:copy-files", "build:lib": "pnpm build:node && pnpm build:stable", "build:lib:clean": "rimraf lib/ && pnpm build:lib", - "build:legacy": "echo 'Skip legacy build'", "build:modern": "echo 'Skip modern build'", "build:node": "node ../../scripts/build.mjs node --largeFiles --outDir lib", "build:stable": "node ../../scripts/build.mjs stable --largeFiles --outDir lib", diff --git a/packages/mui-lab/package.json b/packages/mui-lab/package.json index afc6243c9efbe5..aaf1fcea9417f2 100644 --- a/packages/mui-lab/package.json +++ b/packages/mui-lab/package.json @@ -28,8 +28,7 @@ "url": "https://opencollective.com/mui-org" }, "scripts": { - "build": "pnpm build:legacy && pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files", - "build:legacy": "node ../../scripts/build.mjs legacy", + "build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files", "build:modern": "node ../../scripts/build.mjs modern", "build:node": "node ../../scripts/build.mjs node", "build:stable": "node ../../scripts/build.mjs stable", diff --git a/packages/mui-material-nextjs/package.json b/packages/mui-material-nextjs/package.json index 6f916e47fe5983..431d6d7ebcd00f 100644 --- a/packages/mui-material-nextjs/package.json +++ b/packages/mui-material-nextjs/package.json @@ -24,8 +24,7 @@ "url": "https://opencollective.com/mui-org" }, "scripts": { - "build": "pnpm build:legacy && pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files", - "build:legacy": "node ../../scripts/build.mjs legacy", + "build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files", "build:modern": "node ../../scripts/build.mjs modern", "build:node": "node ../../scripts/build.mjs node", "build:stable": "node ../../scripts/build.mjs stable", diff --git a/packages/mui-material/package.json b/packages/mui-material/package.json index e82242b4699c1c..0684205c3b9635 100644 --- a/packages/mui-material/package.json +++ b/packages/mui-material/package.json @@ -27,8 +27,7 @@ "url": "https://opencollective.com/mui-org" }, "scripts": { - "build": "pnpm build:legacy && pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:umd && pnpm build:types && pnpm build:copy-files", - "build:legacy": "node ../../scripts/build.mjs legacy", + "build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:umd && pnpm build:types && pnpm build:copy-files", "build:modern": "node ../../scripts/build.mjs modern", "build:node": "node ../../scripts/build.mjs node", "build:stable": "node ../../scripts/build.mjs stable", diff --git a/packages/mui-private-theming/package.json b/packages/mui-private-theming/package.json index 24815bbbb6b8e4..9a5bf4d406d13f 100644 --- a/packages/mui-private-theming/package.json +++ b/packages/mui-private-theming/package.json @@ -26,8 +26,7 @@ "url": "https://opencollective.com/mui-org" }, "scripts": { - "build": "pnpm build:legacy && pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:copy-files", - "build:legacy": "node ../../scripts/build.mjs legacy", + "build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:copy-files", "build:modern": "node ../../scripts/build.mjs modern", "build:node": "node ../../scripts/build.mjs node", "build:stable": "node ../../scripts/build.mjs stable", diff --git a/packages/mui-styled-engine-sc/package.json b/packages/mui-styled-engine-sc/package.json index 756b4e0596d84b..753f94156838f2 100644 --- a/packages/mui-styled-engine-sc/package.json +++ b/packages/mui-styled-engine-sc/package.json @@ -26,8 +26,7 @@ "url": "https://opencollective.com/mui-org" }, "scripts": { - "build": "pnpm build:legacy && pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:copy-files", - "build:legacy": "node ../../scripts/build.mjs legacy", + "build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:copy-files", "build:modern": "node ../../scripts/build.mjs modern", "build:node": "node ../../scripts/build.mjs node", "build:stable": "node ../../scripts/build.mjs stable", diff --git a/packages/mui-styled-engine/package.json b/packages/mui-styled-engine/package.json index 22e13788d0a4af..dd98d67bb538bb 100644 --- a/packages/mui-styled-engine/package.json +++ b/packages/mui-styled-engine/package.json @@ -26,8 +26,7 @@ "url": "https://opencollective.com/mui-org" }, "scripts": { - "build": "pnpm build:legacy && pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:copy-files", - "build:legacy": "node ../../scripts/build.mjs legacy", + "build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:copy-files", "build:modern": "node ../../scripts/build.mjs modern", "build:node": "node ../../scripts/build.mjs node", "build:stable": "node ../../scripts/build.mjs stable", diff --git a/packages/mui-styles/package.json b/packages/mui-styles/package.json index 229341dc6735ad..b15fb042a30dbf 100644 --- a/packages/mui-styles/package.json +++ b/packages/mui-styles/package.json @@ -26,8 +26,7 @@ "url": "https://opencollective.com/mui-org" }, "scripts": { - "build": "pnpm build:legacy && pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:copy-files", - "build:legacy": "node ../../scripts/build.mjs legacy", + "build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:copy-files", "build:modern": "node ../../scripts/build.mjs modern", "build:node": "node ../../scripts/build.mjs node", "build:stable": "node ../../scripts/build.mjs stable", diff --git a/packages/mui-system/package.json b/packages/mui-system/package.json index e0c3e06e7123d7..5c033f27dbb532 100644 --- a/packages/mui-system/package.json +++ b/packages/mui-system/package.json @@ -26,8 +26,7 @@ "url": "https://opencollective.com/mui-org" }, "scripts": { - "build": "pnpm build:legacy && pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files", - "build:legacy": "node ../../scripts/build.mjs legacy", + "build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files", "build:modern": "node ../../scripts/build.mjs modern", "build:node": "node ../../scripts/build.mjs node", "build:stable": "node ../../scripts/build.mjs stable", diff --git a/packages/mui-utils/package.json b/packages/mui-utils/package.json index 216b9a102e1c4b..7fa282744cf349 100644 --- a/packages/mui-utils/package.json +++ b/packages/mui-utils/package.json @@ -26,8 +26,7 @@ "url": "https://opencollective.com/mui-org" }, "scripts": { - "build": "pnpm build:legacy && pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files", - "build:legacy": "node ../../scripts/build.mjs legacy", + "build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files", "build:modern": "node ../../scripts/build.mjs modern", "build:node": "node ../../scripts/build.mjs node", "build:stable": "node ../../scripts/build.mjs stable", diff --git a/scripts/build.mjs b/scripts/build.mjs index 711bcf389ae274..3a9f594a72844e 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -8,8 +8,6 @@ import { getWorkspaceRoot } from './utils.mjs'; const exec = promisify(childProcess.exec); const validBundles = [ - // legacy build using ES6 modules - 'legacy', // modern build with a rolling target using ES6 modules 'modern', // build for node using commonJS modules @@ -65,7 +63,6 @@ async function run(argv) { node: topLevelPathImportsCanBePackages ? './node' : './', modern: './modern', stable: topLevelPathImportsCanBePackages ? './' : './esm', - legacy: './legacy', }[bundle], ); diff --git a/scripts/sizeSnapshot/webpack.config.js b/scripts/sizeSnapshot/webpack.config.js index 6a63b053c7ae50..92c97758bc8792 100644 --- a/scripts/sizeSnapshot/webpack.config.js +++ b/scripts/sizeSnapshot/webpack.config.js @@ -136,10 +136,6 @@ async function getWebpackEntries() { // webpack: true, // path: path.join(path.relative(workspaceRoot, materialPackagePath), 'modern/index.js'), // }, - { - id: '@material-ui/core.legacy', - path: path.join(path.relative(workspaceRoot, materialPackagePath), 'legacy/index.js'), - }, { id: '@mui/joy', path: path.join(path.relative(workspaceRoot, joyPackagePath), 'index.js'), From 3663cca917215be65146c1249bb3a07a49c4ddd0 Mon Sep 17 00:00:00 2001 From: Minjee Son <104430030+iammminzzy@users.noreply.github.com> Date: Sat, 30 Mar 2024 01:13:35 +0000 Subject: [PATCH 3/9] remove @babel/plugin-transform-object-assign --- docs/babel.config.js | 2 -- docs/package.json | 1 - package.json | 1 - pnpm-lock.yaml | 15 --------------- 4 files changed, 19 deletions(-) diff --git a/docs/babel.config.js b/docs/babel.config.js index 57d4fab1b602af..1ccf95cfbb1b80 100644 --- a/docs/babel.config.js +++ b/docs/babel.config.js @@ -32,8 +32,6 @@ module.exports = { }, ], 'babel-plugin-optimize-clsx', - // for IE11 support - '@babel/plugin-transform-object-assign', ], ignore: [/@babel[\\|/]runtime/], // Fix a Windows issue. env: { diff --git a/docs/package.json b/docs/package.json index 64d69baf6c8f36..81a0d21754ecc9 100644 --- a/docs/package.json +++ b/docs/package.json @@ -20,7 +20,6 @@ }, "dependencies": { "@babel/core": "^7.24.4", - "@babel/plugin-transform-object-assign": "^7.24.1", "@babel/runtime": "^7.24.4", "@babel/runtime-corejs2": "^7.24.1", "@docsearch/react": "^3.6.0", diff --git a/package.json b/package.json index c8baca2b302388..2d3475a63679b4 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,6 @@ "@babel/plugin-proposal-object-rest-spread": "^7.20.7", "@babel/plugin-proposal-private-methods": "^7.18.6", "@babel/plugin-proposal-private-property-in-object": "^7.21.11", - "@babel/plugin-transform-object-assign": "^7.24.1", "@babel/plugin-transform-react-constant-elements": "^7.24.1", "@babel/plugin-transform-runtime": "^7.24.3", "@babel/preset-env": "^7.24.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 916a77b0389f3d..ab52cfbdaedf3e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -71,9 +71,6 @@ importers: '@babel/plugin-proposal-private-property-in-object': specifier: ^7.21.11 version: 7.21.11(@babel/core@7.24.4) - '@babel/plugin-transform-object-assign': - specifier: ^7.24.1 - version: 7.24.1(@babel/core@7.24.4) '@babel/plugin-transform-react-constant-elements': specifier: ^7.24.1 version: 7.24.1(@babel/core@7.24.4) @@ -583,9 +580,6 @@ importers: '@babel/core': specifier: ^7.24.4 version: 7.24.4 - '@babel/plugin-transform-object-assign': - specifier: ^7.24.1 - version: 7.24.1(@babel/core@7.24.4) '@babel/runtime': specifier: ^7.24.4 version: 7.24.4 @@ -3706,15 +3700,6 @@ packages: '@babel/helper-plugin-utils': 7.24.0 '@babel/plugin-syntax-numeric-separator': 7.10.4(@babel/core@7.24.4) - /@babel/plugin-transform-object-assign@7.24.1(@babel/core@7.24.4): - resolution: {integrity: sha512-I1kctor9iKtupb7jv7FyjApHCuKLBKCblVAeHVK9PB6FW7GI0ac6RtobC3MwwJy8CZ1JxuhQmnbrsqI5G8hAIg==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.24.4 - dependencies: - '@babel/core': 7.24.4 - '@babel/helper-plugin-utils': 7.24.0 - /@babel/plugin-transform-object-rest-spread@7.24.1(@babel/core@7.24.4): resolution: {integrity: sha512-XjD5f0YqOtebto4HGISLNfiNMTTs6tbkFf2TOqJlYKYmbo+mN9Dnpl4SRoofiziuOWMIyq3sZEUqLo3hLITFEA==} engines: {node: '>=6.9.0'} From d4ae0fe185985f5944e59026e2e477f75240e047 Mon Sep 17 00:00:00 2001 From: Minjee Son <104430030+iammminzzy@users.noreply.github.com> Date: Sat, 6 Apr 2024 09:39:26 +0000 Subject: [PATCH 4/9] Remove IE comment --- .eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index a06ac35ae3f3ae..a75d1e007728ff 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -164,7 +164,7 @@ module.exports = { 'react/state-in-constructor': 'off', // stylistic opinion. For conditional assignment we want it outside, otherwise as static 'react/static-property-placement': 'off', - // noopener is enough, no IE 11 support + // noopener is enough // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md#rule-options 'react/jsx-no-target-blank': ['error', { allowReferrer: true }], From 2cd04d88c4b58efc3ceb22fd6d7c8017bdd4e18d Mon Sep 17 00:00:00 2001 From: Minjee Son <104430030+iammminzzy@users.noreply.github.com> Date: Tue, 9 Apr 2024 10:07:14 +0000 Subject: [PATCH 5/9] Remove stableSort --- .../components/table/TableSortAndSelection.js | 19 +- .../table/TableSortAndSelection.tsx | 19 +- .../order-dashboard/components/OrderTable.tsx | 18 +- .../components/table/EnhancedTable.js | 23 +-- .../components/table/EnhancedTable.tsx | 23 +-- docs/src/components/showcase/FolderTable.tsx | 18 +- .../modules/components/MaterialShowcase.js | 192 +++++++++--------- 7 files changed, 104 insertions(+), 208 deletions(-) diff --git a/docs/data/joy/components/table/TableSortAndSelection.js b/docs/data/joy/components/table/TableSortAndSelection.js index 2455a21333b4cf..c7649aa9609b6d 100644 --- a/docs/data/joy/components/table/TableSortAndSelection.js +++ b/docs/data/joy/components/table/TableSortAndSelection.js @@ -65,22 +65,6 @@ function getComparator(order, orderBy) { : (a, b) => -descendingComparator(a, b, orderBy); } -// Since 2020 all major browsers ensure sort stability with Array.prototype.sort(). -// stableSort() brings sort stability to non-modern browsers (notably IE11). If you -// only support modern browsers you can replace stableSort(exampleArray, exampleComparator) -// with exampleArray.slice().sort(exampleComparator) -function stableSort(array, comparator) { - const stabilizedThis = array.map((el, index) => [el, index]); - stabilizedThis.sort((a, b) => { - const order = comparator(a[0], b[0]); - if (order !== 0) { - return order; - } - return a[1] - b[1]; - }); - return stabilizedThis.map((el) => el[0]); -} - const headCells = [ { id: 'name', @@ -348,7 +332,8 @@ export default function TableSortAndSelection() { rowCount={rows.length} /> - {stableSort(rows, getComparator(order, orderBy)) + {[...rows] + .sort(getComparator(order, orderBy)) .slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage) .map((row, index) => { const isItemSelected = isSelected(row.name); diff --git a/docs/data/joy/components/table/TableSortAndSelection.tsx b/docs/data/joy/components/table/TableSortAndSelection.tsx index f063700890b412..06026b6cfa0758 100644 --- a/docs/data/joy/components/table/TableSortAndSelection.tsx +++ b/docs/data/joy/components/table/TableSortAndSelection.tsx @@ -94,22 +94,6 @@ function getComparator( : (a, b) => -descendingComparator(a, b, orderBy); } -// Since 2020 all major browsers ensure sort stability with Array.prototype.sort(). -// stableSort() brings sort stability to non-modern browsers (notably IE11). If you -// only support modern browsers you can replace stableSort(exampleArray, exampleComparator) -// with exampleArray.slice().sort(exampleComparator) -function stableSort(array: readonly T[], comparator: (a: T, b: T) => number) { - const stabilizedThis = array.map((el, index) => [el, index] as [T, number]); - stabilizedThis.sort((a, b) => { - const order = comparator(a[0], b[0]); - if (order !== 0) { - return order; - } - return a[1] - b[1]; - }); - return stabilizedThis.map((el) => el[0]); -} - interface HeadCell { disablePadding: boolean; id: keyof Data; @@ -390,7 +374,8 @@ export default function TableSortAndSelection() { rowCount={rows.length} /> - {stableSort(rows, getComparator(order, orderBy)) + {[...rows] + .sort(getComparator(order, orderBy)) .slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage) .map((row, index) => { const isItemSelected = isSelected(row.name); diff --git a/docs/data/joy/getting-started/templates/order-dashboard/components/OrderTable.tsx b/docs/data/joy/getting-started/templates/order-dashboard/components/OrderTable.tsx index d01260b9fcd5d2..06c900a8d05ae1 100644 --- a/docs/data/joy/getting-started/templates/order-dashboard/components/OrderTable.tsx +++ b/docs/data/joy/getting-started/templates/order-dashboard/components/OrderTable.tsx @@ -242,22 +242,6 @@ function getComparator( : (a, b) => -descendingComparator(a, b, orderBy); } -// Since 2020 all major browsers ensure sort stability with Array.prototype.sort(). -// stableSort() brings sort stability to non-modern browsers (notably IE11). If you -// only support modern browsers you can replace stableSort(exampleArray, exampleComparator) -// with exampleArray.slice().sort(exampleComparator) -function stableSort(array: readonly T[], comparator: (a: T, b: T) => number) { - const stabilizedThis = array.map((el, index) => [el, index] as [T, number]); - stabilizedThis.sort((a, b) => { - const order = comparator(a[0], b[0]); - if (order !== 0) { - return order; - } - return a[1] - b[1]; - }); - return stabilizedThis.map((el) => el[0]); -} - function RowMenu() { return ( @@ -451,7 +435,7 @@ export default function OrderTable() { - {stableSort(rows, getComparator(order, 'id')).map((row) => ( + {[...rows].sort(getComparator(order, 'id')).map((row) => ( -descendingComparator(a, b, orderBy); } -// Since 2020 all major browsers ensure sort stability with Array.prototype.sort(). -// stableSort() brings sort stability to non-modern browsers (notably IE11). If you -// only support modern browsers you can replace stableSort(exampleArray, exampleComparator) -// with exampleArray.slice().sort(exampleComparator) -function stableSort(array, comparator) { - const stabilizedThis = array.map((el, index) => [el, index]); - stabilizedThis.sort((a, b) => { - const order = comparator(a[0], b[0]); - if (order !== 0) { - return order; - } - return a[1] - b[1]; - }); - return stabilizedThis.map((el) => el[0]); -} - const headCells = [ { id: 'name', @@ -288,10 +272,9 @@ export default function EnhancedTable() { const visibleRows = React.useMemo( () => - stableSort(rows, getComparator(order, orderBy)).slice( - page * rowsPerPage, - page * rowsPerPage + rowsPerPage, - ), + [...rows] + .sort(getComparator(order, orderBy)) + .slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage), [order, orderBy, page, rowsPerPage], ); diff --git a/docs/data/material/components/table/EnhancedTable.tsx b/docs/data/material/components/table/EnhancedTable.tsx index d1fd663dc821cc..23d1f23a1c19d2 100644 --- a/docs/data/material/components/table/EnhancedTable.tsx +++ b/docs/data/material/components/table/EnhancedTable.tsx @@ -88,22 +88,6 @@ function getComparator( : (a, b) => -descendingComparator(a, b, orderBy); } -// Since 2020 all major browsers ensure sort stability with Array.prototype.sort(). -// stableSort() brings sort stability to non-modern browsers (notably IE11). If you -// only support modern browsers you can replace stableSort(exampleArray, exampleComparator) -// with exampleArray.slice().sort(exampleComparator) -function stableSort(array: readonly T[], comparator: (a: T, b: T) => number) { - const stabilizedThis = array.map((el, index) => [el, index] as [T, number]); - stabilizedThis.sort((a, b) => { - const order = comparator(a[0], b[0]); - if (order !== 0) { - return order; - } - return a[1] - b[1]; - }); - return stabilizedThis.map((el) => el[0]); -} - interface HeadCell { disablePadding: boolean; id: keyof Data; @@ -320,10 +304,9 @@ export default function EnhancedTable() { const visibleRows = React.useMemo( () => - stableSort(rows, getComparator(order, orderBy)).slice( - page * rowsPerPage, - page * rowsPerPage + rowsPerPage, - ), + [...rows] + .sort(getComparator(order, orderBy)) + .slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage), [order, orderBy, page, rowsPerPage], ); diff --git a/docs/src/components/showcase/FolderTable.tsx b/docs/src/components/showcase/FolderTable.tsx index bd1694b4c40633..05de2315028999 100644 --- a/docs/src/components/showcase/FolderTable.tsx +++ b/docs/src/components/showcase/FolderTable.tsx @@ -45,22 +45,6 @@ function getComparator( : (a, b) => -descendingComparator(a, b, orderBy); } -// Since 2020 all major browsers ensure sort stability with Array.prototype.sort(). -// stableSort() brings sort stability to non-modern browsers (notably IE11). If you -// only support modern browsers you can replace stableSort(exampleArray, exampleComparator) -// with exampleArray.slice().sort(exampleComparator) -function stableSort(array: readonly T[], comparator: (a: T, b: T) => number) { - const stabilizedThis = array.map((el, index) => [el, index] as [T, number]); - stabilizedThis.sort((a, b) => { - const order = comparator(a[0], b[0]); - if (order !== 0) { - return order; - } - return a[1] - b[1]; - }); - return stabilizedThis.map((el) => el[0]); -} - function formatSize(size: number) { const kb = size / 1000; if (kb < 1000) { @@ -138,7 +122,7 @@ export default function BasicTable() { - {stableSort(data, getComparator(order, orderBy)).map((row) => ( + {[...data].sort(getComparator(order, orderBy)).map((row) => ( diff --git a/docs/src/modules/components/MaterialShowcase.js b/docs/src/modules/components/MaterialShowcase.js index fe4db5bf344f9b..df36890c140347 100644 --- a/docs/src/modules/components/MaterialShowcase.js +++ b/docs/src/modules/components/MaterialShowcase.js @@ -438,18 +438,6 @@ const appList = [ }, ]; -function stableSort(array, cmp) { - const stabilizedThis = array.map((el, index) => [el, index]); - stabilizedThis.sort((a, b) => { - const order = cmp(a[0], b[0]); - if (order !== 0) { - return order; - } - return a[1] - b[1]; - }); - return stabilizedThis.map((el) => el[0]); -} - // Returns a function that sorts reverse numerically by value of `key` function sortFactory(key) { return function sortNumeric(a, b) { @@ -498,96 +486,100 @@ export default function Showcase() { - {stableSort( - appList.filter((item) => item[sortFunctionName] !== undefined), - sortFunction, - ).map((app) => ( - - {app.image ? ( - ({ - height: '100%', - display: 'flex', - flexDirection: 'column', - p: 2, - gap: 2, - borderRadius: 1, - backgroundColor: `${alpha(theme.palette.grey[50], 0.3)}`, - borderColor: 'divider', - ...theme.applyDarkStyles({ - backgroundColor: `${alpha(theme.palette.primaryDark[700], 0.2)}`, + {appList + .filter((item) => item[sortFunctionName] !== undefined) + .sort(sortFunction) + .map((app) => ( + + {app.image ? ( + ({ + height: '100%', + display: 'flex', + flexDirection: 'column', + p: 2, + gap: 2, + borderRadius: 1, + backgroundColor: `${alpha(theme.palette.grey[50], 0.3)}`, borderColor: 'divider', - }), - })} - > - - ({ - height: 'auto', - borderRadius: '6px', - bgcolor: 'currentColor', - border: '1px solid', + ...theme.applyDarkStyles({ + backgroundColor: `${alpha(theme.palette.primaryDark[700], 0.2)}`, borderColor: 'divider', - color: 'grey.100', - ...theme.applyDarkStyles({ - color: 'primaryDark.900', - }), - })} - /> - - - - {app.title} - {app.source ? ( - - - - ) : null} - - - {app.description} - - - - {app.dateAdded} - - - - ) : ( - - {t('visit')} - - )} - - ))} + }), + })} + > + + ({ + height: 'auto', + borderRadius: '6px', + bgcolor: 'currentColor', + border: '1px solid', + borderColor: 'divider', + color: 'grey.100', + ...theme.applyDarkStyles({ + color: 'primaryDark.900', + }), + })} + /> + + + + {app.title} + {app.source ? ( + + + + ) : null} + + + {app.description} + + + + {app.dateAdded} + + + + ) : ( + + {t('visit')} + + )} + + ))} ); From dc87608841c0f34c8601879c0b14c3e6cf82b334 Mon Sep 17 00:00:00 2001 From: Minjee Son <104430030+iammminzzy@users.noreply.github.com> Date: Tue, 9 Apr 2024 10:13:41 +0000 Subject: [PATCH 6/9] Remove some comments --- packages/mui-joy/src/Avatar/Avatar.tsx | 2 +- packages/mui-material/src/AppBar/AppBar.js | 1 - packages/mui-material/src/Avatar/Avatar.js | 2 +- packages/mui-material/src/CardMedia/CardMedia.js | 1 - 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/mui-joy/src/Avatar/Avatar.tsx b/packages/mui-joy/src/Avatar/Avatar.tsx index 7a355e56a0499a..5f8379b0b0915e 100644 --- a/packages/mui-joy/src/Avatar/Avatar.tsx +++ b/packages/mui-joy/src/Avatar/Avatar.tsx @@ -76,7 +76,7 @@ const AvatarImg = styled('img', { width: '100%', height: '100%', textAlign: 'center', - // Handle non-square image. The property isn't supported by IE11. + // Handle non-square image. objectFit: 'cover', // Hide alt text. color: 'transparent', diff --git a/packages/mui-material/src/AppBar/AppBar.js b/packages/mui-material/src/AppBar/AppBar.js index ddc0befd8e9286..2d85cb28fb18e0 100644 --- a/packages/mui-material/src/AppBar/AppBar.js +++ b/packages/mui-material/src/AppBar/AppBar.js @@ -70,7 +70,6 @@ const AppBarRoot = styled(Paper, { { props: { position: 'sticky' }, style: { - // ⚠️ sticky is not supported by IE11. position: 'sticky', zIndex: (theme.vars || theme).zIndex.appBar, top: 0, diff --git a/packages/mui-material/src/Avatar/Avatar.js b/packages/mui-material/src/Avatar/Avatar.js index a4aea78bd739ca..051e9d0c7339fc 100644 --- a/packages/mui-material/src/Avatar/Avatar.js +++ b/packages/mui-material/src/Avatar/Avatar.js @@ -86,7 +86,7 @@ const AvatarImg = styled('img', { width: '100%', height: '100%', textAlign: 'center', - // Handle non-square image. The property isn't supported by IE11. + // Handle non-square image. objectFit: 'cover', // Hide alt text. color: 'transparent', diff --git a/packages/mui-material/src/CardMedia/CardMedia.js b/packages/mui-material/src/CardMedia/CardMedia.js index a721e873db1b42..94d3746941c149 100644 --- a/packages/mui-material/src/CardMedia/CardMedia.js +++ b/packages/mui-material/src/CardMedia/CardMedia.js @@ -43,7 +43,6 @@ const CardMediaRoot = styled('div', { { props: { isImageComponent: true }, style: { - // ⚠️ object-fit is not supported by IE11. objectFit: 'cover', }, }, From 2648542092b873f5a2edbaff2f22f289c14ca675 Mon Sep 17 00:00:00 2001 From: Minjee Son <104430030+iammminzzy@users.noreply.github.com> Date: Tue, 9 Apr 2024 10:54:20 +0000 Subject: [PATCH 7/9] Address some ESLint violations --- .../mui-material/src/styles/createTransitions.test.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/mui-material/src/styles/createTransitions.test.js b/packages/mui-material/src/styles/createTransitions.test.js index 627186dd0b23e1..1c942fb5a01917 100644 --- a/packages/mui-material/src/styles/createTransitions.test.js +++ b/packages/mui-material/src/styles/createTransitions.test.js @@ -130,14 +130,11 @@ describe('createTransitions', () => { it('should return NaN when passed a negative number', () => { const zeroHeightDurationNegativeOne = getAutoHeightDuration(-1); - // eslint-disable-next-line no-restricted-globals - expect(isNaN(zeroHeightDurationNegativeOne)).to.equal(true); + expect(Number.isNaN(zeroHeightDurationNegativeOne)).to.equal(true); const zeroHeightDurationSmallNegative = getAutoHeightDuration(-0.000001); - // eslint-disable-next-line no-restricted-globals - expect(isNaN(zeroHeightDurationSmallNegative)).to.equal(true); + expect(Number.isNaN(zeroHeightDurationSmallNegative)).to.equal(true); const zeroHeightDurationBigNegative = getAutoHeightDuration(-100000); - // eslint-disable-next-line no-restricted-globals - expect(isNaN(zeroHeightDurationBigNegative)).to.equal(true); + expect(Number.isNaN(zeroHeightDurationBigNegative)).to.equal(true); }); it('should return values for pre-calculated positive examples', () => { From 382f3c32804959298ad8fb406accd17410f1f8b8 Mon Sep 17 00:00:00 2001 From: Minjee Son <104430030+iammminzzy@users.noreply.github.com> Date: Tue, 9 Apr 2024 11:07:15 +0000 Subject: [PATCH 8/9] Use `Number.isNaN` with a `typeof` check --- packages/mui-material/src/Tabs/Tabs.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/mui-material/src/Tabs/Tabs.js b/packages/mui-material/src/Tabs/Tabs.js index dfbcd083803bd0..039591c9442d2d 100644 --- a/packages/mui-material/src/Tabs/Tabs.js +++ b/packages/mui-material/src/Tabs/Tabs.js @@ -420,9 +420,14 @@ const Tabs = React.forwardRef(function Tabs(inProps, ref) { [size]: tabMeta ? tabMeta[size] : 0, }; - // IE11 support, replace with Number.isNaN - // eslint-disable-next-line no-restricted-globals - if (isNaN(indicatorStyle[startIndicator]) || isNaN(indicatorStyle[size])) { + if ( + !( + typeof indicatorStyle[startIndicator] === 'number' && + !Number.isNaN(indicatorStyle[startIndicator]) && + typeof indicatorStyle[size] === 'number' && + !Number.isNaN(indicatorStyle[size]) + ) + ) { setIndicatorStyle(newIndicatorStyle); } else { const dStart = Math.abs(indicatorStyle[startIndicator] - newIndicatorStyle[startIndicator]); From 974c9ec32307b8b1641183a5a5b79aaf085454c9 Mon Sep 17 00:00:00 2001 From: Minjee Son <104430030+iammminzzy@users.noreply.github.com> Date: Wed, 10 Apr 2024 07:19:57 +0000 Subject: [PATCH 9/9] Revert "Use `Number.isNaN` with a `typeof` check" This reverts commit 382f3c32804959298ad8fb406accd17410f1f8b8. --- packages/mui-material/src/Tabs/Tabs.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/packages/mui-material/src/Tabs/Tabs.js b/packages/mui-material/src/Tabs/Tabs.js index 039591c9442d2d..dfbcd083803bd0 100644 --- a/packages/mui-material/src/Tabs/Tabs.js +++ b/packages/mui-material/src/Tabs/Tabs.js @@ -420,14 +420,9 @@ const Tabs = React.forwardRef(function Tabs(inProps, ref) { [size]: tabMeta ? tabMeta[size] : 0, }; - if ( - !( - typeof indicatorStyle[startIndicator] === 'number' && - !Number.isNaN(indicatorStyle[startIndicator]) && - typeof indicatorStyle[size] === 'number' && - !Number.isNaN(indicatorStyle[size]) - ) - ) { + // IE11 support, replace with Number.isNaN + // eslint-disable-next-line no-restricted-globals + if (isNaN(indicatorStyle[startIndicator]) || isNaN(indicatorStyle[size])) { setIndicatorStyle(newIndicatorStyle); } else { const dStart = Math.abs(indicatorStyle[startIndicator] - newIndicatorStyle[startIndicator]);