Skip to content

Commit ff1db2b

Browse files
authored
Bump eslint-plugin-matrix-org to enable @typescript-eslint/consistent-type-imports rule (#4680)
* Bump eslint-plugin-matrix-org to enable @typescript-eslint/consistent-type-imports rule * Re-lint after merge
1 parent 6e72b35 commit ff1db2b

File tree

297 files changed

+1760
-1571
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

297 files changed

+1760
-1571
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
"eslint-plugin-import": "^2.26.0",
102102
"eslint-plugin-jest": "^28.0.0",
103103
"eslint-plugin-jsdoc": "^50.0.0",
104-
"eslint-plugin-matrix-org": "^2.0.1",
104+
"eslint-plugin-matrix-org": "^2.1.0",
105105
"eslint-plugin-n": "^14.0.0",
106106
"eslint-plugin-tsdoc": "^0.4.0",
107107
"eslint-plugin-unicorn": "^56.0.0",

spec/TestClient.ts

+9-4
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,16 @@ import type { IE2EKeyReceiver } from "./test-utils/E2EKeyReceiver";
2929
import { LocalStorageCryptoStore } from "../src/crypto/store/localStorage-crypto-store";
3030
import { logger } from "../src/logger";
3131
import { syncPromise } from "./test-utils/test-utils";
32-
import { createClient, IStartClientOpts } from "../src/matrix";
33-
import { ICreateClientOpts, IDownloadKeyResult, MatrixClient, PendingEventOrdering } from "../src/client";
32+
import { createClient, type IStartClientOpts } from "../src/matrix";
33+
import {
34+
type ICreateClientOpts,
35+
type IDownloadKeyResult,
36+
type MatrixClient,
37+
PendingEventOrdering,
38+
} from "../src/client";
3439
import { MockStorageApi } from "./MockStorageApi";
35-
import { IKeysUploadResponse, IUploadKeysRequest } from "../src/client";
36-
import { ISyncResponder } from "./test-utils/SyncResponder";
40+
import { type IKeysUploadResponse, type IUploadKeysRequest } from "../src/client";
41+
import { type ISyncResponder } from "./test-utils/SyncResponder";
3742

3843
/**
3944
* Wrapper for a MockStorageApi, MockHttpBackend and MatrixClient

spec/integ/crypto/cross-signing.spec.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ import fetchMock from "fetch-mock-jest";
1818
import "fake-indexeddb/auto";
1919
import { IDBFactory } from "fake-indexeddb";
2020

21-
import { CRYPTO_BACKENDS, InitCrypto, syncPromise } from "../../test-utils/test-utils";
22-
import { AuthDict, createClient, CryptoEvent, MatrixClient } from "../../../src";
21+
import { CRYPTO_BACKENDS, type InitCrypto, syncPromise } from "../../test-utils/test-utils";
22+
import { type AuthDict, createClient, CryptoEvent, type MatrixClient } from "../../../src";
2323
import { mockInitialApiRequests, mockSetupCrossSigningRequests } from "../../test-utils/mockEndpoints";
2424
import encryptAESSecretStorageItem from "../../../src/utils/encryptAESSecretStorageItem.ts";
25-
import { CryptoCallbacks, CrossSigningKey } from "../../../src/crypto-api";
25+
import { type CryptoCallbacks, CrossSigningKey } from "../../../src/crypto-api";
2626
import { SECRET_STORAGE_ALGORITHM_V1_AES } from "../../../src/secret-storage";
27-
import { ISyncResponder, SyncResponder } from "../../test-utils/SyncResponder";
27+
import { type ISyncResponder, SyncResponder } from "../../test-utils/SyncResponder";
2828
import { E2EKeyReceiver } from "../../test-utils/E2EKeyReceiver";
2929
import {
3030
MASTER_CROSS_SIGNING_PRIVATE_KEY_BASE64,

spec/integ/crypto/crypto.spec.ts

+17-17
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ import anotherjson from "another-json";
1919
import fetchMock from "fetch-mock-jest";
2020
import "fake-indexeddb/auto";
2121
import { IDBFactory } from "fake-indexeddb";
22-
import FetchMock from "fetch-mock";
23-
import Olm from "@matrix-org/olm";
2422

23+
import type FetchMock from "fetch-mock";
24+
import type Olm from "@matrix-org/olm";
2525
import * as testUtils from "../../test-utils/test-utils";
2626
import {
2727
advanceTimersUntil,
2828
CRYPTO_BACKENDS,
2929
emitPromise,
3030
getSyncResponse,
31-
InitCrypto,
31+
type InitCrypto,
3232
mkEventCustom,
3333
mkMembershipCustom,
3434
syncPromise,
@@ -52,24 +52,24 @@ import {
5252
createClient,
5353
CryptoEvent,
5454
HistoryVisibility,
55-
IClaimOTKsResult,
56-
IContent,
57-
IDownloadKeyResult,
58-
IEvent,
55+
type IClaimOTKsResult,
56+
type IContent,
57+
type IDownloadKeyResult,
58+
type IEvent,
5959
IndexedDBCryptoStore,
60-
IStartClientOpts,
61-
MatrixClient,
60+
type IStartClientOpts,
61+
type MatrixClient,
6262
MatrixEvent,
6363
MatrixEventEvent,
6464
MsgType,
6565
PendingEventOrdering,
6666
Room,
67-
RoomMember,
67+
type RoomMember,
6868
RoomStateEvent,
6969
} from "../../../src/matrix";
7070
import { DeviceInfo } from "../../../src/crypto/deviceinfo";
7171
import { E2EKeyReceiver } from "../../test-utils/E2EKeyReceiver";
72-
import { ISyncResponder, SyncResponder } from "../../test-utils/SyncResponder";
72+
import { type ISyncResponder, SyncResponder } from "../../test-utils/SyncResponder";
7373
import { defer, escapeRegExp } from "../../../src/utils";
7474
import { downloadDeviceToJsDevice } from "../../../src/rust-crypto/device-converter";
7575
import { flushPromises } from "../../test-utils/flushPromises";
@@ -78,15 +78,15 @@ import {
7878
mockSetupCrossSigningRequests,
7979
mockSetupMegolmBackupRequests,
8080
} from "../../test-utils/mockEndpoints";
81-
import { SecretStorageKeyDescription } from "../../../src/secret-storage";
81+
import { type SecretStorageKeyDescription } from "../../../src/secret-storage";
8282
import {
8383
CrossSigningKey,
84-
CryptoCallbacks,
84+
type CryptoCallbacks,
8585
DecryptionFailureCode,
86-
DeviceIsolationMode,
86+
type DeviceIsolationMode,
8787
EventShieldColour,
8888
EventShieldReason,
89-
KeyBackupInfo,
89+
type KeyBackupInfo,
9090
AllDevicesIsolationMode,
9191
OnlySignedDevicesIsolationMode,
9292
} from "../../../src/crypto-api";
@@ -101,11 +101,11 @@ import {
101101
establishOlmSession,
102102
getTestOlmAccountKeys,
103103
} from "./olm-utils";
104-
import { ToDevicePayload } from "../../../src/models/ToDeviceMessage";
104+
import { type ToDevicePayload } from "../../../src/models/ToDeviceMessage";
105105
import { AccountDataAccumulator } from "../../test-utils/AccountDataAccumulator";
106106
import { UNSIGNED_MEMBERSHIP_FIELD } from "../../../src/@types/event";
107107
import { KnownMembership } from "../../../src/@types/membership";
108-
import { KeyBackup } from "../../../src/rust-crypto/backup.ts";
108+
import { type KeyBackup } from "../../../src/rust-crypto/backup.ts";
109109

110110
afterEach(() => {
111111
// reset fake-indexeddb after each test, to make sure we don't leak connections

spec/integ/crypto/device-dehydration.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ limitations under the License.
1717
import "fake-indexeddb/auto";
1818
import fetchMock from "fetch-mock-jest";
1919

20-
import { ClientEvent, createClient, MatrixClient, MatrixEvent } from "../../../src";
20+
import { ClientEvent, createClient, type MatrixClient, MatrixEvent } from "../../../src";
2121
import { CryptoEvent } from "../../../src/crypto-api/index";
22-
import { RustCrypto } from "../../../src/rust-crypto/rust-crypto";
23-
import { AddSecretStorageKeyOpts } from "../../../src/secret-storage";
22+
import { type RustCrypto } from "../../../src/rust-crypto/rust-crypto";
23+
import { type AddSecretStorageKeyOpts } from "../../../src/secret-storage";
2424
import { E2EKeyReceiver } from "../../test-utils/E2EKeyReceiver";
2525
import { E2EKeyResponder } from "../../test-utils/E2EKeyResponder";
2626
import { emitPromise, EventCounter } from "../../test-utils/test-utils";

spec/integ/crypto/megolm-backup.spec.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ limitations under the License.
1717
import fetchMock from "fetch-mock-jest";
1818
import "fake-indexeddb/auto";
1919
import { IDBFactory } from "fake-indexeddb";
20-
import { Mocked } from "jest-mock";
20+
import { type Mocked } from "jest-mock";
2121

2222
import {
2323
createClient,
24-
Crypto,
24+
type Crypto,
2525
encodeBase64,
26-
ICreateClientOpts,
27-
IEvent,
28-
IMegolmSessionData,
29-
MatrixClient,
26+
type ICreateClientOpts,
27+
type IEvent,
28+
type IMegolmSessionData,
29+
type MatrixClient,
3030
TypedEventEmitter,
3131
} from "../../../src";
3232
import { SyncResponder } from "../../test-utils/SyncResponder";
@@ -37,15 +37,15 @@ import {
3737
advanceTimersUntil,
3838
awaitDecryption,
3939
CRYPTO_BACKENDS,
40-
InitCrypto,
40+
type InitCrypto,
4141
syncPromise,
4242
} from "../../test-utils/test-utils";
4343
import * as testData from "../../test-utils/test-data";
44-
import { KeyBackupInfo, KeyBackupSession } from "../../../src/crypto-api/keybackup";
44+
import { type KeyBackupInfo, type KeyBackupSession } from "../../../src/crypto-api/keybackup";
4545
import { flushPromises } from "../../test-utils/flushPromises";
46-
import { defer, IDeferred } from "../../../src/utils";
46+
import { defer, type IDeferred } from "../../../src/utils";
4747
import { decodeRecoveryKey, DecryptionFailureCode, CryptoEvent } from "../../../src/crypto-api";
48-
import { KeyBackup } from "../../../src/rust-crypto/backup.ts";
48+
import { type KeyBackup } from "../../../src/rust-crypto/backup.ts";
4949

5050
const ROOM_ID = testData.TEST_ROOM_ID;
5151

spec/integ/crypto/olm-encryption-spec.ts

+14-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,20 @@ import type { IDeviceKeys, IOneTimeKey } from "../../../src/@types/crypto";
3333
import { logger } from "../../../src/logger";
3434
import * as testUtils from "../../test-utils/test-utils";
3535
import { TestClient } from "../../TestClient";
36-
import { CRYPTO_ENABLED, IClaimKeysRequest, IQueryKeysRequest, IUploadKeysRequest } from "../../../src/client";
37-
import { ClientEvent, IContent, ISendEventResponse, MatrixClient, MatrixEvent, MsgType } from "../../../src/matrix";
36+
import {
37+
CRYPTO_ENABLED,
38+
type IClaimKeysRequest,
39+
type IQueryKeysRequest,
40+
type IUploadKeysRequest,
41+
} from "../../../src/client";
42+
import {
43+
ClientEvent,
44+
type IContent,
45+
type ISendEventResponse,
46+
type MatrixClient,
47+
MatrixEvent,
48+
MsgType,
49+
} from "../../../src/matrix";
3850
import { DeviceInfo } from "../../../src/crypto/deviceinfo";
3951
import { KnownMembership } from "../../../src/@types/membership";
4052

spec/integ/crypto/olm-utils.ts

+12-4
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,19 @@ limitations under the License.
1717
import Olm from "@matrix-org/olm";
1818
import anotherjson from "another-json";
1919

20-
import { IContent, IDeviceKeys, IDownloadKeyResult, IEvent, Keys, MatrixClient, SigningKeys } from "../../../src";
21-
import { IE2EKeyReceiver } from "../../test-utils/E2EKeyReceiver";
22-
import { ISyncResponder } from "../../test-utils/SyncResponder";
20+
import {
21+
type IContent,
22+
type IDeviceKeys,
23+
type IDownloadKeyResult,
24+
type IEvent,
25+
type Keys,
26+
type MatrixClient,
27+
type SigningKeys,
28+
} from "../../../src";
29+
import { type IE2EKeyReceiver } from "../../test-utils/E2EKeyReceiver";
30+
import { type ISyncResponder } from "../../test-utils/SyncResponder";
2331
import { syncPromise } from "../../test-utils/test-utils";
24-
import { KeyBackupInfo } from "../../../src/crypto-api";
32+
import { type KeyBackupInfo } from "../../../src/crypto-api";
2533

2634
/**
2735
* @module

spec/integ/crypto/to-device-messages.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import fetchMock from "fetch-mock-jest";
1818
import "fake-indexeddb/auto";
1919
import { IDBFactory } from "fake-indexeddb";
2020

21-
import { CRYPTO_BACKENDS, getSyncResponse, InitCrypto, syncPromise } from "../../test-utils/test-utils";
22-
import { createClient, MatrixClient } from "../../../src";
21+
import { CRYPTO_BACKENDS, getSyncResponse, type InitCrypto, syncPromise } from "../../test-utils/test-utils";
22+
import { createClient, type MatrixClient } from "../../../src";
2323
import * as testData from "../../test-utils/test-data";
2424
import { E2EKeyResponder } from "../../test-utils/E2EKeyResponder";
2525
import { SyncResponder } from "../../test-utils/SyncResponder";

spec/integ/crypto/verification.spec.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,31 @@ limitations under the License.
1717
import "fake-indexeddb/auto";
1818

1919
import anotherjson from "another-json";
20-
import FetchMock from "fetch-mock";
2120
import fetchMock from "fetch-mock-jest";
2221
import { IDBFactory } from "fake-indexeddb";
2322
import { createHash } from "crypto";
2423
import Olm from "@matrix-org/olm";
2524

25+
import type FetchMock from "fetch-mock";
2626
import {
2727
createClient,
2828
CryptoEvent,
2929
DeviceVerification,
30-
IContent,
31-
ICreateClientOpts,
32-
IEvent,
33-
MatrixClient,
30+
type IContent,
31+
type ICreateClientOpts,
32+
type IEvent,
33+
type MatrixClient,
3434
MatrixEvent,
3535
MatrixEventEvent,
3636
} from "../../../src";
3737
import {
3838
canAcceptVerificationRequest,
39-
ShowQrCodeCallbacks,
40-
ShowSasCallbacks,
39+
type ShowQrCodeCallbacks,
40+
type ShowSasCallbacks,
4141
VerificationPhase,
42-
VerificationRequest,
42+
type VerificationRequest,
4343
VerificationRequestEvent,
44-
Verifier,
44+
type Verifier,
4545
VerifierEvent,
4646
} from "../../../src/crypto-api/verification";
4747
import { defer, escapeRegExp } from "../../../src/utils";
@@ -50,7 +50,7 @@ import {
5050
CRYPTO_BACKENDS,
5151
emitPromise,
5252
getSyncResponse,
53-
InitCrypto,
53+
type InitCrypto,
5454
syncPromise,
5555
} from "../../test-utils/test-utils";
5656
import { SyncResponder } from "../../test-utils/SyncResponder";
@@ -79,9 +79,9 @@ import {
7979
encryptMegolmEvent,
8080
encryptSecretSend,
8181
getTestOlmAccountKeys,
82-
ToDeviceEvent,
82+
type ToDeviceEvent,
8383
} from "./olm-utils";
84-
import { KeyBackupInfo } from "../../../src/crypto-api";
84+
import { type KeyBackupInfo } from "../../../src/crypto-api";
8585
import { encodeBase64 } from "../../../src/base64";
8686

8787
// The verification flows use javascript timers to set timeouts. We tell jest to use mock timer implementations

spec/integ/matrix-client-event-emitter.spec.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import HttpBackend from "matrix-mock-request";
18-
17+
import type HttpBackend from "matrix-mock-request";
1918
import {
2019
ClientEvent,
2120
HttpApiEvent,
22-
IEvent,
23-
MatrixClient,
21+
type IEvent,
22+
type MatrixClient,
2423
RoomEvent,
2524
RoomMemberEvent,
2625
RoomStateEvent,

spec/integ/matrix-client-event-timeline.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ import {
2323
EventTimelineSet,
2424
EventType,
2525
Filter,
26-
IEvent,
27-
MatrixClient,
26+
type IEvent,
27+
type MatrixClient,
2828
MatrixEvent,
2929
PendingEventOrdering,
3030
RelationType,
3131
Room,
3232
} from "../../src/matrix";
3333
import { logger } from "../../src/logger";
34-
import { encodeParams, encodeUri, QueryDict, replaceParam } from "../../src/utils";
34+
import { encodeParams, encodeUri, type QueryDict, replaceParam } from "../../src/utils";
3535
import { TestClient } from "../TestClient";
3636
import { FeatureSupport, Thread, ThreadEvent } from "../../src/models/thread";
3737
import { emitPromise } from "../test-utils/test-utils";

spec/integ/matrix-client-methods.spec.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,28 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
16-
import HttpBackend from "matrix-mock-request";
17-
import { Mocked } from "jest-mock";
16+
import { type Mocked } from "jest-mock";
1817

18+
import type HttpBackend from "matrix-mock-request";
1919
import * as utils from "../test-utils/test-utils";
20-
import { CRYPTO_ENABLED, IStoredClientOpts, MatrixClient } from "../../src/client";
20+
import { CRYPTO_ENABLED, type IStoredClientOpts, MatrixClient } from "../../src/client";
2121
import { MatrixEvent } from "../../src/models/event";
2222
import {
2323
Filter,
2424
JoinRule,
25-
KnockRoomOpts,
25+
type KnockRoomOpts,
2626
MemoryStore,
2727
Method,
2828
Room,
29-
RoomSummary,
29+
type RoomSummary,
3030
SERVICE_TYPES,
3131
} from "../../src/matrix";
3232
import { TestClient } from "../TestClient";
3333
import { THREAD_RELATION_TYPE } from "../../src/models/thread";
34-
import { IFilterDefinition } from "../../src/filter";
35-
import { ISearchResults } from "../../src/@types/search";
36-
import { IStore } from "../../src/store";
37-
import { CryptoBackend } from "../../src/common-crypto/CryptoBackend";
34+
import { type IFilterDefinition } from "../../src/filter";
35+
import { type ISearchResults } from "../../src/@types/search";
36+
import { type IStore } from "../../src/store";
37+
import { type CryptoBackend } from "../../src/common-crypto/CryptoBackend";
3838
import { SetPresence } from "../../src/sync";
3939
import { KnownMembership } from "../../src/@types/membership";
4040

spec/integ/matrix-client-opts.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { ClientEvent, MatrixClient } from "../../src/matrix";
55
import { MatrixScheduler } from "../../src/scheduler";
66
import { MemoryStore } from "../../src/store/memory";
77
import { MatrixError } from "../../src/http-api";
8-
import { IStore } from "../../src/store";
8+
import { type IStore } from "../../src/store";
99
import { KnownMembership } from "../../src/@types/membership";
1010

1111
describe("MatrixClient opts", function () {

0 commit comments

Comments
 (0)