aboutsummaryrefslogtreecommitdiff
path: root/.eslintrc.cjs
blob: 550cb28211d4adbba0a4280cb533aea00b6ddd35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
// prettier-ignore
const globals = [
	'NodeFilter', 'AbortController', 'AbortSignal', 'AbstractRange', 'AnalyserNode', 'Animation', 'AnimationEffect',
	'AnimationEvent', 'AnimationPlaybackEvent', 'AnimationTimeline', 'Attr', 'AudioBuffer', 'AudioBufferSourceNode', 'AudioContext',
	'AudioDestinationNode', 'AudioListener', 'AudioNode', 'AudioParam', 'AudioParamMap', 'AudioProcessingEvent',
	'AudioScheduledSourceNode', 'AudioWorklet', 'AudioWorkletNode', 'AuthenticatorAssertionResponse',
	'AuthenticatorAttestationResponse', 'AuthenticatorResponse', 'BarProp', 'BaseAudioContext', 'BeforeUnloadEvent',
	'BiquadFilterNode', 'Blob', 'BlobEvent', 'BroadcastChannel', 'ByteLengthQueuingStrategy', 'CDATASection', 'CSSAnimation',
	'CSSConditionRule', 'CSSCounterStyleRule', 'CSSFontFaceRule', 'CSSGroupingRule', 'CSSImportRule', 'CSSKeyframeRule',
	'CSSKeyframesRule', 'CSSMediaRule', 'CSSNamespaceRule', 'CSSPageRule', 'CSSRule', 'CSSStyleDeclaration', 'CSSStyleRule',
	'CSSStyleSheet', 'CSSSupportsRule', 'CSSTransition', 'Cache', 'CacheStorage', 'CanvasGradient', 'CanvasPattern',
	'CanvasRenderingContext2D', 'ChannelMergerNode', 'ChannelSplitterNode', 'CharacterData', 'Clipboard', 'ClipboardEvent',
	'ClipboardItem', 'CloseEvent', 'Comment', 'CompositionEvent', 'ConstantSourceNode', 'ConvolverNode', 'CountQueuingStrategy',
	'Credential', 'CredentialsContainer', 'Crypto', 'CryptoKey', 'CustomEvent', 'DOMException', 'DOMImplementation', 'DOMMatrix',
	'SVGMatrix', 'WebKitCSSMatrix', 'DOMMatrixReadOnly', 'DOMParser', 'DOMPoint', 'SVGPoint', 'DOMPointReadOnly', 'DOMQuad',
	'DOMRect', 'SVGRect', 'DOMRectList', 'DOMRectReadOnly', 'DOMStringList', 'DOMStringMap', 'DOMTokenList', 'DataTransfer',
	'DataTransferItem', 'DataTransferItemList', 'DelayNode', 'DeviceMotionEvent', 'DeviceOrientationEvent', 'Document',
	'DocumentFragment', 'DocumentTimeline', 'DocumentType', 'DragEvent', 'DynamicsCompressorNode', 'Element', 'ElementInternals',
	'ErrorEvent', 'Event', 'EventSource', 'EventTarget', 'External', 'File', 'FileList', 'FileReader', 'FileSystem',
	'FileSystemDirectoryEntry', 'FileSystemDirectoryReader', 'FileSystemEntry', 'FileSystemFileEntry', 'FocusEvent', 'FontFace',
	'FontFaceSet', 'FontFaceSetLoadEvent', 'FormDataEvent', 'GainNode', 'Gamepad', 'GamepadButton', 'GamepadEvent',
	'GamepadHapticActuator', 'Geolocation', 'GeolocationCoordinates', 'GeolocationPosition', 'GeolocationPositionError',
	'HTMLAllCollection', 'HTMLAnchorElement', 'HTMLAreaElement', 'HTMLAudioElement', 'HTMLBRElement', 'HTMLBaseElement',
	'HTMLBodyElement', 'HTMLButtonElement', 'HTMLCanvasElement', 'HTMLCollection', 'HTMLDListElement', 'HTMLDataElement',
	'HTMLDataListElement', 'HTMLDetailsElement', 'HTMLDirectoryElement', 'HTMLDivElement', 'HTMLDocument', 'HTMLElement',
	'HTMLEmbedElement', 'HTMLFieldSetElement', 'HTMLFontElement', 'HTMLFormControlsCollection', 'HTMLFormElement',
	'HTMLFrameElement', 'HTMLFrameSetElement', 'HTMLHRElement', 'HTMLHeadElement', 'HTMLHeadingElement', 'HTMLHtmlElement',
	'HTMLIFrameElement', 'HTMLImageElement', 'HTMLInputElement', 'HTMLLIElement', 'HTMLLabelElement', 'HTMLLegendElement',
	'HTMLLinkElement', 'HTMLMapElement', 'HTMLMarqueeElement', 'HTMLMediaElement', 'HTMLMenuElement', 'HTMLMetaElement',
	'HTMLMeterElement', 'HTMLModElement', 'HTMLOListElement', 'HTMLObjectElement', 'HTMLOptGroupElement', 'HTMLOptionElement',
	'HTMLOptionsCollection', 'HTMLOutputElement', 'HTMLParagraphElement', 'HTMLParamElement', 'HTMLPictureElement',
	'HTMLPreElement', 'HTMLProgressElement', 'HTMLQuoteElement', 'HTMLScriptElement', 'HTMLSelectElement', 'HTMLSlotElement',
	'HTMLSourceElement', 'HTMLSpanElement', 'HTMLStyleElement', 'HTMLTableCaptionElement', 'HTMLTableCellElement',
	'HTMLTableColElement', 'HTMLTableElement', 'HTMLTableRowElement', 'HTMLTableSectionElement', 'HTMLTemplateElement',
	'HTMLTextAreaElement', 'HTMLTimeElement', 'HTMLTitleElement', 'HTMLTrackElement', 'HTMLUListElement', 'HTMLUnknownElement',
	'HTMLVideoElement', 'HashChangeEvent', 'Headers', 'History', 'IDBCursor', 'IDBCursorWithValue', 'IDBDatabase', 'IDBFactory',
	'IDBIndex', 'IDBKeyRange', 'IDBObjectStore', 'IDBOpenDBRequest', 'IDBRequest', 'IDBTransaction', 'IDBVersionChangeEvent',
	'IIRFilterNode', 'IdleDeadline', 'ImageBitmap', 'ImageBitmapRenderingContext', 'ImageData', 'InputEvent',
	'IntersectionObserver', 'IntersectionObserverEntry', 'KeyboardEvent', 'KeyframeEffect', 'Location', 'MathMLElement',
	'MediaCapabilities', 'MediaDeviceInfo', 'MediaDevices', 'MediaElementAudioSourceNode', 'MediaEncryptedEvent', 'MediaError',
	'MediaKeyMessageEvent', 'MediaKeySession', 'MediaKeyStatusMap', 'MediaKeySystemAccess', 'MediaKeys', 'MediaList',
	'MediaMetadata', 'MediaQueryList', 'MediaQueryListEvent', 'MediaRecorder', 'MediaRecorderErrorEvent', 'MediaSession',
	'MediaSource', 'MediaStream', 'MediaStreamAudioDestinationNode', 'MediaStreamAudioSourceNode', 'MediaStreamTrack',
	'MediaStreamTrackEvent', 'MessageChannel', 'MessageEvent', 'MessagePort', 'MimeType', 'MimeTypeArray', 'MouseEvent',
	'MutationEvent', 'MutationObserver', 'MutationRecord', 'NamedNodeMap', 'Navigator', 'NetworkInformation', 'Node',
	'NodeIterator', 'NodeList', 'Notification', 'OfflineAudioCompletionEvent', 'OfflineAudioContext', 'OscillatorNode',
	'OverconstrainedError', 'PageTransitionEvent', 'PannerNode', 'Path2D', 'PaymentMethodChangeEvent', 'PaymentRequest',
	'PaymentRequestUpdateEvent', 'PaymentResponse', 'Performance', 'PerformanceEntry', 'PerformanceEventTiming', 'PerformanceMark',
	'PerformanceMeasure', 'PerformanceNavigation', 'PerformanceNavigationTiming', 'PerformanceObserver',
	'PerformanceObserverEntryList', 'PerformancePaintTiming', 'PerformanceResourceTiming', 'PerformanceServerTiming',
	'PerformanceTiming', 'PeriodicWave', 'PermissionStatus', 'Permissions', 'PictureInPictureWindow', 'Plugin', 'PluginArray',
	'PointerEvent', 'PopStateEvent', 'ProcessingInstruction', 'ProgressEvent', 'PromiseRejectionEvent', 'PublicKeyCredential',
	'PushManager', 'PushSubscription', 'PushSubscriptionOptions', 'RTCCertificate', 'RTCDTMFSender', 'RTCDTMFToneChangeEvent',
	'RTCDataChannel', 'RTCDataChannelEvent', 'RTCDtlsTransport', 'RTCIceCandidate', 'RTCIceTransport', 'RTCPeerConnection',
	'RTCPeerConnectionIceErrorEvent', 'RTCPeerConnectionIceEvent', 'RTCRtpReceiver', 'RTCRtpSender', 'RTCRtpTransceiver',
	'RTCSessionDescription', 'RTCStatsReport', 'RTCTrackEvent', 'RadioNodeList', 'Range', 'ReadableStream',
	'ReadableStreamDefaultController', 'ReadableStreamDefaultReader', 'RemotePlayback', 'Request', 'ResizeObserver',
	'ResizeObserverEntry', 'ResizeObserverSize', 'Response', 'SVGAElement', 'SVGAngle', 'SVGAnimateElement',
	'SVGAnimateMotionElement', 'SVGAnimateTransformElement', 'SVGAnimatedAngle', 'SVGAnimatedBoolean', 'SVGAnimatedEnumeration',
	'SVGAnimatedInteger', 'SVGAnimatedLength', 'SVGAnimatedLengthList', 'SVGAnimatedNumber', 'SVGAnimatedNumberList',
	'SVGAnimatedPreserveAspectRatio', 'SVGAnimatedRect', 'SVGAnimatedString', 'SVGAnimatedTransformList', 'SVGAnimationElement',
	'SVGCircleElement', 'SVGClipPathElement', 'SVGComponentTransferFunctionElement', 'SVGDefsElement', 'SVGDescElement',
	'SVGElement', 'SVGEllipseElement', 'SVGFEBlendElement', 'SVGFEColorMatrixElement', 'SVGFEComponentTransferElement',
	'SVGFECompositeElement', 'SVGFEConvolveMatrixElement', 'SVGFEDiffuseLightingElement', 'SVGFEDisplacementMapElement',
	'SVGFEDistantLightElement', 'SVGFEDropShadowElement', 'SVGFEFloodElement', 'SVGFEFuncAElement', 'SVGFEFuncBElement',
	'SVGFEFuncGElement', 'SVGFEFuncRElement', 'SVGFEGaussianBlurElement', 'SVGFEImageElement', 'SVGFEMergeElement',
	'SVGFEMergeNodeElement', 'SVGFEMorphologyElement', 'SVGFEOffsetElement', 'SVGFEPointLightElement',
	'SVGFESpecularLightingElement', 'SVGFESpotLightElement', 'SVGFETileElement', 'SVGFETurbulenceElement', 'SVGFilterElement',
	'SVGForeignObjectElement', 'SVGGElement', 'SVGGeometryElement', 'SVGGradientElement', 'SVGGraphicsElement', 'SVGImageElement',
	'SVGLength', 'SVGLengthList', 'SVGLineElement', 'SVGLinearGradientElement', 'SVGMPathElement', 'SVGMarkerElement',
	'SVGMaskElement', 'SVGMetadataElement', 'SVGNumber', 'SVGNumberList', 'SVGPathElement', 'SVGPatternElement', 'SVGPointList',
	'SVGPolygonElement', 'SVGPolylineElement', 'SVGPreserveAspectRatio', 'SVGRadialGradientElement', 'SVGRectElement',
	'SVGSVGElement', 'SVGScriptElement', 'SVGSetElement', 'SVGStopElement', 'SVGStringList', 'SVGStyleElement', 'SVGSwitchElement',
	'SVGSymbolElement', 'SVGTSpanElement', 'SVGTextContentElement', 'SVGTextElement', 'SVGTextPathElement',
	'SVGTextPositioningElement', 'SVGTitleElement', 'SVGTransform', 'SVGTransformList', 'SVGUnitTypes', 'SVGUseElement',
	'SVGViewElement', 'Screen', 'ScreenOrientation', 'ScriptProcessorNode', 'SecurityPolicyViolationEvent', 'Selection',
	'ServiceWorker', 'ServiceWorkerContainer', 'ServiceWorkerRegistration', 'ShadowRoot', 'SharedWorker', 'SourceBuffer',
	'SourceBufferList', 'SpeechRecognitionAlternative', 'SpeechRecognitionResult', 'SpeechRecognitionResultList', 'SpeechSynthesis',
	'SpeechSynthesisErrorEvent', 'SpeechSynthesisEvent', 'SpeechSynthesisUtterance', 'SpeechSynthesisVoice', 'StaticRange',
	'StereoPannerNode', 'Storage', 'StorageEvent', 'StorageManager', 'StyleSheet', 'StyleSheetList', 'SubmitEvent', 'SubtleCrypto',
	'Text', 'TextDecoder', 'TextDecoderStream', 'TextEncoder', 'TextEncoderStream', 'TextMetrics', 'TextTrack', 'TextTrackCue',
	'TextTrackCueList', 'TextTrackList', 'TimeRanges', 'Touch', 'TouchEvent', 'TouchList', 'TrackEvent', 'TransformStream',
	'TransformStreamDefaultController', 'TransitionEvent', 'TreeWalker', 'UIEvent', 'URL', 'webkitURL', 'URLSearchParams', 'VTTCue',
	'VTTRegion', 'ValidityState', 'VideoPlaybackQuality', 'VisualViewport', 'WaveShaperNode', 'WebGL2RenderingContext',
	'WebGLActiveInfo', 'WebGLBuffer', 'WebGLContextEvent', 'WebGLFramebuffer', 'WebGLProgram', 'WebGLQuery', 'WebGLRenderbuffer',
	'WebGLRenderingContext', 'WebGLSampler', 'WebGLShader', 'WebGLShaderPrecisionFormat', 'WebGLSync', 'WebGLTexture',
	'WebGLTransformFeedback', 'WebGLUniformLocation', 'WebGLVertexArrayObject', 'WebSocket', 'WheelEvent', 'Window', 'Worker',
	'Worklet', 'WritableStream', 'WritableStreamDefaultController', 'WritableStreamDefaultWriter', 'XMLDocument', 'XMLHttpRequest',
	'XMLHttpRequestEventTarget', 'XMLHttpRequestUpload', 'XMLSerializer', 'XPathEvaluator', 'XPathExpression', 'XPathResult',
	'XSLTProcessor', 'CSS', 'WebAssembly', 'Audio', 'Image', 'Option', 'clientInformation', 'closed', 'customElements',
	'devicePixelRatio', 'document', 'event', 'external', 'frameElement', 'frames', 'history', 'innerHeight', 'innerWidth', 'length',
	'location', 'locationbar', 'menubar', 'name', 'navigator', 'ondevicemotion', 'ondeviceorientation', 'onorientationchange',
	'opener', 'orientation', 'outerHeight', 'outerWidth', 'pageXOffset', 'pageYOffset', 'parent', 'personalbar', 'screen',
	'screenLeft', 'screenTop', 'screenX', 'screenY', 'scrollX', 'scrollY', 'scrollbars', 'self', 'speechSynthesis', 'status',
	'statusbar', 'toolbar', 'top', 'visualViewport', 'window', 'alert', 'blur', 'cancelIdleCallback', 'captureEvents', 'close',
	'confirm', 'focus', 'getComputedStyle', 'getSelection', 'matchMedia', 'moveBy', 'moveTo', 'open', 'postMessage', 'print',
	'prompt', 'releaseEvents', 'requestIdleCallback', 'resizeBy', 'resizeTo', 'scroll', 'scrollBy', 'scrollTo', 'stop', 'toString',
	'dispatchEvent', 'cancelAnimationFrame', 'requestAnimationFrame', 'onabort', 'onanimationcancel', 'onanimationend',
	'onanimationiteration', 'onanimationstart', 'onauxclick', 'onblur', 'oncanplay', 'oncanplaythrough', 'onchange', 'onclick',
	'onclose', 'oncontextmenu', 'oncuechange', 'ondblclick', 'ondrag', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover',
	'ondragstart', 'ondrop', 'ondurationchange', 'onemptied', 'onended', 'onerror', 'onfocus', 'onformdata', 'ongotpointercapture',
	'oninput', 'oninvalid', 'onkeydown', 'onkeypress', 'onkeyup', 'onload', 'onloadeddata', 'onloadedmetadata', 'onloadstart',
	'onlostpointercapture', 'onmousedown', 'onmouseenter', 'onmouseleave', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup',
	'onpause', 'onplay', 'onplaying', 'onpointercancel', 'onpointerdown', 'onpointerenter', 'onpointerleave', 'onpointermove',
	'onpointerout', 'onpointerover', 'onpointerup', 'onprogress', 'onratechange', 'onreset', 'onresize', 'onscroll', 'onseeked',
	'onseeking', 'onselect', 'onselectionchange', 'onselectstart', 'onstalled', 'onsubmit', 'onsuspend', 'ontimeupdate', 'ontoggle',
	'ontouchcancel', 'ontouchend', 'ontouchmove', 'ontouchstart', 'ontransitioncancel', 'ontransitionend', 'ontransitionrun',
	'ontransitionstart', 'onvolumechange', 'onwaiting', 'onwebkitanimationend', 'onwebkitanimationiteration',
	'onwebkitanimationstart', 'onwebkittransitionend', 'onwheel', 'onafterprint', 'onbeforeprint', 'onbeforeunload',
	'ongamepadconnected', 'ongamepaddisconnected', 'onhashchange', 'onlanguagechange', 'onmessage', 'onmessageerror', 'onoffline',
	'ononline', 'onpagehide', 'onpageshow', 'onpopstate', 'onrejectionhandled', 'onstorage', 'onunhandledrejection', 'onunload',
	'localStorage', 'caches', 'crossOriginIsolated', 'crypto', 'indexedDB', 'isSecureContext', 'origin', 'performance', 'atob',
	'btoa', 'createImageBitmap', 'queueMicrotask', 'sessionStorage', 'addEventListener', 'removeEventListener'
]

/**
 * @type {import('eslint').Linter.Config}
 */
module.exports = {
	env: {
		es2022: true,
		node: true
	},
	extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
	parser: '@typescript-eslint/parser',
	parserOptions: {
		ecmaVersion: 'latest',
		sourceType: 'module',
		project: './tsconfig.eslint.json'
	},
	plugins: ['@typescript-eslint', 'deprecation'],
	rules: {
		'no-return-await': 'off',
		'@typescript-eslint/no-empty-interface': 'warn',
		'no-mixed-spaces-and-tabs': 'off',
		'no-duplicate-imports': 'warn',
		'no-empty-function': 'off',
		'@typescript-eslint/no-empty-function': 'off',
		'no-empty': 'off',
		'@typescript-eslint/ban-ts-comment': [
			'error',
			{
				'ts-expect-error': 'allow-with-description',
				'ts-ignore': 'allow-with-description',
				'ts-nocheck': 'allow-with-description',
				'ts-check': 'allow-with-description',
				'minimumDescriptionLength': 5
			}
		],
		'@typescript-eslint/no-floating-promises': 'warn',
		'prefer-promise-reject-errors': 'warn',
		'@typescript-eslint/no-misused-promises': 'error',
		'@typescript-eslint/no-base-to-string': 'error',
		'no-loss-of-precision': 'off',
		'@typescript-eslint/no-loss-of-precision': 'error',
		'no-throw-literal': 'off',
		'@typescript-eslint/no-throw-literal': 'warn',
		'@typescript-eslint/prefer-nullish-coalescing': 'warn',
		'@typescript-eslint/no-explicit-any': 'off',
		'@typescript-eslint/no-non-null-assertion': 'off',
		'@typescript-eslint/explicit-module-boundary-types': 'off',
		'prefer-template': 'warn',
		'@typescript-eslint/no-this-alias': ['error', { allowDestructuring: true, allowedNames: ['that'] }],
		'@typescript-eslint/no-unused-vars': 'off' /* ['warn', { argsIgnorePattern: '^_' }] */,
		'no-implied-eval': 'off',
		'@typescript-eslint/no-implied-eval': ['error'],
		'deprecation/deprecation': 'warn',
		'@typescript-eslint/explicit-member-accessibility': ['warn', { accessibility: 'explicit' }],
		'@typescript-eslint/switch-exhaustiveness-check': 'warn',
		'@typescript-eslint/no-restricted-imports': [
			'error',
			{ paths: [{ name: 'console', importNames: ['assert'], message: 'Import from the `assert` module instead.' }] }
		],
		'no-restricted-globals': ['error', ...globals.map((v) => ({ name: v, message: "Don't use DOM globals." }))],
		'@typescript-eslint/no-namespace': 'off',
		'no-debugger': 'warn',
		'@typescript-eslint/prefer-as-const': 'warn',
		'@typescript-eslint/ban-types': 'off',
		'@typescript-eslint/no-inferrable-types': 'off'
	}
};