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

@@ -3,15 +3,15 @@
import { assert } from 'chai';
import * as Attachment from '../../types/Attachment';
import * as MIME from '../../types/MIME';
import { SignalService } from '../../protobuf';
import * as Bytes from '../../Bytes';
import { createLogger } from '../../logging/log';
import * as Attachment from '../../types/Attachment.js';
import * as MIME from '../../types/MIME.js';
import { SignalService } from '../../protobuf/index.js';
import * as Bytes from '../../Bytes.js';
import { createLogger } from '../../logging/log.js';
import { fakeAttachment } from '../../test-helpers/fakeAttachment';
import { DAY } from '../../util/durations';
import { migrateDataToFileSystem } from '../../util/attachments/migrateDataToFilesystem';
import { fakeAttachment } from '../../test-helpers/fakeAttachment.js';
import { DAY } from '../../util/durations/index.js';
import { migrateDataToFileSystem } from '../../util/attachments/migrateDataToFilesystem.js';
const logger = createLogger('Attachment_test');

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { getDefaultAvatars } from '../../types/Avatar';
import { getDefaultAvatars } from '../../types/Avatar.js';
describe('Avatar', () => {
describe('getDefaultAvatars', () => {

View File

@@ -5,7 +5,7 @@ import { assert } from 'chai';
import type {
HydratedBodyRangeMention,
RangeNode,
} from '../../types/BodyRange';
} from '../../types/BodyRange.js';
import {
BodyRange,
DisplayStyle,
@@ -15,8 +15,8 @@ import {
insertRange,
processBodyRangesForSearchResult,
trimMessageWhitespace,
} from '../../types/BodyRange';
import { generateAci } from '../../types/ServiceId';
} from '../../types/BodyRange.js';
import { generateAci } from '../../types/ServiceId.js';
const SERVICE_ID_1 = generateAci();
const SERVICE_ID_2 = generateAci();

View File

@@ -6,7 +6,7 @@ import type {
CardFormFields,
CardFormResult,
CardFormSettings,
} from '../../types/DonationsCardForm';
} from '../../types/DonationsCardForm.js';
import {
CardCvcError,
CardExpirationError,
@@ -19,8 +19,8 @@ import {
parseCardExpiration,
parseCardForm,
parseCardNumber,
} from '../../types/DonationsCardForm';
import type { CardDetail } from '../../types/Donations';
} from '../../types/DonationsCardForm.js';
import type { CardDetail } from '../../types/Donations.js';
function testCard(cardNumber: string, cvcSize: number) {
return { cardNumber, cvcSize };

View File

@@ -4,10 +4,10 @@
import { assert } from 'chai';
import * as sinon from 'sinon';
import { createLogger } from '../../logging/log';
import { IMAGE_GIF, IMAGE_PNG } from '../../types/MIME';
import type { MessageAttributesType } from '../../model-types.d';
import type { Avatar, Email, Phone } from '../../types/EmbeddedContact';
import { createLogger } from '../../logging/log.js';
import { IMAGE_GIF, IMAGE_PNG } from '../../types/MIME.js';
import type { MessageAttributesType } from '../../model-types.d.ts';
import type { Avatar, Email, Phone } from '../../types/EmbeddedContact.js';
import {
_validate,
ContactFormType,
@@ -15,9 +15,9 @@ import {
getName,
parseAndWriteAvatar,
parsePhoneItem,
} from '../../types/EmbeddedContact';
import { fakeAttachment } from '../../test-helpers/fakeAttachment';
import { generateAci } from '../../types/ServiceId';
} from '../../types/EmbeddedContact.js';
import { fakeAttachment } from '../../test-helpers/fakeAttachment.js';
import { generateAci } from '../../types/ServiceId.js';
const logger = createLogger('EmbeddedContact_test');

View File

@@ -9,7 +9,7 @@ import {
isValidLink,
shouldLinkifyMessage,
shouldPreviewHref,
} from '../../types/LinkPreview';
} from '../../types/LinkPreview.js';
describe('Link previews', () => {
describe('#isValidLink', () => {

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import * as MIME from '../../types/MIME';
import * as MIME from '../../types/MIME.js';
describe('MIME', () => {
describe('isGif', () => {

View File

@@ -4,19 +4,19 @@
import { assert } from 'chai';
import * as sinon from 'sinon';
import * as Message from '../../types/Message2';
import { SignalService } from '../../protobuf';
import * as Bytes from '../../Bytes';
import * as MIME from '../../types/MIME';
import * as Message from '../../types/Message2.js';
import { SignalService } from '../../protobuf/index.js';
import * as Bytes from '../../Bytes.js';
import * as MIME from '../../types/MIME.js';
import type { EmbeddedContactType } from '../../types/EmbeddedContact';
import type { MessageAttributesType } from '../../model-types.d';
import type { EmbeddedContactType } from '../../types/EmbeddedContact.js';
import type { MessageAttributesType } from '../../model-types.d.ts';
import type {
AddressableAttachmentType,
AttachmentType,
LocalAttachmentV2Type,
} from '../../types/Attachment';
import type { LoggerType } from '../../types/Logging';
} from '../../types/Attachment.js';
import type { LoggerType } from '../../types/Logging.js';
const FAKE_LOCAL_ATTACHMENT: LocalAttachmentV2Type = {
version: 2,

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { DAY, HOUR, MINUTE } from '../../util/durations';
import { DAY, HOUR, MINUTE } from '../../util/durations/index.js';
import {
DayOfWeek,
@@ -12,13 +12,13 @@ import {
getMidnight,
loopThroughWeek,
sortProfiles,
} from '../../types/NotificationProfile';
import { generateNotificationProfileId } from '../../types/NotificationProfile-node';
} from '../../types/NotificationProfile.js';
import { generateNotificationProfileId } from '../../types/NotificationProfile-node.js';
import type {
NextProfileEvent,
NotificationProfileType,
} from '../../types/NotificationProfile';
} from '../../types/NotificationProfile.js';
describe('NotificationProfile', () => {
const startingTime = Date.now();

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { getCountryCode } from '../../types/PhoneNumber';
import { getCountryCode } from '../../types/PhoneNumber.js';
describe('types/PhoneNumber', () => {
describe('#getCountryCode', () => {

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { isValid } from '../../types/SchemaVersion';
import { isValid } from '../../types/SchemaVersion.js';
describe('SchemaVersion', () => {
describe('isValid', () => {

View File

@@ -1,13 +1,13 @@
// Copyright 2018 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import os from 'os';
import os from 'node:os';
import Sinon from 'sinon';
import { assert } from 'chai';
import { getOSFunctions } from '../../util/os/shared';
import * as Settings from '../../types/Settings';
import { SystemTraySetting } from '../../types/SystemTraySetting';
import { getOSFunctions } from '../../util/os/shared.js';
import * as Settings from '../../types/Settings.js';
import { SystemTraySetting } from '../../types/SystemTraySetting.js';
describe('Settings', () => {
let sandbox: Sinon.SinonSandbox;

View File

@@ -2,7 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import * as Stickers from '../../types/Stickers';
import * as Stickers from '../../types/Stickers.js';
describe('Stickers', () => {
describe('getDataFromLink', () => {

View File

@@ -5,8 +5,8 @@ import { assert } from 'chai';
import { v4 as generateUuid } from 'uuid';
import * as sinon from 'sinon';
import type { LoggerType } from '../../types/Logging';
import { normalizeStoryDistributionId } from '../../types/StoryDistributionId';
import type { LoggerType } from '../../types/Logging.js';
import { normalizeStoryDistributionId } from '../../types/StoryDistributionId.js';
describe('StoryDistributionId', () => {
let warn: sinon.SinonStub;

View File

@@ -7,7 +7,7 @@ import {
SystemTraySetting,
parseSystemTraySetting,
shouldMinimizeToSystemTray,
} from '../../types/SystemTraySetting';
} from '../../types/SystemTraySetting.js';
describe('system tray setting utilities', () => {
describe('shouldMinimizeToSystemTray', () => {

View File

@@ -1,9 +1,9 @@
// Copyright 2018 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import * as Path from 'path';
import * as Path from 'node:path';
import { assert } from 'chai';
import * as Errors from '../../types/errors';
import * as Errors from '../../types/errors.js';
const APP_ROOT_PATH = Path.join(__dirname, '..', '..', '..');

View File

@@ -2,8 +2,8 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import type { LocalizerType } from '../../types/Util';
import { setupI18n } from '../../util/setupI18n';
import type { LocalizerType } from '../../types/Util.js';
import { setupI18n } from '../../util/setupI18n.js';
import * as enMessages from '../../../_locales/en/messages.json';
describe('setupI18n', () => {