Browse Source

Added lint rule to enforce importing with extensions (#831)

* fix: added lint rule to enforce importing with extentions

* fix test import path

* added import file extentions
pull/834/head
Dan Ditomaso 9 months ago
committed by GitHub
parent
commit
d0f4939a4d
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 3
      biome.json
  2. 4
      packages/transport-http/src/transport.test.ts
  3. 4
      packages/transport-node-serial/src/transport.test.ts
  4. 4
      packages/transport-node/src/transport.test.ts
  5. 4
      packages/transport-web-bluetooth/src/transport.test.ts
  6. 4
      packages/transport-web-serial/src/transport.test.ts
  7. 2
      packages/web/src/core/stores/nodeDBStore/index.ts
  8. 2
      packages/web/src/core/stores/nodeDBStore/nodeDBStore.test.ts
  9. 2
      packages/web/src/core/stores/utils/indexDB.test.ts

3
biome.json

@ -34,7 +34,8 @@
}, },
"correctness": { "correctness": {
"noUnusedVariables": "error", "noUnusedVariables": "error",
"noUnusedImports": "error" "noUnusedImports": "error",
"useImportExtensions": "error"
} }
} }
}, },

4
packages/transport-http/src/transport.test.ts

@ -7,8 +7,8 @@ import {
type MockInstance, type MockInstance,
vi, vi,
} from "vitest"; } from "vitest";
import { runTransportContract } from "../../../tests/utils/transportContract"; import { runTransportContract } from "../../../tests/utils/transportContract.ts";
import { TransportHTTP } from "./transport"; import { TransportHTTP } from "./transport.ts";
let abortTimeoutSpy: MockInstance | undefined; let abortTimeoutSpy: MockInstance | undefined;
beforeEach(() => { beforeEach(() => {

4
packages/transport-node-serial/src/transport.test.ts

@ -2,8 +2,8 @@ import { Duplex } from "node:stream";
import { Types, Utils } from "@meshtastic/core"; import { Types, Utils } from "@meshtastic/core";
import type { SerialPort } from "serialport"; import type { SerialPort } from "serialport";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { runTransportContract } from "../../../tests/utils/transportContract"; import { runTransportContract } from "../../../tests/utils/transportContract.ts";
import { TransportNodeSerial } from "./transport"; import { TransportNodeSerial } from "./transport.ts";
function isStatusEvent( function isStatusEvent(
output: Types.DeviceOutput | undefined, output: Types.DeviceOutput | undefined,

4
packages/transport-node/src/transport.test.ts

@ -2,8 +2,8 @@ import type { Socket } from "node:net";
import { Duplex } from "node:stream"; import { Duplex } from "node:stream";
import { Types, Utils } from "@meshtastic/core"; import { Types, Utils } from "@meshtastic/core";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { runTransportContract } from "../../../tests/utils/transportContract"; import { runTransportContract } from "../../../tests/utils/transportContract.ts";
import { TransportNode } from "./transport"; import { TransportNode } from "./transport.ts";
function isStatusEvent( function isStatusEvent(
out: Types.DeviceOutput | undefined, out: Types.DeviceOutput | undefined,

4
packages/transport-web-bluetooth/src/transport.test.ts

@ -1,6 +1,6 @@
import { describe, expect, vi } from "vitest"; import { describe, expect, vi } from "vitest";
import { runTransportContract } from "../../../tests/utils/transportContract"; import { runTransportContract } from "../../../tests/utils/transportContract.ts";
import { TransportWebBluetooth } from "./transport"; import { TransportWebBluetooth } from "./transport.ts";
class MiniEmitter { class MiniEmitter {
private listeners = new Map<string, Set<(e: Event) => void>>(); private listeners = new Map<string, Set<(e: Event) => void>>();

4
packages/transport-web-serial/src/transport.test.ts

@ -1,7 +1,7 @@
import { Types, Utils } from "@meshtastic/core"; import { Types, Utils } from "@meshtastic/core";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { runTransportContract } from "../../../tests/utils/transportContract"; import { runTransportContract } from "../../../tests/utils/transportContract.ts";
import { TransportWebSerial } from "./transport"; import { TransportWebSerial } from "./transport.ts";
function stubCoreTransforms() { function stubCoreTransforms() {
const toDevice = new TransformStream<Uint8Array, Uint8Array>({ const toDevice = new TransformStream<Uint8Array, Uint8Array>({

2
packages/web/src/core/stores/nodeDBStore/index.ts

@ -5,7 +5,7 @@ import { Protobuf, type Types } from "@meshtastic/core";
import { produce } from "immer"; import { produce } from "immer";
import { create as createStore, type StateCreator } from "zustand"; import { create as createStore, type StateCreator } from "zustand";
import { type PersistOptions, persist } from "zustand/middleware"; import { type PersistOptions, persist } from "zustand/middleware";
import type { NodeError, NodeErrorType, ProcessPacketParams } from "./types"; import type { NodeError, NodeErrorType, ProcessPacketParams } from "./types.ts";
const CURRENT_STORE_VERSION = 0; const CURRENT_STORE_VERSION = 0;
const NODEDB_RETENTION_NUM = 10; const NODEDB_RETENTION_NUM = 10;

2
packages/web/src/core/stores/nodeDBStore/nodeDBStore.test.ts

@ -16,7 +16,7 @@ vi.mock("idb-keyval", () => ({
// import a fresh copy of the store module (because the store is created at import time) // import a fresh copy of the store module (because the store is created at import time)
async function freshStore() { async function freshStore() {
vi.resetModules(); vi.resetModules();
const mod = await import("../nodeDBStore"); const mod = await import("./index.ts");
return mod; return mod;
} }

2
packages/web/src/core/stores/utils/indexDB.test.ts

@ -1,6 +1,6 @@
import * as idb from "idb-keyval"; import * as idb from "idb-keyval";
import { beforeEach, describe, expect, it, vi } from "vitest"; import { beforeEach, describe, expect, it, vi } from "vitest";
import { createStorage } from "./indexDB"; import { createStorage } from "./indexDB.ts";
type PersistStorage<T> = ReturnType<typeof createStorage<T>>; type PersistStorage<T> = ReturnType<typeof createStorage<T>>;

Loading…
Cancel
Save