Skip to content

Commit b47646a

Browse files
authored
feat: use eslint-json-compat-utils (#358)
* feat: use eslint-json-compat-utils * Create sweet-jars-collect.md
1 parent 2fe17f8 commit b47646a

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

.changeset/sweet-jars-collect.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"eslint-plugin-json-schema-validator": minor
3+
---
4+
5+
feat: use eslint-json-compat-utils

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"ajv": "^8.0.0",
5555
"debug": "^4.3.1",
5656
"eslint-compat-utils": "^0.6.0",
57+
"eslint-json-compat-utils": "^0.2.1",
5758
"json-schema-migrate": "^2.0.0",
5859
"jsonc-eslint-parser": "^2.0.0",
5960
"minimatch": "^8.0.0",

src/rules/no-invalid.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { compile } from "../utils/validator-factory";
2828
import type { SchemaObject } from "../utils/types";
2929
import fs from "fs";
3030
import { getCwd, getFilename, getSourceCode } from "../utils/compat";
31+
import { toCompatCreate } from "eslint-json-compat-utils";
3132

3233
const CATALOG_URL = "https://www.schemastore.org/api/json/catalog.json";
3334

@@ -162,7 +163,7 @@ export default createRule("no-invalid", {
162163
messages: {},
163164
type: "suggestion",
164165
},
165-
create(context, { filename }) {
166+
create: toCompatCreate((context, { filename }) => {
166167
const sourceCode = getSourceCode(context);
167168
const cwd = getCwd(context);
168169
const relativeFilename = filename.startsWith(cwd)
@@ -560,7 +561,7 @@ export default createRule("no-invalid", {
560561
},
561562
};
562563
}
563-
},
564+
}),
564565
});
565566

566567
/**

0 commit comments

Comments
 (0)