diff --git a/.changeset/eight-timers-tickle.md b/.changeset/eight-timers-tickle.md new file mode 100644 index 00000000..4768f7bc --- /dev/null +++ b/.changeset/eight-timers-tickle.md @@ -0,0 +1,5 @@ +--- +"eslint-plugin-json-schema-validator": patch +--- + +fix: update schemastore catlog url diff --git a/src/rules/no-invalid.ts b/src/rules/no-invalid.ts index 0fd87dfb..4a8f6f9d 100644 --- a/src/rules/no-invalid.ts +++ b/src/rules/no-invalid.ts @@ -25,7 +25,7 @@ import fs from "fs"; import { getCwd, getFilename, getSourceCode } from "../utils/compat"; import { toCompatCreate } from "eslint-json-compat-utils"; -const CATALOG_URL = "https://www.schemastore.org/api/json/catalog.json"; +const CATALOG_URL = "https://json.schemastore.org/api/json/catalog.json"; /** * Checks if match file diff --git a/src/utils/ast/js/utils.ts b/src/utils/ast/js/utils.ts index 3a5427c9..5a05d90a 100644 --- a/src/utils/ast/js/utils.ts +++ b/src/utils/ast/js/utils.ts @@ -1,10 +1,8 @@ -// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair -- ignore -/* eslint-disable @typescript-eslint/no-explicit-any -- ignore */ -import type { AST } from "vue-eslint-parser"; -import type { RuleContext } from "../../../types"; -// @ts-expect-error -- no type def import * as eslintUtils from "@eslint-community/eslint-utils"; import type { Variable } from "eslint-scope"; +import type { AST } from "vue-eslint-parser"; + +import type { RuleContext } from "../../../types"; import { getSourceCode } from "../../compat"; /** @@ -58,8 +56,8 @@ export function getStringLiteralValue( ): string | null { if (node.type === "Literal") { if (node.value == null) { - if ((node as any).bigint != null) { - return String((node as any).bigint); + if (node.bigint != null) { + return String(node.bigint); } } return String(node.value); @@ -88,8 +86,12 @@ function findVariable( export function getStaticValue( context: RuleContext, node: AST.ESLintNode, -): { value: any } | null { - return eslintUtils.getStaticValue(node, getScope(context, node)); +): { value?: unknown; optional?: boolean } | null { + return eslintUtils.getStaticValue( + // @ts-expect-error -- `eslintUtils` is typed now but incompatible with Vue AST typings + node, + getScope(context, node), + ); } /** @@ -140,9 +142,13 @@ function getScope(context: RuleContext, currentNode: AST.ESLintNode) { const inner = currentNode.type !== "Program"; const scopeManager = getSourceCode(context).scopeManager; - let node: any = currentNode; + let node: AST.Node | null = currentNode; for (; node; node = node.parent || null) { - const scope = scopeManager.acquire(node, inner); + const scope = scopeManager.acquire( + // @ts-expect-error -- incompatible with Vue AST typings + node, + inner, + ); if (scope) { if (scope.type === "function-expression-name") {