Skip to content

Commit 095514c

Browse files
committed
feat: use eslint-json-compat-utils
1 parent 8acdc34 commit 095514c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

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)