Skip to content

Commit 6ca978e

Browse files
committed
Update dependencies
1 parent 026feda commit 6ca978e

19 files changed

+201
-311
lines changed

.eslintrc.json

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

.github/workflows/nodejs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ jobs:
2323
- run: npm install
2424
- run: npm test
2525
- run: npm run lint
26+
- run: npm run type-check

.npmignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
.github/
2-
.eslintrc.json
2+
eslint.config.js
33
**/*.spec.ts
44
tsconfig.json
55
lib/jref/SPECIFICATION.md
66
scratch/
77
TODO
8-
rollup.config.js
9-
dist/
108
lib/urn-scheme-plugin.js

eslint.config.js

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import js from "@eslint/js";
2+
import stylistic from "@stylistic/eslint-plugin";
3+
import importPlugin from "eslint-plugin-import";
4+
import globals from "globals";
5+
import tseslint from "typescript-eslint";
6+
7+
8+
export default [
9+
js.configs.recommended,
10+
...tseslint.configs.recommendedTypeChecked,
11+
...tseslint.configs.stylisticTypeChecked,
12+
importPlugin.flatConfigs.recommended,
13+
stylistic.configs.customize({
14+
arrowParens: true,
15+
braceStyle: "1tbs",
16+
commaDangle: "never",
17+
flat: true,
18+
jsx: false,
19+
quotes: "double",
20+
semi: true
21+
}),
22+
{
23+
languageOptions: {
24+
ecmaVersion: "latest",
25+
globals: {
26+
...globals.node
27+
},
28+
parserOptions: {
29+
projectService: true,
30+
tsconfigRootDir: import.meta.dirname
31+
}
32+
},
33+
settings: {
34+
"import/resolver": {
35+
node: {},
36+
typescript: {}
37+
}
38+
},
39+
rules: {
40+
// JavaScript
41+
"no-console": ["error"],
42+
"no-empty-function": "off",
43+
"no-fallthrough": "off",
44+
45+
// TypeScript
46+
"@typescript-eslint/no-unused-vars": ["error", { caughtErrorsIgnorePattern: "^_" }],
47+
"@typescript-eslint/no-empty-function": "off",
48+
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
49+
50+
// Imports
51+
"import/extensions": ["error", "ignorePackages"],
52+
"import/newline-after-import": ["error", { count: 2, exactCount: false, considerComments: true }],
53+
54+
// Stylistic
55+
"@stylistic/multiline-ternary": "off",
56+
"@stylistic/no-mixed-operators": "off",
57+
"@stylistic/no-multiple-empty-lines": ["error", { max: 2, maxEOF: 0, maxBOF: 0 }], // Allow max=2 for imports
58+
"@stylistic/quote-props": ["error", "consistent"],
59+
"@stylistic/yield-star-spacing": ["error", "after"]
60+
}
61+
},
62+
{
63+
files: ["**/*.js"],
64+
...tseslint.configs.disableTypeChecked
65+
}
66+
];

lib/browser/embedded.spec.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, beforeEach, afterEach, expect, beforeAll, afterAll } from "vitest";
1+
import { describe, test, beforeEach, afterEach, expect, beforeAll, afterAll } from "vitest";
22
import { MockAgent, setGlobalDispatcher } from "undici";
33
import { get, addMediaTypePlugin, removeMediaTypePlugin } from "../index.js";
44
import { parse, stringify } from "../jref/index.js";
@@ -32,7 +32,7 @@ describe("JSON Browser", () => {
3232
};
3333
addMediaTypePlugin(testMediaType, {
3434
parse: async (response) => parseToDocument(response.url, await response.text()),
35-
fileMatcher: async (path) => path.endsWith(".embedded")
35+
fileMatcher: async (path) => path.endsWith(".embedded") // eslint-disable-line @typescript-eslint/require-await
3636
});
3737
});
3838

@@ -42,7 +42,7 @@ describe("JSON Browser", () => {
4242

4343
let mockAgent: MockAgent;
4444

45-
beforeEach(async () => {
45+
beforeEach(() => {
4646
mockAgent = new MockAgent();
4747
mockAgent.disableNetConnect();
4848
setGlobalDispatcher(mockAgent);
@@ -52,7 +52,7 @@ describe("JSON Browser", () => {
5252
await mockAgent.close();
5353
});
5454

55-
it("getting an embedded document", async () => {
55+
test("getting an embedded document", async () => {
5656
const jrefEmbedded = `{
5757
"$embedded": {
5858
"${testDomain}/foo": {}
@@ -67,7 +67,7 @@ describe("JSON Browser", () => {
6767
expect(subject.uri).to.equal(`${testDomain}/foo`);
6868
});
6969

70-
it("getting the main document from an embedded document", async () => {
70+
test("getting the main document from an embedded document", async () => {
7171
const jrefEmbedded = `{
7272
"$embedded": {
7373
"${testDomain}/foo": {}
@@ -83,7 +83,7 @@ describe("JSON Browser", () => {
8383
expect(subject.uri).to.equal(`${testDomain}/main`);
8484
});
8585

86-
it("getting an embedded document from an embedded document", async () => {
86+
test("getting an embedded document from an embedded document", async () => {
8787
const jrefEmbedded = `{
8888
"$embedded": {
8989
"${testDomain}/foo": {},
@@ -100,7 +100,7 @@ describe("JSON Browser", () => {
100100
expect(subject.uri).to.equal(`${testDomain}/bar`);
101101
});
102102

103-
it("referencing an embedded document", async () => {
103+
test("referencing an embedded document", async () => {
104104
const jrefEmbedded = `{
105105
"foo": { "$ref": "/foo" },
106106
@@ -116,7 +116,7 @@ describe("JSON Browser", () => {
116116
expect(subject.uri).to.equal(`${testDomain}/foo`);
117117
});
118118

119-
it("referencing the main document from an embedded document", async () => {
119+
test("referencing the main document from an embedded document", async () => {
120120
const jrefEmbedded = `{
121121
"$embedded": {
122122
"${testDomain}/foo": {
@@ -133,7 +133,7 @@ describe("JSON Browser", () => {
133133
expect(subject.uri).to.equal(`${testDomain}/main`);
134134
});
135135

136-
it("referencing an embedded document from an embedded document", async () => {
136+
test("referencing an embedded document from an embedded document", async () => {
137137
const jrefEmbedded = `{
138138
"$embedded": {
139139
"${testDomain}/foo": {
@@ -151,7 +151,7 @@ describe("JSON Browser", () => {
151151
expect(subject.uri).to.equal(`${testDomain}/bar`);
152152
});
153153

154-
it("a cached document takes precence over an embedded document", async () => {
154+
test("a cached document takes precence over an embedded document", async () => {
155155
const cachedJrefEmbedded = `{
156156
"foo": { "$ref": "/main" }
157157
}`;

lib/browser/generators.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, beforeEach, afterEach, expect } from "vitest";
1+
import { describe, test, beforeEach, afterEach, expect } from "vitest";
22
import { MockAgent, setGlobalDispatcher } from "undici";
33
import { get, value, iter, keys, values, entries } from "../index.js";
44
import type { Browser } from "../index.js";
@@ -19,7 +19,7 @@ describe("JSON Browser", () => {
1919
await mockAgent.close();
2020
});
2121

22-
it("iter", async () => {
22+
test("iter", async () => {
2323
const jref = `[1, { "$ref": "/external" }, { "$ref": "#/1" }]`;
2424
const external = "2";
2525

@@ -45,7 +45,7 @@ describe("JSON Browser", () => {
4545
expect((await generator.next()).done).to.equal(true);
4646
});
4747

48-
it("keys", async () => {
48+
test("keys", async () => {
4949
const jref = `{
5050
"a": 1,
5151
"b": { "$ref": "/external" },
@@ -65,7 +65,7 @@ describe("JSON Browser", () => {
6565
expect(generator.next().done).to.equal(true);
6666
});
6767

68-
it("values", async () => {
68+
test("values", async () => {
6969
const jref = `{
7070
"a": 1,
7171
"b": { "$ref": "/external" },
@@ -95,7 +95,7 @@ describe("JSON Browser", () => {
9595
expect((await generator.next()).done).to.equal(true);
9696
});
9797

98-
it("entries", async () => {
98+
test("entries", async () => {
9999
const jref = `{
100100
"a": 1,
101101
"b": { "$ref": "/external" },

0 commit comments

Comments
 (0)