Skip to content

Commit

Permalink
Upgrade to typescript-eslint v8, part 2.
Browse files Browse the repository at this point in the history
  • Loading branch information
ajvincent committed Aug 11, 2024
1 parent 8c2ae17 commit 79e6339
Show file tree
Hide file tree
Showing 13 changed files with 141 additions and 17 deletions.
14 changes: 13 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,19 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

import {
projectDir,
} from "#utilities/source/AsyncSpecModules.js";

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: projectDir
}
}
},
);
14 changes: 13 additions & 1 deletion stage_1_snapshot/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,21 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

import {
projectDir,
} from "#utilities/source/AsyncSpecModules.js";

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: projectDir
}
}
},
{
"rules": {
"@typescript-eslint/no-unused-vars": [
Expand Down
14 changes: 13 additions & 1 deletion stage_2_generation/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,19 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

import {
projectDir,
} from "#utilities/source/AsyncSpecModules.js";

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: projectDir
}
}
},
);
14 changes: 13 additions & 1 deletion stage_2_integration/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,19 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

import {
projectDir,
} from "#utilities/source/AsyncSpecModules.js";

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: projectDir
}
}
},
);
14 changes: 13 additions & 1 deletion stage_2_snapshot/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,21 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

import {
projectDir,
} from "#utilities/source/AsyncSpecModules.js";

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: projectDir
}
}
},
{
"rules": {
"@typescript-eslint/no-unused-vars": [
Expand Down
14 changes: 13 additions & 1 deletion stage_3_generation/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,19 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

import {
projectDir,
} from "#utilities/source/AsyncSpecModules.js";

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: projectDir
}
}
},
);
14 changes: 13 additions & 1 deletion stage_3_integration/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,19 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

import {
projectDir,
} from "#utilities/source/AsyncSpecModules.js";

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: projectDir
}
}
},
);
14 changes: 13 additions & 1 deletion stage_3_snapshot/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,19 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

import {
projectDir,
} from "#utilities/source/AsyncSpecModules.js";

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: projectDir
}
}
},
);
14 changes: 13 additions & 1 deletion use-cases/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,19 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

import {
projectDir,
} from "#utilities/source/AsyncSpecModules.js";

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: projectDir
}
}
},
);
14 changes: 13 additions & 1 deletion utilities/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,20 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

import {
projectDir,
} from "#utilities/source/AsyncSpecModules.js";

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: projectDir
}
}
},
//...tseslint.configs.strict,
);
15 changes: 9 additions & 6 deletions utilities/spec/AwaitedMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ import AwaitedMap, {

describe("AwaitedMap", () => {
it(".allSettled() converts promises to promise-settled results", async () => {
const rejectTwoError = new Error("reject two");
const map = new AwaitedMap<string, number>([
["one", Promise.resolve(1)],
["two", Promise.reject("reject two")],
["two", Promise.reject(rejectTwoError)],
]);

const results = await map.allSettled();
const entries = Array.from(results.entries());
expect(entries).toEqual([
["one", { status: "fulfilled", value: 1}],
["two", { status: "rejected", reason: "reject two"}],
["two", { status: "rejected", reason: rejectTwoError}],
]);
});

Expand All @@ -33,10 +34,12 @@ describe("AwaitedMap", () => {
});

it(".allResolved() rejects with an AwaitedMapError for all errors that failed", async () => {
const rejectOneError = new Error("reject one");
const rejectThreeError = new Error("reject three");
const map = new AwaitedMap<string, number>([
["one", Promise.reject("reject one")],
["one", Promise.reject(rejectOneError)],
["two", Promise.resolve(2)],
["three", Promise.reject("reject three")],
["three", Promise.reject(rejectThreeError)],
]);

await expectAsync(map.allResolved()).toBeRejectedWithError(AwaitedMapError);
Expand All @@ -48,8 +51,8 @@ describe("AwaitedMap", () => {
(ex as AwaitedMapError<string>).errorMap.entries()
);
expect(entries).toEqual([
["one", "reject one"],
["three", "reject three"],
["one", rejectOneError],
["three", rejectThreeError],
]);
}
});
Expand Down
1 change: 1 addition & 0 deletions utilities/spec/BuildPromise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ describe("BuildPromise.mts: ", () => {
if (willResolve)
spy.and.returnValue(Promise.resolve(value));
else
//eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
spy.and.returnValue(Promise.reject(value));
return spy;
}
Expand Down
2 changes: 1 addition & 1 deletion utilities/spec/PromiseTypes/SingletonPromise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe("PromiseTypes.SingletonPromise", () => {
});

it("rejects with the error we passed in", async () => {
const expected = {};
const expected = new Error("rejection");
const spy = jasmine.createSpy();
spy.and.returnValue(Promise.reject(expected));
const x = new SingletonPromise<object>(spy);
Expand Down

0 comments on commit 79e6339

Please sign in to comment.