Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
jdesrosiers committed Dec 18, 2024
1 parent 026feda commit 6ca978e
Show file tree
Hide file tree
Showing 19 changed files with 201 additions and 311 deletions.
177 changes: 0 additions & 177 deletions .eslintrc.json

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ jobs:
- run: npm install
- run: npm test
- run: npm run lint
- run: npm run type-check
4 changes: 1 addition & 3 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
.github/
.eslintrc.json
eslint.config.js
**/*.spec.ts
tsconfig.json
lib/jref/SPECIFICATION.md
scratch/
TODO
rollup.config.js
dist/
lib/urn-scheme-plugin.js
66 changes: 66 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import js from "@eslint/js";
import stylistic from "@stylistic/eslint-plugin";
import importPlugin from "eslint-plugin-import";
import globals from "globals";
import tseslint from "typescript-eslint";


export default [
js.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
...tseslint.configs.stylisticTypeChecked,
importPlugin.flatConfigs.recommended,
stylistic.configs.customize({
arrowParens: true,
braceStyle: "1tbs",
commaDangle: "never",
flat: true,
jsx: false,
quotes: "double",
semi: true
}),
{
languageOptions: {
ecmaVersion: "latest",
globals: {
...globals.node
},
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname
}
},
settings: {
"import/resolver": {
node: {},
typescript: {}
}
},
rules: {
// JavaScript
"no-console": ["error"],
"no-empty-function": "off",
"no-fallthrough": "off",

// TypeScript
"@typescript-eslint/no-unused-vars": ["error", { caughtErrorsIgnorePattern: "^_" }],
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/consistent-type-definitions": ["error", "type"],

// Imports
"import/extensions": ["error", "ignorePackages"],
"import/newline-after-import": ["error", { count: 2, exactCount: false, considerComments: true }],

// Stylistic
"@stylistic/multiline-ternary": "off",
"@stylistic/no-mixed-operators": "off",
"@stylistic/no-multiple-empty-lines": ["error", { max: 2, maxEOF: 0, maxBOF: 0 }], // Allow max=2 for imports
"@stylistic/quote-props": ["error", "consistent"],
"@stylistic/yield-star-spacing": ["error", "after"]
}
},
{
files: ["**/*.js"],
...tseslint.configs.disableTypeChecked
}
];
20 changes: 10 additions & 10 deletions lib/browser/embedded.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, it, beforeEach, afterEach, expect, beforeAll, afterAll } from "vitest";
import { describe, test, beforeEach, afterEach, expect, beforeAll, afterAll } from "vitest";
import { MockAgent, setGlobalDispatcher } from "undici";
import { get, addMediaTypePlugin, removeMediaTypePlugin } from "../index.js";
import { parse, stringify } from "../jref/index.js";
Expand Down Expand Up @@ -32,7 +32,7 @@ describe("JSON Browser", () => {
};
addMediaTypePlugin(testMediaType, {
parse: async (response) => parseToDocument(response.url, await response.text()),
fileMatcher: async (path) => path.endsWith(".embedded")
fileMatcher: async (path) => path.endsWith(".embedded") // eslint-disable-line @typescript-eslint/require-await
});
});

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

let mockAgent: MockAgent;

beforeEach(async () => {
beforeEach(() => {
mockAgent = new MockAgent();
mockAgent.disableNetConnect();
setGlobalDispatcher(mockAgent);
Expand All @@ -52,7 +52,7 @@ describe("JSON Browser", () => {
await mockAgent.close();
});

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

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

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

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

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

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

it("a cached document takes precence over an embedded document", async () => {
test("a cached document takes precence over an embedded document", async () => {
const cachedJrefEmbedded = `{
"foo": { "$ref": "/main" }
}`;
Expand Down
10 changes: 5 additions & 5 deletions lib/browser/generators.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, it, beforeEach, afterEach, expect } from "vitest";
import { describe, test, beforeEach, afterEach, expect } from "vitest";
import { MockAgent, setGlobalDispatcher } from "undici";
import { get, value, iter, keys, values, entries } from "../index.js";
import type { Browser } from "../index.js";
Expand All @@ -19,7 +19,7 @@ describe("JSON Browser", () => {
await mockAgent.close();
});

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

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

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

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

it("entries", async () => {
test("entries", async () => {
const jref = `{
"a": 1,
"b": { "$ref": "/external" },
Expand Down
Loading

0 comments on commit 6ca978e

Please sign in to comment.