Skip to content

Commit

Permalink
require extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-nagy committed Dec 14, 2023
1 parent e6db2bd commit 5842b10
Show file tree
Hide file tree
Showing 59 changed files with 197 additions and 191 deletions.
Binary file modified bun.lockb
Binary file not shown.
54 changes: 27 additions & 27 deletions packages/browser/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
module.exports = {
root: true,
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:expect-type/recommended",
"plugin:require-extensions/recommended"
],
parser: "@typescript-eslint/parser",
overrides: [
{
files: ["*.ts"],
plugins: ["@typescript-eslint", "eslint-plugin-expect-type"],
parserOptions: {
EXPERIMENTAL_useProjectService: true,
project: true,
tsconfigRootDir: __dirname
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:expect-type/recommended"
],
rules: {
"@typescript-eslint/no-unused-vars": [
"warn",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_"
}
],
"expect-type/expect": "error"
parserOptions: {
EXPERIMENTAL_useProjectService: true,
project: true,
tsconfigRootDir: __dirname
},
plugins: [
"@typescript-eslint",
"eslint-plugin-expect-type",
"require-extensions"
],
root: true,
rules: {
"@typescript-eslint/no-unused-vars": [
"warn",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_"
}
}
]
],
"expect-type/expect": "error"
}
};
3 changes: 3 additions & 0 deletions packages/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
"registry": "https://registry.npmjs.org"
},
"scripts": {
"prebuild": "bun clean",
"build": "tsc --project tsconfig-build.json",
"clean": "rm -rf node_modules build",
"eslint": "eslint src",
"eslint-fix": "eslint src --fix",
"prettier": "prettier --check --ignore-path .gitignore .",
"prettier-fix": "prettier --write --ignore-path .gitignore .",
"test": "web-test-runner"
Expand All @@ -28,6 +30,7 @@
"@web/test-runner-playwright": "^0.11.0",
"eslint": "^8.51.0",
"eslint-plugin-expect-type": "^0.2.3",
"eslint-plugin-require-extensions": "^0.1.3",
"prettier": "^3.0.3",
"sinon": "^17.0.1",
"typescript": "^5.3.3"
Expand Down
12 changes: 6 additions & 6 deletions packages/browser/src/BrowserSocket/BrowserSocket.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import {
fromEvent
} from "@daniel-nagy/transporter/Observable";

import * as BrowserSocket from "./BrowserSocket";
import * as BrowserSocketServer from "./BrowserSocketServer";
import * as Error from "./Error";
import * as Message from "./Message";
import * as State from "./State";
import * as Test from "../Test";
import * as BrowserSocket from './BrowserSocket.js';
import * as BrowserSocketServer from './BrowserSocketServer.js';
import * as Error from './Error.js';
import * as Message from './Message.js';
import * as State from './State.js';
import * as Test from '../Test.js';

const { test } = Test;

Expand Down
8 changes: 4 additions & 4 deletions packages/browser/src/BrowserSocket/BrowserSocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import {
timeout as within
} from "@daniel-nagy/transporter/Observable";

import * as Error from "./Error";
import * as Message from "./Message";
import * as State from "./State";
import * as StructuredCloneable from "../StructuredCloneable";
import * as Error from './Error.js';
import * as Message from './Message.js';
import * as State from './State.js';
import * as StructuredCloneable from '../StructuredCloneable.js';

export { BrowserSocket as t };

Expand Down
6 changes: 3 additions & 3 deletions packages/browser/src/BrowserSocket/BrowserSocketServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import {
tap
} from "@daniel-nagy/transporter/Observable";

import * as BrowserSocket from "./BrowserSocket";
import * as Message from "./Message";
import * as StructuredCloneable from "../StructuredCloneable";
import * as BrowserSocket from './BrowserSocket.js';
import * as Message from './Message.js';
import * as StructuredCloneable from '../StructuredCloneable.js';

export { BrowserSocketServer as t };

Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/BrowserSocket/Message.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Object from "@daniel-nagy/transporter/Object";
import * as StructuredCloneable from "../StructuredCloneable";
import * as StructuredCloneable from '../StructuredCloneable.js';

export enum Type {
Connect = "Connect",
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/BrowserSocket/State.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as Error from "./Error";
import * as Error from './Error.js';

export enum Type {
Connecting = "Connecting",
Expand Down
4 changes: 2 additions & 2 deletions packages/browser/src/StructuredCloneable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { Observable } from "@daniel-nagy/transporter/Observable/Observable";
import * as Cache from "@daniel-nagy/transporter/Cache";
import * as Injector from "@daniel-nagy/transporter/Injector";
import * as Session from "@daniel-nagy/transporter/Protocol/Session";
import * as StructuredCloneable from "./StructuredCloneable";
import * as StructuredCloneable from './StructuredCloneable.js';
import * as Subprotocol from "@daniel-nagy/transporter/Protocol/Subprotocol";

import { test } from "./Test";
import { test } from './Test.js';

describe("remote function call", () => {
test("calling a function", async () => {
Expand Down
8 changes: 4 additions & 4 deletions packages/browser/src/StructuredCloneable.typetest.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// These path imports are a workaround for https://github.com/JoshuaKGoldberg/eslint-plugin-expect-type/issues/101.
import * as Injector from "../../../node_modules/@daniel-nagy/transporter/build/Injector";
import * as Session from "../../../node_modules/@daniel-nagy/transporter/build/Protocol/Session";
import * as StructuredCloneable from "./StructuredCloneable";
import * as Subprotocol from "../../../node_modules/@daniel-nagy/transporter/build/Protocol/Subprotocol";
import * as Injector from '../../../node_modules/@daniel-nagy/transporter/build/Injector.js';
import * as Session from '../../../node_modules/@daniel-nagy/transporter/build/Protocol/Session.js';
import * as StructuredCloneable from './StructuredCloneable.js';
import * as Subprotocol from '../../../node_modules/@daniel-nagy/transporter/build/Protocol/Subprotocol.js';

const protocol = Subprotocol.init({
connectionMode: Subprotocol.ConnectionMode.ConnectionOriented,
Expand Down
56 changes: 28 additions & 28 deletions packages/core/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
module.exports = {
root: true,
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:expect-type/recommended",
"plugin:require-extensions/recommended"
],
parser: "@typescript-eslint/parser",
overrides: [
{
files: ["*.ts"],
plugins: ["@typescript-eslint", "eslint-plugin-expect-type"],
parserOptions: {
EXPERIMENTAL_useProjectService: true,
project: true,
tsconfigRootDir: __dirname
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:expect-type/recommended"
],
rules: {
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_"
}
],
"expect-type/expect": "error"
parserOptions: {
EXPERIMENTAL_useProjectService: true,
project: true,
tsconfigRootDir: __dirname
},
plugins: [
"@typescript-eslint",
"eslint-plugin-expect-type",
"require-extensions"
],
root: true,
rules: {
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_"
}
}
]
],
"expect-type/expect": "error"
}
};
3 changes: 3 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
"registry": "https://registry.npmjs.org"
},
"scripts": {
"prebuild": "bun clean",
"build": "tsc --project tsconfig-build.json",
"clean": "rm -rf node_modules build",
"eslint": "eslint src",
"eslint-fix": "eslint src --fix",
"prettier": "prettier --check --ignore-path .gitignore .",
"prettier-fix": "prettier --write --ignore-path .gitignore .",
"test": "bun test"
Expand All @@ -35,6 +37,7 @@
"bun-types": "^1.0.6",
"eslint": "^8.51.0",
"eslint-plugin-expect-type": "^0.2.3",
"eslint-plugin-require-extensions": "^0.1.3",
"prettier": "^3.0.3",
"tinyspy": "^2.2.0",
"typescript": "^5.3.3"
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/Cache.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect, test } from "bun:test";
import { spy } from "tinyspy";

import * as Cache from "./Cache";
import * as Cache from './Cache.js';

test("memoizing a function", () => {
const fn = spy(() => ({ ok: "👌" }));
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/Cache.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Function from "./Function";
import * as Json from "./Json";
import * as Function from "./Function.js";
import * as Json from "./Json.js";

export { Cache as t };

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/Fiber.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect, test } from "bun:test";
import { spy } from "tinyspy";

import * as Fiber from "./Fiber";
import * as Fiber from './Fiber.js';

test("a fiber is active when created", () => {
expect(Fiber.init().state).toBe(Fiber.State.Active);
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/Fiber.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BehaviorSubject } from "./Observable";
import { BehaviorSubject } from "./Observable/index.js";

export { Fiber as t };

Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/Injector.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as Array from "./Array";
import * as Function from "./Function";
import * as Object from "./Object";
import * as Array from "./Array.js";
import * as Function from "./Function.js";
import * as Object from "./Object.js";

export { Injector as t };

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/Injector.typetest.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as Injector from "./Injector";
import * as Injector from "./Injector.js";

describe("using the Injector", () => {
test("adding a value to the Injector", () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/Json.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Array from "./Array";
import * as Object from "./Object";
import * as Array from "./Array.js";
import * as Object from "./Object.js";

export type { Json as t };

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/Metadata.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as Object from "./Object";
import * as Object from "./Object.js";

export type { Metadata as t };

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/Object.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Array from "./Array";
import * as Function from "./Function";
import * as Array from "./Array.js";
import * as Function from "./Function.js";

/**
* An alias for an empty object.
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/Observable/BehaviorSubject.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect, test } from "bun:test";
import { spy } from "tinyspy";

import { BehaviorSubject } from "./BehaviorSubject";
import { BehaviorSubject } from "./BehaviorSubject.js";

test("a behavior subject replays its value on subscribe", () => {
const observable = new BehaviorSubject(3);
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/Observable/BehaviorSubject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import {
type Subscription,
ObservableState,
toObserver
} from "./Observable";
import { Subject } from "./Subject";
} from "./Observable.js";
import { Subject } from "./Subject.js";

/**
* A `BehaviorSubject` is a `Subject` that replays the most recent value when
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/Observable/Observable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { install as useFakeTimers } from "@sinonjs/fake-timers";
import { expect, test } from "bun:test";
import { spy } from "tinyspy";

import { Observable } from "./Observable";
import { Observable } from './Observable.js';

test("subscribing to an observable", () => {
const observable = Observable.of(5);
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/Observable/Observable.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isPromise } from "../Promise";
import { isPromise } from "../Promise.js";

export type UnaryFunction<A, B> = (a: A) => B;

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/Observable/Subject.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { install as useFakeTimers } from "@sinonjs/fake-timers";
import { expect, test } from "bun:test";
import { spy } from "tinyspy";

import { Subject } from "./Subject";
import { Subject } from './Subject.js';

test("subscribing to a subject", () => {
const subject = new Subject();
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/Observable/Subject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
Observable,
ObservableState,
toObserver
} from "./Observable";
} from "./Observable.js";

/**
* A `Subject` is both an observable and an observer. A subject can be used to
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/Observable/bufferUntil.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type ObservableLike, Observable } from "./Observable";
import { type ObservableLike, Observable } from "./Observable.js";

export class BufferOverflowError extends Error {
readonly name = "BufferOverflowError";
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/Observable/catchError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
type ObservableLike,
type Subscription,
Observable
} from "./Observable";
} from "./Observable.js";

/**
* Catches an error emitted by an upstream observable. The callback function can
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/Observable/cron.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { schedule } from "../Time";
import { Observable } from "./Observable";
import { schedule } from "../Time.js";
import { Observable } from "./Observable.js";

/**
* Creates an observable that calls a function at a regular interval and emits
Expand Down
Loading

0 comments on commit 5842b10

Please sign in to comment.