Enforce node: schema for builtins, import extensions

This commit is contained in:
Fedor Indutny
2025-09-16 17:39:03 -07:00
committed by GitHub
parent cc6b8795b8
commit c02565eaa8
2096 changed files with 14955 additions and 14023 deletions

View File

@@ -2,8 +2,8 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { useEffect, useMemo } from 'react';
import type { AciString } from '../types/ServiceId';
import { usePrevious } from './usePrevious';
import type { AciString } from '../types/ServiceId.js';
import { usePrevious } from './usePrevious.js';
type RemoteParticipant = {
hasRemoteVideo: boolean;

View File

@@ -4,7 +4,7 @@
import { useState, useCallback } from 'react';
import type { SpringValues } from '@react-spring/web';
import { useChain, useSpring, useSpringRef } from '@react-spring/web';
import { useReducedMotion } from './useReducedMotion';
import { useReducedMotion } from './useReducedMotion.js';
export type ModalConfigType = {
opacity: number;

View File

@@ -3,8 +3,8 @@
import { noop } from 'lodash';
import { useEffect, useState } from 'react';
import { computePeaks } from '../components/VoiceNotesPlaybackContext';
import { createLogger } from '../logging/log';
import { computePeaks } from '../components/VoiceNotesPlaybackContext.js';
import { createLogger } from '../logging/log.js';
const log = createLogger('useComputePeaks');

View File

@@ -3,15 +3,15 @@
import React, { useEffect, useRef, useState } from 'react';
import { ConfirmDiscardDialog } from '../components/ConfirmDiscardDialog';
import { BeforeNavigateResponse } from '../services/BeforeNavigate';
import { ConfirmDiscardDialog } from '../components/ConfirmDiscardDialog.js';
import { BeforeNavigateResponse } from '../services/BeforeNavigate.js';
import {
explodePromise,
type ExplodePromiseResultType,
} from '../util/explodePromise';
} from '../util/explodePromise.js';
import type { ConfirmDialogProps } from '../components/ConfirmDiscardDialog';
import type { LocalizerType } from '../types/Util';
import type { ConfirmDialogProps } from '../components/ConfirmDiscardDialog.js';
import type { LocalizerType } from '../types/Util.js';
export function useConfirmDiscard({
i18n,

View File

@@ -1,16 +1,15 @@
// Copyright 2025 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { FormatterToken } from '@signalapp/minimask';
import {
minimask,
type Formatter,
createCreditCardExpirationFormatter,
} from '@signalapp/minimask';
import type { FormatterToken, Formatter } from '@signalapp/minimask';
import type { RefObject } from 'react';
import { useEffect } from 'react';
import creditCardType from 'credit-card-type';
import { strictAssert } from '../util/assert';
import { strictAssert } from '../util/assert.js';
export function useInputMask(
inputRef: RefObject<HTMLInputElement>,

View File

@@ -2,7 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { useCallback, useRef, useState } from 'react';
import { createLogger } from '../logging/log';
import { createLogger } from '../logging/log.js';
const log = createLogger('useIntersectionObserver');

View File

@@ -4,11 +4,11 @@
import { useCallback, useEffect } from 'react';
import { get } from 'lodash';
import { useSelector } from 'react-redux';
import * as KeyboardLayout from '../services/keyboardLayout';
import { getHasPanelOpen } from '../state/selectors/conversations';
import { isInFullScreenCall } from '../state/selectors/calling';
import { isShowingAnyModal } from '../state/selectors/globalModals';
import type { ContextMenuTriggerType } from '../components/conversation/MessageContextMenu';
import * as KeyboardLayout from '../services/keyboardLayout.js';
import { getHasPanelOpen } from '../state/selectors/conversations.js';
import { isInFullScreenCall } from '../state/selectors/calling.js';
import { isShowingAnyModal } from '../state/selectors/globalModals.js';
import type { ContextMenuTriggerType } from '../components/conversation/MessageContextMenu.js';
type KeyboardShortcutHandlerType = (ev: KeyboardEvent) => boolean;

View File

@@ -1,7 +1,7 @@
// Copyright 2024 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { useMemo } from 'react';
import type { ConversationType } from '../state/ducks/conversations';
import type { ConversationType } from '../state/ducks/conversations.js';
type Primitive = undefined | null | boolean | number | bigint | string;
type PrimitiveObject = Record<string, Primitive>;

View File

@@ -1,14 +1,13 @@
// Copyright 2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { EventEmitter } from 'events';
import { useEffect, useState } from 'react';
import { MINUTE } from '../util/durations';
import { MINUTE } from '../util/durations/index.js';
const ev = new EventEmitter();
ev.setMaxListeners(Infinity);
setInterval(() => ev.emit('tick'), MINUTE);
const listeners = new Set<() => void>();
let timer: ReturnType<typeof setInterval> | undefined;
export function useNowThatUpdatesEveryMinute(): number {
const [now, setNow] = useState(Date.now());
@@ -17,10 +16,21 @@ export function useNowThatUpdatesEveryMinute(): number {
const updateNow = () => setNow(Date.now());
updateNow();
ev.on('tick', updateNow);
if (listeners.size === 0 && timer == null) {
timer = setInterval(() => {
for (const fn of listeners) {
fn();
}
}, MINUTE);
}
listeners.add(updateNow);
return () => {
ev.off('tick', updateNow);
listeners.delete(updateNow);
if (listeners.size === 0 && timer != null) {
clearInterval(timer);
timer = undefined;
}
};
}, []);

View File

@@ -5,7 +5,7 @@ import { useCallback, useMemo } from 'react';
import { useSelector } from 'react-redux';
import { memoize } from '@indutny/sneequals';
import type { StateType } from '../state/reducer';
import type { StateType } from '../state/reducer.js';
export function useProxySelector<Params extends Array<unknown>, Result>(
selector: (state: StateType, ...params: Params) => Result,

View File

@@ -2,7 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { useMemo } from 'react';
import { createRefMerger } from '../util/refMerger';
import { createRefMerger } from '../util/refMerger.js';
export const useRefMerger = (): ReturnType<typeof createRefMerger> =>
useMemo(createRefMerger, []);

View File

@@ -3,10 +3,10 @@
import React, { useState, useEffect } from 'react';
import type { LocalizerType } from '../types/Util';
import { Alert } from '../components/Alert';
import { ResolvedSendStatus } from '../types/Stories';
import { usePrevious } from './usePrevious';
import type { LocalizerType } from '../types/Util.js';
import { Alert } from '../components/Alert.js';
import { ResolvedSendStatus } from '../types/Stories.js';
import { usePrevious } from './usePrevious.js';
export function useRetryStorySend(
i18n: LocalizerType,

View File

@@ -2,7 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { useContext, createContext, useEffect, useRef } from 'react';
import { createLogger } from '../logging/log';
import { createLogger } from '../logging/log.js';
const log = createLogger('useScrollLock');

View File

@@ -2,7 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import type { RefObject } from 'react';
import { useCallback, useEffect, useRef, useState } from 'react';
import { strictAssert } from '../util/assert';
import { strictAssert } from '../util/assert.js';
export type Size = Readonly<{
width: number;

View File

@@ -4,8 +4,8 @@
import type { KeyboardEvent } from 'react';
import React, { useState } from 'react';
import classNames from 'classnames';
import { assertDev } from '../util/assert';
import { getClassNamesFor } from '../util/getClassNamesFor';
import { assertDev } from '../util/assert.js';
import { getClassNamesFor } from '../util/getClassNamesFor.js';
type Tab = {
id: string;

View File

@@ -3,7 +3,7 @@
import { useState, useEffect } from 'react';
import { ThemeType } from '../types/Util';
import { ThemeType } from '../types/Util.js';
// Note that this hook is used in non-main windows (e.g. "About" and
// "Debug Log" windows), and thus can't access redux state.