Skip to content

Commit c550dce

Browse files
authored
chore: bump deps (#145)
1 parent 9d05723 commit c550dce

30 files changed

+1523
-1319
lines changed

.eslintrc.cjs

-49
This file was deleted.

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout
13-
uses: actions/checkout@v2
13+
uses: actions/checkout@v4
1414
- name: Setup Node
15-
uses: actions/setup-node@v3
15+
uses: actions/setup-node@v4
1616
with:
1717
node-version: 'current'
1818
- name: Install dependencies

.github/workflows/release.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@v2
14+
uses: actions/checkout@v4
1515
- name: Setup Node
16-
uses: actions/setup-node@v3
16+
uses: actions/setup-node@v4
1717
with:
1818
node-version: 'current'
1919
registry-url: https://registry.npmjs.org

eslint.config.mjs

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// @ts-check
2+
3+
import eslint from "@eslint/js";
4+
import tseslint from "typescript-eslint";
5+
import eslintConfigPrettier from "eslint-config-prettier";
6+
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
7+
8+
export default tseslint.config(
9+
eslint.configs.recommended,
10+
tseslint.configs.recommended,
11+
eslintConfigPrettier,
12+
eslintPluginPrettierRecommended,
13+
{
14+
rules: {
15+
"@typescript-eslint/no-unsafe-declaration-merging": "off",
16+
"@typescript-eslint/no-explicit-any": "off",
17+
"@typescript-eslint/no-empty-object-type": [
18+
"error",
19+
{
20+
allowInterfaces: "with-single-extends",
21+
},
22+
],
23+
},
24+
},
25+
);

package.json

+14-11
Original file line numberDiff line numberDiff line change
@@ -16,38 +16,41 @@
1616
"author": "Kévin Dunglas",
1717
"license": "MIT",
1818
"devDependencies": {
19+
"@eslint/compat": "^1.2.5",
20+
"@eslint/eslintrc": "^3.2.0",
21+
"@eslint/js": "^9.19.0",
1922
"@types/inflection": "^1.13.0",
2023
"@types/jest": "^29.0.0",
2124
"@types/jsonld": "^1.5.0",
2225
"@types/lodash.get": "^4.4.0",
23-
"@types/node": "^18.0.0",
24-
"@typescript-eslint/eslint-plugin": "^5.0.0",
25-
"@typescript-eslint/parser": "^5.0.0",
26-
"eslint": "^8.0.0",
27-
"eslint-config-prettier": "^8.0.0",
26+
"@types/node": "^22.0.0",
27+
"eslint": "^9.0.0",
28+
"eslint-config-prettier": "^10.0.0",
2829
"eslint-import-resolver-typescript": "^3.5.1",
2930
"eslint-plugin-import": "^2.26.0",
30-
"eslint-plugin-prettier": "^4.0.0",
31+
"eslint-plugin-prettier": "^5.0.0",
3132
"eslint-watch": "^8.0.0",
33+
"globals": "^15.14.0",
3234
"jest": "^29.0.0",
3335
"jest-fetch-mock": "^3.0.0",
3436
"openapi-types": "^12.0.0",
35-
"prettier": "^2.2.0",
37+
"prettier": "^3.0.0",
3638
"ts-jest": "^29.0.0",
3739
"ts-node": "^10.9.0",
38-
"typescript": "^4.1.0"
40+
"typescript": "^5.7.0",
41+
"typescript-eslint": "^8.22.0"
3942
},
4043
"dependencies": {
4144
"graphql": "^16.0.0",
42-
"inflection": "^1.13.0",
45+
"inflection": "^3.0.0",
4346
"jsonld": "^8.3.2",
44-
"jsonref": "^8.0.0",
47+
"jsonref": "^9.0.0",
4548
"lodash.get": "^4.4.0",
4649
"tslib": "^2.0.0"
4750
},
4851
"scripts": {
4952
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
50-
"lint": "esw --color src --ext .ts",
53+
"lint": "eslint src",
5154
"fix": "yarn lint --fix",
5255
"eslint-check": "eslint-config-prettier src/index.ts",
5356
"build": "rm -rf lib/* && tsc",

src/Api.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ export interface ApiOptions
1010

1111
export interface Api extends ApiOptions {}
1212
export class Api {
13-
constructor(public entrypoint: string, options: ApiOptions = {}) {
13+
constructor(
14+
public entrypoint: string,
15+
options: ApiOptions = {},
16+
) {
1417
assignSealed(this, options);
1518
}
1619
}

src/Field.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ export interface FieldOptions
4848

4949
export interface Field extends FieldOptions {}
5050
export class Field {
51-
constructor(public name: string, options: FieldOptions = {}) {
51+
constructor(
52+
public name: string,
53+
options: FieldOptions = {},
54+
) {
5255
assignSealed(this, options);
5356
}
5457
}

src/Operation.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class Operation {
1717
constructor(
1818
public name: string,
1919
public type: OperationType,
20-
options: OperationOptions = {}
20+
options: OperationOptions = {},
2121
) {
2222
assignSealed(this, options);
2323
}

src/Parameter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ export class Parameter {
44
public range: string | null,
55
public required: boolean,
66
public description: string,
7-
public deprecated?: boolean
7+
public deprecated?: boolean,
88
) {}
99
}

src/Resource.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class Resource {
2323
constructor(
2424
public name: string,
2525
public url: string,
26-
options: ResourceOptions = {}
26+
options: ResourceOptions = {},
2727
) {
2828
assignSealed(this, options);
2929
}

src/graphql/fetchQuery.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const setOptions = (query: string, options: RequestInit): RequestInit => {
2323
export default async <TData = { [key: string]: unknown }>(
2424
url: string,
2525
query: string,
26-
options: RequestInit = {}
26+
options: RequestInit = {},
2727
): Promise<{
2828
response: Response;
2929
body: ExecutionResult<TData>;

src/graphql/parseGraphQl.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const getRangeFromGraphQlType = (type: IntrospectionOutputTypeRef): string => {
2626
};
2727

2828
const getReferenceFromGraphQlType = (
29-
type: IntrospectionOutputTypeRef
29+
type: IntrospectionOutputTypeRef,
3030
): null | string => {
3131
if (type.kind === "OBJECT" && type.name.endsWith("Connection")) {
3232
return type.name.slice(0, type.name.lastIndexOf("Connection"));
@@ -37,7 +37,7 @@ const getReferenceFromGraphQlType = (
3737

3838
export default async (
3939
entrypointUrl: string,
40-
options: RequestInit = {}
40+
options: RequestInit = {},
4141
): Promise<{
4242
api: Api;
4343
response: Response;
@@ -50,11 +50,11 @@ export default async (
5050
} = await fetchQuery<IntrospectionQuery>(
5151
entrypointUrl,
5252
introspectionQuery,
53-
options
53+
options,
5454
);
5555
if (!data?.__schema) {
5656
throw new Error(
57-
"Schema has not been retrieved from the introspection query."
57+
"Schema has not been retrieved from the introspection query.",
5858
);
5959
}
6060
const schema = data?.__schema;
@@ -70,7 +70,7 @@ export default async (
7070
!type.name.startsWith(type.name[0].toLowerCase()) &&
7171
!type.name.endsWith("Connection") &&
7272
!type.name.endsWith("Edge") &&
73-
!type.name.endsWith("PageInfo")
73+
!type.name.endsWith("PageInfo"),
7474
) as IntrospectionObjectType[];
7575

7676
const resources: Resource[] = [];
@@ -98,7 +98,7 @@ export default async (
9898
fields,
9999
readableFields,
100100
writableFields,
101-
})
101+
}),
102102
);
103103
});
104104

src/hydra/fetchJsonLd.test.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ test("fetch a JSON-LD document", () => {
1717
status: 200,
1818
statusText: "OK",
1919
headers: { "Content-Type": "application/ld+json" },
20-
}
20+
},
2121
);
2222

2323
return fetchJsonLd("/foo.jsonld").then((data) => {
2424
expect(data.response.ok).toBe(true);
2525
expect(((data as ResponseDocument).body as { name: string }).name).toBe(
26-
"John Lennon"
26+
"John Lennon",
2727
);
2828
});
2929
});
@@ -39,7 +39,7 @@ test("fetch a non JSON-LD document", () => {
3939
(data: { response: Response; body: undefined }) => {
4040
expect(data.response.ok).toBe(true);
4141
expect(typeof data.body).toBe("undefined");
42-
}
42+
},
4343
);
4444
});
4545

@@ -56,7 +56,7 @@ test("fetch an error with Content-Type application/ld+json", () => {
5656
status: 400,
5757
statusText: "Bad Request",
5858
headers: { "Content-Type": "application/ld+json" },
59-
}
59+
},
6060
);
6161

6262
return fetchJsonLd("/foo.jsonld").catch(
@@ -65,7 +65,7 @@ test("fetch an error with Content-Type application/ld+json", () => {
6565
expect(response.ok).toBe(false);
6666
expect(body.born).toBe("1940-10-09");
6767
});
68-
}
68+
},
6969
);
7070
});
7171

@@ -82,7 +82,7 @@ test("fetch an error with Content-Type application/error+json", () => {
8282
status: 400,
8383
statusText: "Bad Request",
8484
headers: { "Content-Type": "application/error+json" },
85-
}
85+
},
8686
);
8787

8888
return fetchJsonLd("/foo.jsonld").catch(
@@ -91,7 +91,7 @@ test("fetch an error with Content-Type application/error+json", () => {
9191
expect(response.ok).toBe(false);
9292
expect(body.born).toBe("1940-10-09");
9393
});
94-
}
94+
},
9595
);
9696
});
9797

src/hydra/fetchJsonLd.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export interface ResponseDocument extends RemoteDocument {
2222
*/
2323
export default async function fetchJsonLd(
2424
url: string,
25-
options: RequestInitExtended = {}
25+
options: RequestInitExtended = {},
2626
): Promise<ResponseDocument | EmptyResponseDocument> {
2727
const response = await fetch(url, setHeaders(options));
2828
const { headers, status } = response;

src/hydra/fetchResource.ts

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
1-
import get from "lodash.get";
21
import type { EmptyResponseDocument, ResponseDocument } from "./fetchJsonLd.js";
32
import fetchJsonLd from "./fetchJsonLd.js";
43
import type { IriTemplateMapping, RequestInitExtended } from "./types.js";
54

65
export default (
76
resourceUrl: string,
8-
options: RequestInitExtended = {}
7+
options: RequestInitExtended = {},
98
): Promise<{ parameters: IriTemplateMapping[] }> => {
109
return fetchJsonLd(
1110
resourceUrl,
12-
Object.assign({ itemsPerPage: 0 }, options)
11+
Object.assign({ itemsPerPage: 0 }, options),
1312
).then((d: ResponseDocument | EmptyResponseDocument) => {
1413
let hasPrefix = true;
1514
if ((d as ResponseDocument).body) {
1615
hasPrefix = "hydra:search" in (d as ResponseDocument).body;
1716
}
1817
return {
19-
parameters: get(
20-
d,
21-
hasPrefix ? "body.hydra:search.hydra:mapping" : "body.search.mapping"
22-
) as unknown as IriTemplateMapping[],
18+
parameters: (hasPrefix
19+
? (d as any)?.body?.["hydra:search"]?.["hydra:mapping"]
20+
: (d as any)?.body?.search?.mapping) as unknown as IriTemplateMapping[],
2321
};
2422
});
2523
};

src/hydra/getParameters.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type { RequestInitExtended } from "./types.js";
55

66
export default (
77
resource: Resource,
8-
options: RequestInitExtended = {}
8+
options: RequestInitExtended = {},
99
): Promise<Parameter[]> =>
1010
fetchResource(resource.url, options).then(({ parameters = [] }) => {
1111
const resourceParameters: Parameter[] = [];

0 commit comments

Comments
 (0)