Skip to content

Commit de55f01

Browse files
authored
fix: update schemastore catlog url (#387)
1 parent 327e06f commit de55f01

File tree

3 files changed

+23
-12
lines changed

3 files changed

+23
-12
lines changed

.changeset/eight-timers-tickle.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": patch
3+
---
4+
5+
fix: update schemastore catlog url

src/rules/no-invalid.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import fs from "fs";
2525
import { getCwd, getFilename, getSourceCode } from "../utils/compat";
2626
import { toCompatCreate } from "eslint-json-compat-utils";
2727

28-
const CATALOG_URL = "https://www.schemastore.org/api/json/catalog.json";
28+
const CATALOG_URL = "https://json.schemastore.org/api/json/catalog.json";
2929

3030
/**
3131
* Checks if match file

src/utils/ast/js/utils.ts

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair -- ignore
2-
/* eslint-disable @typescript-eslint/no-explicit-any -- ignore */
3-
import type { AST } from "vue-eslint-parser";
4-
import type { RuleContext } from "../../../types";
5-
// @ts-expect-error -- no type def
61
import * as eslintUtils from "@eslint-community/eslint-utils";
72
import type { Variable } from "eslint-scope";
3+
import type { AST } from "vue-eslint-parser";
4+
5+
import type { RuleContext } from "../../../types";
86
import { getSourceCode } from "../../compat";
97

108
/**
@@ -58,8 +56,8 @@ export function getStringLiteralValue(
5856
): string | null {
5957
if (node.type === "Literal") {
6058
if (node.value == null) {
61-
if ((node as any).bigint != null) {
62-
return String((node as any).bigint);
59+
if (node.bigint != null) {
60+
return String(node.bigint);
6361
}
6462
}
6563
return String(node.value);
@@ -88,8 +86,12 @@ function findVariable(
8886
export function getStaticValue(
8987
context: RuleContext,
9088
node: AST.ESLintNode,
91-
): { value: any } | null {
92-
return eslintUtils.getStaticValue(node, getScope(context, node));
89+
): { value?: unknown; optional?: boolean } | null {
90+
return eslintUtils.getStaticValue(
91+
// @ts-expect-error -- `eslintUtils` is typed now but incompatible with Vue AST typings
92+
node,
93+
getScope(context, node),
94+
);
9395
}
9496

9597
/**
@@ -140,9 +142,13 @@ function getScope(context: RuleContext, currentNode: AST.ESLintNode) {
140142
const inner = currentNode.type !== "Program";
141143
const scopeManager = getSourceCode(context).scopeManager;
142144

143-
let node: any = currentNode;
145+
let node: AST.Node | null = currentNode;
144146
for (; node; node = node.parent || null) {
145-
const scope = scopeManager.acquire(node, inner);
147+
const scope = scopeManager.acquire(
148+
// @ts-expect-error -- incompatible with Vue AST typings
149+
node,
150+
inner,
151+
);
146152

147153
if (scope) {
148154
if (scope.type === "function-expression-name") {

0 commit comments

Comments
 (0)