From b43acae6cc6241b0a6ea5e743334d54a56693dec Mon Sep 17 00:00:00 2001 From: "Matthew \"strager\" Glazar" Date: Sat, 27 Apr 2024 18:05:37 -0400 Subject: [PATCH] feat(browser-globals): include dictionary types in type list Teach quick-lint-js about browser types such as IntersectionObserverInit which are declared as dictionaries in the IDL. This makes quick-lint-js more compatible with TypeScript's dom.d.ts. --- docs/CHANGELOG.md | 3 + .../fe/global-variables-browser-generated.cpp | 429 ++++++++++++++++++ tools/browser-globals/index.js | 2 +- 3 files changed, 433 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index fe0a982542..6cacf39dc9 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -19,6 +19,8 @@ Semantic Versioning. ### Fixed +* quick-lint-js no longer warns about DOM types such as + `IntersectionObserverInit`. ([#1216][]) * `import Chart = goog.Chart;` in JavaScript code now correctly mentions "namespace aliases" instead of "import aliases". (Implemented by [UnfairBots][].) ([#1138][]) @@ -1456,6 +1458,7 @@ Beta release. [#1199]: https://github.com/quick-lint/quick-lint-js/issues/1199 [#1203]: https://github.com/quick-lint/quick-lint-js/issues/1203 [#1207]: https://github.com/quick-lint/quick-lint-js/issues/1207 +[#1216]: https://github.com/quick-lint/quick-lint-js/issues/1216 [E0001]: https://quick-lint-js.com/errors/E0001/ [E0003]: https://quick-lint-js.com/errors/E0003/ diff --git a/src/quick-lint-js/fe/global-variables-browser-generated.cpp b/src/quick-lint-js/fe/global-variables-browser-generated.cpp index 37284d62a3..94c60f9e14 100644 --- a/src/quick-lint-js/fe/global-variables-browser-generated.cpp +++ b/src/quick-lint-js/fe/global-variables-browser-generated.cpp @@ -1235,35 +1235,163 @@ const Char8 global_variables_web_worker[] = u8"terminate\0"; const Char8 global_variables_web_types[] = + u8"AbsoluteOrientationReadingValues\0" + u8"AccelerometerReadingValues\0" + u8"AccelerometerSensorOptions\0" + u8"AddEventListenerOptions\0" + u8"AesCbcParams\0" + u8"AesCtrParams\0" + u8"AesDerivedKeyParams\0" + u8"AesGcmParams\0" + u8"AesKeyAlgorithm\0" + u8"AesKeyGenParams\0" + u8"Algorithm\0" u8"AlgorithmIdentifier\0" + u8"AllowedUSBDevice\0" + u8"AnalyserOptions\0" + u8"AnimationEventInit\0" + u8"AnimationPlaybackEventInit\0" u8"ArrayBufferView\0" + u8"AssignedNodesOptions\0" + u8"AudioBufferOptions\0" + u8"AudioBufferSourceOptions\0" + u8"AudioConfiguration\0" + u8"AudioContextOptions\0" + u8"AudioNodeOptions\0" + u8"AudioParamDescriptor\0" + u8"AudioProcessingEventInit\0" + u8"AudioTimestamp\0" + u8"AudioWorkletNodeOptions\0" + u8"AuthenticationExtensionsClientInputs\0" + u8"AuthenticationExtensionsClientOutputs\0" + u8"AuthenticationExtensionsLargeBlobInputs\0" + u8"AuthenticationExtensionsLargeBlobOutputs\0" + u8"AuthenticatorSelectionCriteria\0" + u8"BackgroundFetchEventInit\0" + u8"BackgroundFetchOptions\0" + u8"BackgroundFetchUIOptions\0" + u8"BackgroundSyncOptions\0" + u8"BaseComputedKeyframe\0" + u8"BaseKeyframe\0" + u8"BasePropertyIndexedKeyframe\0" u8"BigInteger\0" u8"BinaryData\0" + u8"BiquadFilterOptions\0" + u8"BlobEventInit\0" u8"BlobPart\0" + u8"BlobPropertyBag\0" u8"BodyInit\0" + u8"BoxQuadOptions\0" u8"BufferSource\0" u8"COSEAlgorithmIdentifier\0" u8"CSSKeywordish\0" + u8"CSSMatrixComponentOptions\0" u8"CSSNumberish\0" + u8"CSSNumericType\0" + u8"CSSStyleSheetInit\0" u8"CSSUnparsedSegment\0" + u8"CacheQueryOptions\0" + u8"CameraDevicePermissionDescriptor\0" u8"CanvasImageSource\0" + u8"CanvasRenderingContext2DSettings\0" + u8"ChannelMergerOptions\0" + u8"ChannelSplitterOptions\0" + u8"ClientQueryOptions\0" + u8"ClipboardEventInit\0" u8"ClipboardItemData\0" u8"ClipboardItemDataType\0" + u8"ClipboardItemOptions\0" u8"ClipboardItems\0" + u8"ClipboardPermissionDescriptor\0" + u8"CloseEventInit\0" + u8"CollectedClientData\0" + u8"CompositionEventInit\0" + u8"ComputedEffectTiming\0" + u8"ConstantSourceOptions\0" u8"ConstrainBoolean\0" + u8"ConstrainBooleanParameters\0" u8"ConstrainDOMString\0" + u8"ConstrainDOMStringParameters\0" u8"ConstrainDouble\0" + u8"ConstrainDoubleRange\0" u8"ConstrainPoint2D\0" + u8"ConstrainPoint2DParameters\0" u8"ConstrainULong\0" + u8"ConstrainULongRange\0" u8"ContainerBasedOffset\0" + u8"ConvertCoordinateOptions\0" + u8"ConvolverOptions\0" + u8"CookieChangeEventInit\0" + u8"CookieInit\0" u8"CookieList\0" + u8"CookieListItem\0" + u8"CookieStoreDeleteOptions\0" + u8"CookieStoreGetOptions\0" + u8"CredentialCreationOptions\0" + u8"CredentialData\0" + u8"CredentialPropertiesOutput\0" + u8"CredentialRequestOptions\0" u8"CryptoKeyID\0" + u8"CryptoKeyPair\0" + u8"CustomEventInit\0" u8"DOMHighResTimeStamp\0" + u8"DOMMatrix2DInit\0" + u8"DOMMatrixInit\0" + u8"DOMPointInit\0" + u8"DOMQuadInit\0" + u8"DOMRectInit\0" u8"DOMTimeStamp\0" + u8"DelayOptions\0" + u8"DeviceMotionEventAccelerationInit\0" + u8"DeviceMotionEventInit\0" + u8"DeviceMotionEventRotationRateInit\0" + u8"DeviceOrientationEventInit\0" + u8"DevicePermissionDescriptor\0" + u8"DirectoryPickerOptions\0" + u8"DocumentTimelineOptions\0" + u8"DoubleRange\0" + u8"DragEventInit\0" + u8"DynamicsCompressorOptions\0" + u8"EcKeyAlgorithm\0" + u8"EcKeyGenParams\0" + u8"EcKeyImportParams\0" + u8"EcdhKeyDeriveParams\0" + u8"EcdsaParams\0" + u8"EffectTiming\0" + u8"ElementBasedOffset\0" + u8"ElementCreationOptions\0" + u8"ElementDefinitionOptions\0" + u8"ErrorEventInit\0" u8"EventHandler\0" + u8"EventInit\0" + u8"EventListenerOptions\0" + u8"EventModifierInit\0" + u8"EventSourceInit\0" + u8"ExtendableCookieChangeEventInit\0" + u8"ExtendableEventInit\0" + u8"ExtendableMessageEventInit\0" + u8"FederatedCredentialInit\0" + u8"FederatedCredentialRequestOptions\0" + u8"FetchEventInit\0" + u8"FilePickerAcceptType\0" + u8"FilePickerOptions\0" + u8"FilePropertyBag\0" + u8"FileSystemCreateWritableOptions\0" + u8"FileSystemFlags\0" + u8"FileSystemGetDirectoryOptions\0" + u8"FileSystemGetFileOptions\0" + u8"FileSystemHandlePermissionDescriptor\0" + u8"FileSystemPermissionDescriptor\0" + u8"FileSystemRemoveOptions\0" u8"FileSystemWriteChunkType\0" u8"Float32List\0" + u8"FocusEventInit\0" + u8"FocusOptions\0" + u8"FocusableAreasOption\0" + u8"FontFaceDescriptors\0" + u8"FontFaceSetLoadEventInit\0" u8"FormDataEntryValue\0" + u8"FormDataEventInit\0" u8"GLbitfield\0" u8"GLboolean\0" u8"GLbyte\0" @@ -1280,46 +1408,347 @@ const Char8 global_variables_web_types[] = u8"GLuint\0" u8"GLuint64\0" u8"GLushort\0" + u8"GainOptions\0" + u8"GamepadEventInit\0" + u8"GenerateTestReportParameters\0" u8"GeometryNode\0" + u8"GetAnimationsOptions\0" + u8"GetNotificationOptions\0" + u8"GetRootNodeOptions\0" + u8"GlobalDescriptor\0" + u8"GravityReadingValues\0" + u8"GyroscopeReadingValues\0" + u8"GyroscopeSensorOptions\0" + u8"HIDCollectionInfo\0" + u8"HIDConnectionEventInit\0" + u8"HIDDeviceFilter\0" + u8"HIDDeviceRequestOptions\0" + u8"HIDInputReportEventInit\0" + u8"HIDReportInfo\0" + u8"HIDReportItem\0" u8"HTMLOrSVGImageElement\0" u8"HTMLOrSVGScriptElement\0" u8"HTMLString\0" u8"HashAlgorithmIdentifier\0" + u8"HashChangeEventInit\0" u8"HeadersInit\0" + u8"HkdfParams\0" + u8"HmacImportParams\0" + u8"HmacKeyAlgorithm\0" + u8"HmacKeyGenParams\0" + u8"IDBDatabaseInfo\0" + u8"IDBIndexParameters\0" + u8"IDBObjectStoreParameters\0" + u8"IDBTransactionOptions\0" + u8"IDBVersionChangeEventInit\0" + u8"IIRFilterOptions\0" + u8"IdleRequestOptions\0" + u8"ImageBitmapOptions\0" + u8"ImageBitmapRenderingContextSettings\0" u8"ImageBitmapSource\0" + u8"ImageDataSettings\0" + u8"ImageEncodeOptions\0" + u8"InputDeviceCapabilitiesInit\0" + u8"InputEventInit\0" u8"Int32List\0" + u8"IntersectionObserverEntryInit\0" + u8"IntersectionObserverInit\0" + u8"JsonWebKey\0" + u8"KeyAlgorithm\0" + u8"KeySystemTrackConfiguration\0" + u8"KeyboardEventInit\0" + u8"KeyframeAnimationOptions\0" + u8"KeyframeEffectOptions\0" u8"LineAndPositionSetting\0" + u8"LinearAccelerationReadingValues\0" + u8"LockInfo\0" + u8"LockManagerSnapshot\0" + u8"LockOptions\0" + u8"MIDIConnectionEventInit\0" + u8"MIDIMessageEventInit\0" + u8"MIDIOptions\0" + u8"MediaCapabilitiesDecodingInfo\0" + u8"MediaCapabilitiesEncodingInfo\0" + u8"MediaCapabilitiesInfo\0" + u8"MediaCapabilitiesKeySystemConfiguration\0" + u8"MediaConfiguration\0" + u8"MediaDecodingConfiguration\0" + u8"MediaElementAudioSourceOptions\0" + u8"MediaEncodingConfiguration\0" + u8"MediaEncryptedEventInit\0" + u8"MediaImage\0" + u8"MediaKeyMessageEventInit\0" + u8"MediaKeySystemConfiguration\0" + u8"MediaKeySystemMediaCapability\0" + u8"MediaMetadataInit\0" + u8"MediaPositionState\0" u8"MediaProvider\0" + u8"MediaQueryListEventInit\0" + u8"MediaRecorderErrorEventInit\0" + u8"MediaRecorderOptions\0" + u8"MediaSessionActionDetails\0" + u8"MediaSettingsRange\0" + u8"MediaStreamAudioSourceOptions\0" + u8"MediaStreamConstraints\0" + u8"MediaStreamTrackAudioSourceOptions\0" + u8"MediaStreamTrackEventInit\0" + u8"MediaTrackCapabilities\0" + u8"MediaTrackConstraintSet\0" + u8"MediaTrackConstraints\0" + u8"MediaTrackSettings\0" + u8"MediaTrackSupportedConstraints\0" u8"Megabit\0" + u8"MemoryDescriptor\0" + u8"MessageEventInit\0" u8"MessageEventSource\0" + u8"MidiPermissionDescriptor\0" u8"Millisecond\0" + u8"MockSensor\0" + u8"MockSensorConfiguration\0" + u8"MockSensorReadingValues\0" + u8"ModuleExportDescriptor\0" + u8"ModuleImportDescriptor\0" + u8"MouseEventInit\0" + u8"MultiCacheQueryOptions\0" + u8"MutationObserverInit\0" u8"NamedCurve\0" + u8"NavigationEventInit\0" + u8"NavigationPreloadState\0" + u8"NavigatorUABrandVersion\0" + u8"NotificationAction\0" + u8"NotificationEventInit\0" + u8"NotificationOptions\0" + u8"OfflineAudioCompletionEventInit\0" + u8"OfflineAudioContextOptions\0" u8"OffscreenRenderingContext\0" u8"OnBeforeUnloadEventHandler\0" u8"OnErrorEventHandler\0" + u8"OpenFilePickerOptions\0" + u8"OptionalEffectTiming\0" + u8"OrientationSensorOptions\0" + u8"OscillatorOptions\0" + u8"PageTransitionEventInit\0" + u8"PannerOptions\0" + u8"PasswordCredentialData\0" u8"PasswordCredentialInit\0" + u8"PaymentCurrencyAmount\0" + u8"PaymentDetailsBase\0" + u8"PaymentDetailsInit\0" + u8"PaymentDetailsModifier\0" + u8"PaymentDetailsUpdate\0" + u8"PaymentItem\0" + u8"PaymentMethodChangeEventInit\0" + u8"PaymentMethodData\0" + u8"PaymentRequestUpdateEventInit\0" + u8"PaymentValidationErrors\0" + u8"Pbkdf2Params\0" u8"PerformanceEntryList\0" + u8"PerformanceMarkOptions\0" + u8"PerformanceMeasureOptions\0" + u8"PerformanceObserverCallbackOptions\0" + u8"PerformanceObserverInit\0" + u8"PeriodicSyncEventInit\0" + u8"PeriodicWaveConstraints\0" + u8"PeriodicWaveOptions\0" + u8"PermissionDescriptor\0" + u8"PermissionSetParameters\0" + u8"PhotoCapabilities\0" + u8"PhotoSettings\0" + u8"PictureInPictureEventInit\0" + u8"Point2D\0" + u8"PointerEventInit\0" + u8"PopStateEventInit\0" + u8"PositionOptions\0" + u8"PostMessageOptions\0" + u8"PresentationConnectionAvailableEventInit\0" + u8"PresentationConnectionCloseEventInit\0" + u8"ProgressEventInit\0" + u8"PromiseRejectionEventInit\0" + u8"PropertyDefinition\0" + u8"PublicKeyCredentialCreationOptions\0" + u8"PublicKeyCredentialDescriptor\0" + u8"PublicKeyCredentialEntity\0" + u8"PublicKeyCredentialParameters\0" + u8"PublicKeyCredentialRequestOptions\0" + u8"PublicKeyCredentialRpEntity\0" + u8"PublicKeyCredentialUserEntity\0" + u8"PushEventInit\0" u8"PushMessageDataInit\0" + u8"PushPermissionDescriptor\0" + u8"PushSubscriptionChangeEventInit\0" + u8"PushSubscriptionJSON\0" + u8"PushSubscriptionOptionsInit\0" + u8"QueuingStrategy\0" + u8"QueuingStrategyInit\0" + u8"RTCAnswerOptions\0" + u8"RTCCertificateExpiration\0" + u8"RTCConfiguration\0" + u8"RTCDTMFToneChangeEventInit\0" + u8"RTCDataChannelEventInit\0" + u8"RTCDataChannelInit\0" + u8"RTCDtlsFingerprint\0" + u8"RTCEncodedAudioFrameMetadata\0" + u8"RTCEncodedVideoFrameMetadata\0" + u8"RTCErrorEventInit\0" + u8"RTCErrorInit\0" + u8"RTCIceCandidateInit\0" + u8"RTCIceCandidatePair\0" + u8"RTCIceParameters\0" + u8"RTCIceServer\0" + u8"RTCInsertableStreams\0" + u8"RTCLocalSessionDescriptionInit\0" + u8"RTCOfferAnswerOptions\0" + u8"RTCOfferOptions\0" + u8"RTCPeerConnectionIceErrorEventInit\0" + u8"RTCPeerConnectionIceEventInit\0" + u8"RTCRtcpParameters\0" + u8"RTCRtpCapabilities\0" + u8"RTCRtpCodecCapability\0" + u8"RTCRtpCodecParameters\0" + u8"RTCRtpCodingParameters\0" + u8"RTCRtpContributingSource\0" + u8"RTCRtpDecodingParameters\0" + u8"RTCRtpEncodingParameters\0" + u8"RTCRtpHeaderExtensionCapability\0" + u8"RTCRtpHeaderExtensionParameters\0" + u8"RTCRtpParameters\0" + u8"RTCRtpReceiveParameters\0" + u8"RTCRtpSendParameters\0" + u8"RTCRtpSynchronizationSource\0" + u8"RTCRtpTransceiverInit\0" u8"RTCRtpTransform\0" + u8"RTCSessionDescriptionInit\0" + u8"RTCStats\0" + u8"RTCTrackEventInit\0" + u8"ReadableStreamBYOBReadResult\0" u8"ReadableStreamController\0" + u8"ReadableStreamDefaultReadResult\0" + u8"ReadableStreamGetReaderOptions\0" + u8"ReadableStreamIteratorOptions\0" u8"ReadableStreamReader\0" + u8"ReadableWritablePair\0" + u8"RegistrationOptions\0" + u8"RelativeOrientationReadingValues\0" u8"RenderingContext\0" u8"ReportList\0" + u8"ReportingObserverOptions\0" u8"RequestInfo\0" + u8"RequestInit\0" + u8"ResizeObserverOptions\0" + u8"ResponseInit\0" u8"RotationMatrixType\0" + u8"RsaHashedImportParams\0" + u8"RsaHashedKeyAlgorithm\0" + u8"RsaHashedKeyGenParams\0" + u8"RsaKeyAlgorithm\0" + u8"RsaKeyGenParams\0" + u8"RsaOaepParams\0" + u8"RsaOtherPrimesInfo\0" + u8"RsaPssParams\0" + u8"SFrameTransformErrorEventInit\0" + u8"SFrameTransformOptions\0" + u8"SVGBoundingBoxOptions\0" + u8"SaveFilePickerOptions\0" u8"ScriptString\0" u8"ScriptURLString\0" + u8"ScrollIntoViewOptions\0" + u8"ScrollOptions\0" u8"ScrollTimelineOffset\0" + u8"ScrollTimelineOptions\0" + u8"ScrollToOptions\0" + u8"SecurityPolicyViolationEventInit\0" + u8"SensorErrorEventInit\0" + u8"SensorOptions\0" + u8"SerialInputSignals\0" + u8"SerialOptions\0" + u8"SerialOutputSignals\0" + u8"SerialPortFilter\0" + u8"SerialPortInfo\0" + u8"SerialPortRequestOptions\0" + u8"ShadowRootInit\0" u8"SmallCryptoKeyID\0" + u8"SpatialNavigationSearchOptions\0" + u8"SpeechRecognitionErrorEventInit\0" + u8"SpeechRecognitionEventInit\0" + u8"SpeechSynthesisErrorEventInit\0" + u8"SpeechSynthesisEventInit\0" u8"StartInDirectory\0" + u8"StaticRangeInit\0" + u8"StereoPannerOptions\0" + u8"StorageEstimate\0" + u8"StorageEventInit\0" + u8"StreamPipeOptions\0" + u8"SubmitEventInit\0" + u8"SyncEventInit\0" + u8"TableDescriptor\0" u8"TexImageSource\0" + u8"TextDecodeOptions\0" + u8"TextDecoderOptions\0" + u8"TextEncoderEncodeIntoResult\0" u8"TimerHandler\0" + u8"TokenBinding\0" + u8"TouchEventInit\0" + u8"TouchInit\0" + u8"TrackEventInit\0" + u8"Transformer\0" + u8"TransitionEventInit\0" u8"TrustedTimerHandler\0" u8"TrustedType\0" + u8"TrustedTypePolicyOptions\0" + u8"UADataValues\0" + u8"UALowEntropyJSON\0" + u8"UIEventInit\0" + u8"ULongRange\0" + u8"USBConnectionEventInit\0" + u8"USBControlTransferParameters\0" + u8"USBDeviceFilter\0" + u8"USBDeviceRequestOptions\0" + u8"USBPermissionDescriptor\0" + u8"USBPermissionStorage\0" u8"Uint32List\0" + u8"UnderlyingSink\0" + u8"UnderlyingSource\0" u8"UvmEntries\0" u8"UvmEntry\0" + u8"ValidityStateFlags\0" + u8"VideoConfiguration\0" + u8"WaveShaperOptions\0" + u8"WebAssemblyInstantiatedSource\0" + u8"WebGLContextAttributes\0" + u8"WebGLContextEventInit\0" + u8"WheelEventInit\0" + u8"WindowPostMessageOptions\0" + u8"WorkerOptions\0" + u8"WorkletOptions\0" + u8"WriteParams\0" u8"XMLHttpRequestBodyInit\0" + u8"XRCubeLayerInit\0" + u8"XRCylinderLayerInit\0" + u8"XRDOMOverlayInit\0" + u8"XRDOMOverlayState\0" + u8"XRDepthStateInit\0" + u8"XREquirectLayerInit\0" + u8"XRHitTestOptionsInit\0" + u8"XRInputSourceEventInit\0" + u8"XRInputSourcesChangeEventInit\0" + u8"XRLayerEventInit\0" + u8"XRLayerInit\0" + u8"XRLightProbeInit\0" + u8"XRMediaCylinderLayerInit\0" + u8"XRMediaEquirectLayerInit\0" + u8"XRMediaLayerInit\0" + u8"XRMediaQuadLayerInit\0" + u8"XRPermissionDescriptor\0" + u8"XRProjectionLayerInit\0" + u8"XRQuadLayerInit\0" + u8"XRRayDirectionInit\0" + u8"XRReferenceSpaceEventInit\0" + u8"XRRenderStateInit\0" + u8"XRSessionEventInit\0" + u8"XRSessionInit\0" + u8"XRSessionSupportedPermissionDescriptor\0" + u8"XRTransientInputHitTestOptionsInit\0" + u8"XRWebGLLayerInit\0" u8"XRWebGLRenderingContext\0"; } diff --git a/tools/browser-globals/index.js b/tools/browser-globals/index.js index cd86da2f3e..02edc76433 100644 --- a/tools/browser-globals/index.js +++ b/tools/browser-globals/index.js @@ -232,11 +232,11 @@ function collectExposedGlobals(globals, idlObject, allIDLObjects) { break; case "callback": - case "dictionary": case "enum": case "interface mixin": break; + case "dictionary": case "typedef": globals.addGlobal("types", idlObject.name); break;