Skip to content

refactor: use actively maintained json-schema-migrate-x instead #378

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 4, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"predocs:watch": "yarn build",
"prerelease": "yarn test && yarn build",
"preversion": "yarn test && git add .",
"release": "changeset publish",
"release": "clean-pkg-json && changeset publish",
"test": "env-cmd -e test yarn mocha \"tests/src/**/*.ts\" --reporter dot --timeout 60000",
"ts": "env-cmd -e base node -r esbuild-register",
"update": "yarn ts ./tools/update && yarn lint-fix",
Expand All @@ -51,11 +51,11 @@
},
"dependencies": {
"@eslint-community/eslint-utils": "^4.3.0",
"@unts/json-schema-migrate": "^2.0.1",
"ajv": "^8.0.0",
"debug": "^4.3.1",
"eslint-compat-utils": "^0.6.0",
"eslint-compat-utils": "^0.6.5",
"eslint-json-compat-utils": "^0.2.1",
"json-schema-migrate": "^2.0.0",
"jsonc-eslint-parser": "^2.0.0",
"minimatch": "^9.0.0 || ^10.0.0",
"synckit": "^0.11.1",
Expand Down Expand Up @@ -89,7 +89,7 @@
"eslint-config-prettier": "^10.0.0",
"eslint-plugin-eslint-plugin": "^6.0.0",
"eslint-plugin-jsdoc": "^50.0.0",
"eslint-plugin-json-schema-validator": "^5.0.0",
"eslint-plugin-json-schema-validator": "link:.",
"eslint-plugin-jsonc": "^2.0.0",
"eslint-plugin-markdown": "^5.0.0",
"eslint-plugin-n": "^17.2.0",
Expand Down
12 changes: 7 additions & 5 deletions src/utils/schema.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import path from "path";
import { draft7 as migrateToDraft7 } from "@unts/json-schema-migrate";
import debugBuilder from "debug";
import fs from "fs";
import path from "path";

import type { RuleContext } from "../types";
import { syncGet, get } from "./http-client";
import debugBuilder from "debug";
import type { SchemaObject } from "./types";
import { draft7 as migrateToDraft7 } from "json-schema-migrate";
import { getCwd } from "./compat";
import { get, syncGet } from "./http-client";
import type { SchemaObject } from "./types";

const debug = debugBuilder("eslint-plugin-json-schema-validator:utils-schema");

const TTL = 1000 * 60 * 60 * 24;
Expand Down
7 changes: 4 additions & 3 deletions src/utils/validator-factory.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { draft7 as migrateToDraft7 } from "@unts/json-schema-migrate";

import type { RuleContext } from "../types";
import type {
DefinedError,
ErrorObject,
RegExpEngine,
SchemaObject,
ValidateFunction,
RegExpEngine,
} from "./ajv";
import type { RuleContext } from "../types";
import Ajv from "./ajv";
import { draft7 as migrateToDraft7 } from "json-schema-migrate";
import { loadSchema } from "./schema";

// eslint-disable-next-line func-style -- ignore
Expand Down
2 changes: 0 additions & 2 deletions tests/src/eslint-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ describe("Integration with eslint-plugin-json-schema-validator", () => {
if (semver.satisfies(ESLint.version, "<7.0.0")) return;
const engine = new ESLint({
cwd: path.join(TEST_FIXTURES_ROOT, "flat-config-test01"),
// @ts-expect-error -- typing bug
overrideConfigFile: true,
// @ts-expect-error -- typing bug
overrideConfig: plugin.configs["flat/recommended"],
});
const results = await engine.lintFiles(["src"]);
Expand Down
3 changes: 0 additions & 3 deletions tests/src/rules/no-invalid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ tester.run(
{
filename: path.join(__dirname, ".eslintrc.js"),
code: 'module.exports = { "extends": [ require.resolve("eslint-config-foo") ] }',
// @ts-expect-error -- typeerror
languageOptions: {
// eslint-disable-next-line n/no-extraneous-require -- test
parser: require("espree"),
Expand Down Expand Up @@ -74,7 +73,6 @@ tester.run(
{
filename: path.join(__dirname, ".eslintrc.js"),
code: 'module.exports = { "extends": [ 42 ] }',
// @ts-expect-error -- typeerror
languageOptions: {
// eslint-disable-next-line n/no-extraneous-require -- test
parser: require("espree"),
Expand Down Expand Up @@ -289,7 +287,6 @@ trailingComma = "es3"
tabWidth = 4
semi = false
singleQuote = true`,
// @ts-expect-error -- typeerror
languageOptions: {
parser: require("toml-eslint-parser"),
},
Expand Down
Loading