Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(eslint-plugin): update list of native events #1881

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
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
121 changes: 68 additions & 53 deletions packages/utils/src/eslint-plugin/get-native-event-names.ts
Original file line number Diff line number Diff line change
@@ -1,62 +1,71 @@
let nativeEventNames: ReadonlySet<string> | null = null;

/**
* Check MDN events page for details https://developer.mozilla.org/en-US/docs/Web/Events
*
* Events sourse:
* @link https://developer.mozilla.org/en-US/docs/Web/API/BatteryManager
* @link https://developer.mozilla.org/en-US/docs/Web/API/Document
* @link https://developer.mozilla.org/en-US/docs/Web/API/Element
* @link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
* @link https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement
* @link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement
* @link https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder
* @link https://developer.mozilla.org/en-US/docs/Web/API/Node
* @link https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition
* @link https://developer.mozilla.org/en-US/docs/Web/API/SVGAnimationElement
* @link https://developer.mozilla.org/en-US/docs/Web/API/SVGElement
* @link https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices
*/
export function getNativeEventNames(): ReadonlySet<string> {
return (
nativeEventNames ??
(nativeEventNames = new Set<string>([
// Source: https://developer.mozilla.org/en-US/docs/Web/Events
'abort',
'afterprint',
'afterscriptexecute',
'animationcancel',
'animationend',
'animationiteration',
'animationstart',
'appinstalled',
'audioprocess',
'audioend',
'audiostart',
'auxclick',
'beforeinput',
'beforeinstallprompt',
'beforematch',
'beforeprint',
'beforescriptexecute',
'beforetoggle',
'beforeunload',
'beforexrselect',
'beginEvent',
'blocked',
'blur',
'boundary',
'cached',
'cancel',
'canplay',
'canplaythrough',
'change',
'chargingchange',
'chargingtimechange',
'checking',
'click',
'close',
'complete',
'compositionend',
'compositionstart',
'compositionupdate',
'contentvisibilityautostatechange',
'contextmenu',
'copy',
'cut',
'dataavailable',
'dblclick',
'devicechange',
'devicelight',
'devicemotion',
'deviceorientation',
'deviceproximity',
'deviceorientationabsolute',
'dischargingtimechange',
'DOMAttributeNameChanged',
'DOMAttrModified',
'DOMCharacterDataModified',
'DOMActivate',
'DOMContentLoaded',
'DOMElementNameChanged',
'focus',
'focusin',
'focusout',
'DOMNodeInserted',
'DOMNodeInsertedIntoDocument',
'DOMNodeRemoved',
'DOMNodeRemovedFromDocument',
'DOMSubtreeModified',
'downloading',
'DOMMouseScroll',
'drag',
'dragend',
'dragenter',
Expand All @@ -66,19 +75,25 @@ export function getNativeEventNames(): ReadonlySet<string> {
'drop',
'durationchange',
'emptied',
'encrypted',
'end',
'ended',
'endEvent',
'error',
'focus',
'focusin',
'focusout',
'formdata',
'fullscreenchange',
'fullscreenerror',
'gamepadconnected',
'gamepaddisconnected',
'gesturechange',
'gestureend',
'gesturestart',
'gotpointercapture',
'hashchange',
'lostpointercapture',
'input',
'invalid',
'keydown',
'keypress',
'keyup',
Expand All @@ -87,9 +102,8 @@ export function getNativeEventNames(): ReadonlySet<string> {
'load',
'loadeddata',
'loadedmetadata',
'loadend',
'loadstart',
'mark',
'lostpointercapture',
'message',
'messageerror',
'mousedown',
Expand All @@ -99,18 +113,20 @@ export function getNativeEventNames(): ReadonlySet<string> {
'mouseout',
'mouseover',
'mouseup',
'mousewheel',
'MozMousePixelScroll',
'nomatch',
'notificationclick',
'noupdate',
'obsolete',
'offline',
'online',
'open',
'orientationchange',
'pagehide',
'pagereveal',
'pageshow',
'pageswap',
'paste',
'pause',
'play',
'playing',
'pointercancel',
'pointerdown',
'pointerenter',
Expand All @@ -120,61 +136,60 @@ export function getNativeEventNames(): ReadonlySet<string> {
'pointermove',
'pointerout',
'pointerover',
'pointerrawupdate',
'pointerup',
'play',
'playing',
'popstate',
'prerenderingchange',
'progress',
'push',
'pushsubscriptionchange',
'ratechange',
'readystatechange',
'rejectionhandled',
'repeatEvent',
'reset',
'resize',
'resourcetimingbufferfull',
'result',
'resume',
'scroll',
'scrollend',
'securitypolicyviolation',
'seeked',
'seeking',
'select',
'selectstart',
'selectionchange',
'show',
'selectstart',
'soundend',
'soundstart',
'speechend',
'speechstart',
'stalled',
'start',
'stop',
'storage',
'submit',
'success',
'suspend',
'SVGAbort',
'SVGError',
'SVGLoad',
'SVGResize',
'SVGScroll',
'SVGUnload',
'SVGZoom',
'timeout',
'timeupdate',
'toggle',
'touchcancel',
'touchend',
'touchmove',
'touchstart',
'transitioncancel',
'transitionend',
'transitionrun',
'transitionstart',
'unhandledrejection',
'unload',
'updateready',
'upgradeneeded',
'userproximity',
'voiceschanged',
'versionchange',
'visibilitychange',
'volumechange',
'vrdisplayactivate',
'vrdisplayconnect',
'vrdisplaydeactivate',
'vrdisplaydisconnect',
'vrdisplaypresentchange',
'waiting',
'webkitmouseforcechanged',
'webkitmouseforcedown',
'webkitmouseforceup',
'webkitmouseforcewillbegin',
'wheel',
]))
);
Expand Down