Skip to content

Commit c0557c7

Browse files
committed
Upgrades dependencies to latest + changes required to support latest versions.
1 parent 2e3c099 commit c0557c7

26 files changed

+2318
-1255
lines changed

.eslintrc.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import { defineConfig } from "eslint/config";
2+
import typescriptEslint from "@typescript-eslint/eslint-plugin";
3+
import prettier from "eslint-plugin-prettier";
4+
import globals from "globals";
5+
import tsParser from "@typescript-eslint/parser";
6+
import path from "node:path";
7+
import { fileURLToPath } from "node:url";
8+
import js from "@eslint/js";
9+
import { FlatCompat } from "@eslint/eslintrc";
10+
11+
const __filename = fileURLToPath(import.meta.url);
12+
const __dirname = path.dirname(__filename);
13+
const compat = new FlatCompat({
14+
baseDirectory: __dirname,
15+
recommendedConfig: js.configs.recommended,
16+
allConfig: js.configs.all
17+
});
18+
19+
export default defineConfig([{
20+
files: ["./src/**/*.js", "./src/**/*.jsx", "./src/**/*.ts", "./src/**/*.tsx"],
21+
extends: compat.extends(
22+
"plugin:@typescript-eslint/recommended",
23+
"plugin:prettier/recommended",
24+
),
25+
26+
plugins: {
27+
"@typescript-eslint": typescriptEslint,
28+
prettier,
29+
},
30+
31+
languageOptions: {
32+
globals: {
33+
...globals.browser,
34+
...globals.commonjs,
35+
Atomics: "readonly",
36+
SharedArrayBuffer: "readonly",
37+
},
38+
39+
parser: tsParser,
40+
ecmaVersion: 2018,
41+
sourceType: "script",
42+
},
43+
44+
rules: {
45+
"@typescript-eslint/explicit-function-return-type": ["warn", {
46+
allowExpressions: true,
47+
}],
48+
49+
"@typescript-eslint/explicit-member-accessibility": "off",
50+
"@typescript-eslint/ban-types": "off",
51+
"@typescript-eslint/no-angle-bracket-type-assertion": "off",
52+
"@typescript-eslint/no-explicit-any": "off",
53+
"@typescript-eslint/no-non-null-assertion": "off",
54+
"@typescript-eslint/no-parameter-properties": "off",
55+
"@typescript-eslint/prefer-interface": "off",
56+
"@typescript-eslint/indent": "off",
57+
},
58+
}, {
59+
files: ["**/*.test.ts", "**/*.spec.ts"],
60+
61+
rules: {
62+
"@typescript-eslint/no-empty-function": "off",
63+
"@typescript-eslint/interface-name-prefix": "off",
64+
},
65+
}]);

package.json

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@
77
"es2015": "./dist/esm2015/index.js",
88
"typings": "./dist/typings/index.d.ts",
99
"scripts": {
10-
"build": "yarn clean && yarn build:cjs && yarn build:es5 && yarn build:es2015 && yarn build:types",
10+
"build": "yarn clean && yarn build:cjs && yarn build:es5 && yarn build:es2015 && yarn build:es2020 && yarn build:esnext && yarn build:types",
1111
"build:cjs": "tsc",
1212
"build:es5": "tsc -p ./typescript/tsconfig.esm5.json",
1313
"build:es2015": "tsc -p ./typescript/tsconfig.esm2015.json",
14+
"build:es2020": "tsc -p ./typescript/tsconfig.esm2020.json",
15+
"build:esnext": "tsc -p ./typescript/tsconfig.esmnext.json",
1416
"build:types": "tsc -p ./typescript/tsconfig.types.json",
1517
"clean": "rimraf ./dist",
1618
"test": "yarn lint && jest --config test/jest.config.js",
1719
"test:inspect": "yarn lint && node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand --config test/jest.config.js",
1820
"test:coverage": "jest --config test/jest.config.js --coverage",
19-
"lint": "eslint --ext \".js,.jsx,.ts,.tsx\" \"./src\"",
20-
"lint:fix": "eslint --fix --ext \".js,.jsx,.ts,.tsx\" \"./src\""
21+
"lint": "eslint",
22+
"lint:fix": "eslint --fix"
2123
},
2224
"repository": {
2325
"type": "git",
@@ -42,22 +44,23 @@
4244
},
4345
"homepage": "https://github.com/Microsoft/tsyringe#readme",
4446
"dependencies": {
45-
"tslib": "^1.9.3"
47+
"tslib": "^2.8.1"
4648
},
4749
"devDependencies": {
4850
"@types/jest": "^24.0.21",
49-
"@types/node": "^8.10.16",
50-
"@typescript-eslint/eslint-plugin": "^2.6.0",
51-
"@typescript-eslint/parser": "^2.6.0",
52-
"eslint": "^6.6.0",
53-
"eslint-config-prettier": "^6.5.0",
54-
"eslint-plugin-prettier": "^3.1.1",
55-
"husky": "^3.0.0",
51+
"@types/node": "^22.14.0",
52+
"@typescript-eslint/eslint-plugin": "^8.29.0",
53+
"@typescript-eslint/parser": "^8.29.0",
54+
"eslint": "^9.24.0",
55+
"eslint-config-prettier": "^10.1.1",
56+
"eslint-plugin-prettier": "^5.2.6",
57+
"husky": "^9.1.7",
5658
"jest": "^24.7.1",
57-
"prettier": "1.18.2",
58-
"reflect-metadata": "^0.1.12",
59-
"rimraf": "^3.0.0",
60-
"ts-jest": "^24.0.2",
61-
"typescript": "^3.1.6"
62-
}
59+
"prettier": "^3.5.3",
60+
"reflect-metadata": "^0.2.2",
61+
"rimraf": "^6.0.1",
62+
"ts-jest": "^24.3.0",
63+
"typescript": "^5.8.3"
64+
},
65+
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
6366
}

src/__tests__/auto-injectable.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ test("@autoInjectable injects parameters beyond those specified manually", () =>
3636
class FooBar {}
3737
@autoInjectable()
3838
class Foo {
39-
constructor(public myFooBar: FooBar, public myBar?: Bar) {}
39+
constructor(
40+
public myFooBar: FooBar,
41+
public myBar?: Bar
42+
) {}
4043
}
4144

4245
const myFooBar = new FooBar();

src/__tests__/child-container.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
/* eslint-disable @typescript-eslint/interface-name-prefix, @typescript-eslint/no-empty-interface */
2-
31
import {instance as globalContainer} from "../dependency-container";
42

53
afterEach(() => {
64
globalContainer.reset();
75
});
86

97
test("child container resolves even when parent doesn't have registration", () => {
8+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
109
interface IFoo {}
1110
class Foo implements IFoo {}
1211

@@ -19,6 +18,7 @@ test("child container resolves even when parent doesn't have registration", () =
1918
});
2019

2120
test("child container resolves using parent's registration when child container doesn't have registration", () => {
21+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
2222
interface IFoo {}
2323
class Foo implements IFoo {}
2424

@@ -31,6 +31,7 @@ test("child container resolves using parent's registration when child container
3131
});
3232

3333
test("child container resolves all even when parent doesn't have registration", () => {
34+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
3435
interface IFoo {}
3536
class Foo implements IFoo {}
3637

@@ -45,6 +46,7 @@ test("child container resolves all even when parent doesn't have registration",
4546
});
4647

4748
test("child container resolves all using parent's registration when child container doesn't have registration", () => {
49+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
4850
interface IFoo {}
4951
class Foo implements IFoo {}
5052

src/__tests__/disposable.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ describe("Disposable", () => {
1010

1111
it("returns false when dispose method takes too many args", () => {
1212
const specialDisposable = {
13+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
1314
dispose(_: any) {}
1415
};
1516

src/__tests__/errors.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ test("Error message composition", () => {
2121

2222
@injectable()
2323
class A {
24-
constructor(public d: Ok, public b: B) {}
24+
constructor(
25+
public d: Ok,
26+
public b: B
27+
) {}
2528
}
2629

2730
expect(() => {

src/__tests__/global-container.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-disable @typescript-eslint/interface-name-prefix */
2-
31
import {inject, injectable, registry, singleton} from "../decorators";
42
import {
53
instanceCachingFactory,
@@ -558,7 +556,11 @@ test("dependencies of an @singleton can be resolved", () => {
558556
test("passes through the given params", () => {
559557
@injectable()
560558
class MyViewModel {
561-
constructor(public a: any, public b: any, public c: any) {}
559+
constructor(
560+
public a: any,
561+
public b: any,
562+
public c: any
563+
) {}
562564
}
563565

564566
const a = {};
@@ -936,7 +938,7 @@ describe("dispose", () => {
936938
class Baz implements Disposable {
937939
disposed = false;
938940
async dispose(): Promise<void> {
939-
return new Promise(resolve => {
941+
return new Promise((resolve) => {
940942
process.nextTick(() => {
941943
this.disposed = true;
942944
resolve();

src/__tests__/inject-lazy.tests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ test("DelayedConstructor delays creation until first usage", () => {
1515
}
1616
const delayedConstructor = delay(() => Foo);
1717
expect(delayedConstructor).toBeInstanceOf(DelayedConstructor);
18-
const foo: Foo = delayedConstructor.createProxy(Target => new Target());
18+
const foo: Foo = delayedConstructor.createProxy((Target) => new Target());
1919
expect(created).toBe(false);
2020
expect(foo).toBeInstanceOf(Foo);
2121
expect(created).toBe(true);

src/__tests__/scoped.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ describe("Scoped registrations", () => {
2424

2525
@injectable()
2626
class A {
27-
constructor(public b: B, public c: C) {}
27+
constructor(
28+
public b: B,
29+
public c: C
30+
) {}
2831
}
2932

3033
globalContainer.register(

0 commit comments

Comments
 (0)