Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
Comment thread
spmonahan marked this conversation as resolved.
Comment thread
spmonahan marked this conversation as resolved.
Comment thread
spmonahan marked this conversation as resolved.
Comment thread
spmonahan marked this conversation as resolved.
"type": "minor",
"comment": "feat: disallow direct access to globals",
"packageName": "@fluentui/eslint-plugin",
"email": "seanmonahan@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: disable eslint rule",
"packageName": "@fluentui/priority-overflow",
"email": "seanmonahan@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "add optional `window` argument to `scrollIntoView`.",
"packageName": "@fluentui/react-aria",
"email": "seanmonahan@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: disable eslint rule.",
"packageName": "@fluentui/react-menu",
"email": "seanmonahan@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: disable eslint rule",
"packageName": "@fluentui/react-message-bar",
"email": "seanmonahan@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: disable eslint rule.",
"packageName": "@fluentui/react-popover",
"email": "seanmonahan@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix: use requestAnimationFrame from Fluent context.",
"packageName": "@fluentui/react-table",
"email": "seanmonahan@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "update eslint comments",
"packageName": "@fluentui/react-tabster",
"email": "seanmonahan@microsoft.com",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Use `MutationObserver` from global context.",
"packageName": "@fluentui/react-teaching-popover",
"email": "seanmonahan@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: disable eslint rule.",
"packageName": "@fluentui/react-toast",
"email": "seanmonahan@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix: use globals from Fluent context.",
"packageName": "@fluentui/react-utilities",
"email": "seanmonahan@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "fix: update internal function to optionally use global Fluent context.",
"packageName": "@fluentui/react-virtualizer",
"email": "seanmonahan@microsoft.com",
"dependentChangeType": "patch"
}
278 changes: 32 additions & 246 deletions packages/eslint-plugin/src/configs/restricted-globals.js
Original file line number Diff line number Diff line change
@@ -1,243 +1,29 @@
// These will be enabled in a follow up PR.
// https://github.com/microsoft/fluentui/issues/29964

// Via: https://developer.mozilla.org/en-US/docs/Web/API/Window
// const windowKeys = [
// // Instance properties
// 'caches',
// 'clientInformation',
// 'closed',
// 'console',
// 'credentialless',
// 'crypto',
// 'customElements',
// 'devicePixelRatio',
// 'frameElement',
// 'frames',
// 'fullScreen',
// 'history',
// 'indexedDB',
// 'innerHeight',
// 'innerWidth',
// 'isSecureContext',
// 'launchQueue',
// 'length',
// 'localStorage',
// 'location',
// 'locationbar',
// 'menubar',
// 'name',
// 'navigation',
// 'navigator',
// 'opener',
// 'origin',
// 'outerHeight',
// 'outerWidth',
// 'pageXOffset',
// 'pageYOffset',
// 'parent',
// 'performance',
// 'personalbar',
// 'scheduler',
// 'screen',
// 'screenX',
// 'screenY',
// 'scrollbars',
// 'scrollX',
// 'scrollY',
// 'self',
// 'sessionStorage',
// 'speechSynthesis',
// 'statusbar',
// 'toolbar',
// 'top',
// 'visualViewport',
// 'window',

// // Deprecated properties
// 'defaultStatus',
// 'event',
// 'external',
// 'orientation',
// 'returnValue',
// 'sidebar',
// 'status',

// // Instance methods
// 'addEventListener',
// 'alert',
// 'atob',
// 'blur',
// 'btoa',
// 'cancelAnimationFrame',
// 'cancelIdleCallback',
// 'clearImmediate',
// 'clearInterval',
// 'clearTimeout',
// 'close',
// 'confirm',
// 'createImageBitmap',
// 'dispatchEvent',
// 'dump',
// 'fetch',
// 'find',
// 'focus',
// 'getComputedStyle',
// 'getSelection',
// 'matchMedia',
// 'moveBy',
// 'moveTo',
// 'open',
// 'postMessage',
// 'print',
// 'prompt',
// 'queryLocalFonts',
// 'removeEventListener',
// 'reportError',
// 'requestAnimationFrame',
// 'requestIdleCallback',
// 'resizeBy',
// 'resizeTo',
// 'scroll',
// 'scrollBy',
// 'scrollTo',
// 'setImmediate',
// 'setInterval',
// 'setTimeout',
// 'showDirectoryPicker',
// 'showOpenFilePicker',
// 'showSaveFilePicker',
// 'stop',
// 'updateCommands',

// // Deprecated methods
// 'back',
// 'captureEvents',
// 'forward',
// 'releaseEvents',
// 'showModalDialog',

// // Events
// 'onabort',
// 'onafterprint',
// 'onanimationend',
// 'onanimationiteration',
// 'onanimationstart',
// 'onappinstalled',
// 'onauxclick',
// 'onbeforeinput',
// 'onbeforeinstallprompt',
// 'onbeforematch',
// 'onbeforeprint',
// 'onbeforetoggle',
// 'onbeforeunload',
// 'onbeforexrselect',
// 'onblur',
// 'oncancel',
// 'oncanplay',
// 'oncanplaythrough',
// 'onchange',
// 'onclick',
// 'onclose',
// 'oncontentvisibilityautostatechange',
// 'oncontextlost',
// 'oncontextmenu',
// 'oncontextrestored',
// 'oncuechange',
// 'ondblclick',
// 'ondevicemotion',
// 'ondeviceorientation',
// 'ondeviceorientationabsolute',
// 'ondrag',
// 'ondragend',
// 'ondragenter',
// 'ondragleave',
// 'ondragover',
// 'ondragstart',
// 'ondrop',
// 'ondurationchange',
// 'onemptied',
// 'onended',
// 'onerror',
// 'onfocus',
// 'onformdata',
// 'ongotpointercapture',
// 'onhashchange',
// 'oninput',
// 'oninvalid',
// 'onkeydown',
// 'onkeypress',
// 'onkeyup',
// 'onlanguagechange',
// 'onload',
// 'onloadeddata',
// 'onloadedmetadata',
// 'onloadstart',
// 'onlostpointercapture',
// 'onmessage',
// 'onmessageerror',
// 'onmousedown',
// 'onmouseenter',
// 'onmouseleave',
// 'onmousemove',
// 'onmouseout',
// 'onmouseover',
// 'onmouseup',
// 'onmousewheel',
// 'onoffline',
// 'ononline',
// 'onoverscroll',
// 'onpagehide',
// 'onpageshow',
// 'onpause',
// 'onplay',
// 'onplaying',
// 'onpointercancel',
// 'onpointerdown',
// 'onpointerenter',
// 'onpointerleave',
// 'onpointermove',
// 'onpointerout',
// 'onpointerover',
// 'onpointerrawupdate',
// 'onpointerup',
// 'onpopstate',
// 'onprogress',
// 'onratechange',
// 'onrejectionhandled',
// 'onreset',
// 'onresize',
// 'onscroll',
// 'onscrollend',
// 'onsearch',
// 'onsecuritypolicyviolation',
// 'onseeked',
// 'onseeking',
// 'onselect',
// 'onselectionchange',
// 'onselectstart',
// 'onslotchange',
// 'onstalled',
// 'onstorage',
// 'onsubmit',
// 'onsuspend',
// 'ontimeupdate',
// 'ontimezonechange',
// 'ontoggle',
// 'ontransitioncancel',
// 'ontransitionend',
// 'ontransitionrun',
// 'ontransitionstart',
// 'onunhandledrejection',
// 'onunload',
// 'onvolumechange',
// 'onwaiting',
// 'onwebkitanimationend',
// 'onwebkitanimationiteration',
// 'onwebkitanimationstart',
// 'onwebkittransitionend',
// 'onwheel',
// ];
// A list of globals that are problematic when using multiple windows.
const restrictedGlobals = [
'customElements',
'devicePixelRatio',
'location',
'navigator',
'performance',

'cancelAnimationFrame',
'cancelIdleCallback',
'clearImmediate',
'clearInterval',
'clearTimeout',
'fetch',
'getComputedStyle',
'matchMedia',
'requestAnimationFrame',
'requestIdleCallback',
'setImmediate',
'setInterval',
'setTimeout',

'IntersectionObserver',
'MutationObserver',
'ResizeObserver',
];

const reactLegacy = [
'error',
Expand All @@ -261,12 +47,12 @@ const react = [
name: 'document',
message: 'Get a reference to `document` from `useFluent()`.',
},
// ...windowKeys.map(key => {
// return {
// name: key,
// message: `Get a reference to \`window\` from \`useFluent()\` and access \`${key}\` from there.`,
// };
// }),
...restrictedGlobals.map(key => {
return {
name: key,
message: `Get a reference to \`window\` from \`useFluent()\` and access \`${key}\` from there.`,
};
}),
];

module.exports = {
Expand Down
Loading