Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"codemirror": "^6.0.2",
"eslint-linter-browserify": "^9.39.2",
"eslint-scope": "^8.4.0",
"espree": "^10.4.0",
"espree": "^11.1.0",
"esquery": "^1.6.0",
"graphviz-react": "^1.2.5",
"lucide-react": "^0.562.0",
Expand All @@ -73,7 +73,6 @@
"devDependencies": {
"@eslint/core": "^0.17.0",
"@types/eslint-scope": "^8.3.2",
"@types/espree": "^10.1.0",
"@types/esquery": "^1.5.4",
"@types/node": "^20.19.27",
"@types/react": "^19.2.7",
Expand Down
4 changes: 2 additions & 2 deletions src/components/labeled-select.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { EcmaVersion } from "espree";
import { Label } from "@/components/ui/label";
import {
Select,
Expand All @@ -6,11 +7,10 @@ import {
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
import { Version } from "@/hooks/use-explorer";

type OnValueChangeType = (value: string) => void;
type ItemsType = {
value: string | Version;
value: string | EcmaVersion;
label: string;
icon?: string;
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/options.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { EcmaVersion } from "espree";
import { Settings } from "lucide-react";
import {
Popover,
Expand All @@ -14,7 +15,6 @@ import {
type MarkdownMode,
type MarkdownFrontmatter,
type SourceType,
type Version,
type TemplateEngineSyntax,
} from "@/hooks/use-explorer";
import {
Expand Down Expand Up @@ -152,7 +152,7 @@ const JavaScriptPanel: FC = () => {
label="ECMAScript Version"
value={esVersion as string}
onValueChange={(value: string) => {
const esVersion = value as Version;
const esVersion = value as EcmaVersion;
setJsOptions({ ...jsOptions, esVersion });
}}
items={versions}
Expand Down
1 change: 0 additions & 1 deletion src/hooks/use-ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export function useAST() {
loc: true,
comment: true,
tokens: true,
// @ts-expect-error mismatch between the latest release of `espree` and `@types/espree`.
ecmaVersion: jsOptions.esVersion,
sourceType: jsOptions.sourceType,
ecmaFeatures: {
Expand Down
5 changes: 2 additions & 3 deletions src/hooks/use-explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
StateStorage,
createJSONStorage,
} from "zustand/middleware";
import type { Options } from "espree";
import type { EcmaVersion, Options } from "espree";
import {
defaultCode,
defaultJsOptions,
Expand All @@ -18,7 +18,6 @@ import {
} from "../lib/const";

export type SourceType = Exclude<Options["sourceType"], undefined>;
export type Version = Exclude<Options["ecmaVersion"], undefined> | 17 | 2026;
export type Language = "javascript" | "json" | "markdown" | "css" | "html";
export type JsonMode = "json" | "jsonc" | "json5";
export type MarkdownMode = "commonmark" | "gfm";
Expand All @@ -36,7 +35,7 @@ export type Code = {
export type JsOptions = {
parser: string;
sourceType: SourceType;
esVersion: Version;
esVersion: EcmaVersion;
isJSX: boolean;
};

Expand Down
4 changes: 2 additions & 2 deletions src/lib/const.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { EcmaVersion } from "espree";
import {
AlignLeftIcon,
CodeIcon,
Expand All @@ -7,7 +8,6 @@ import {
} from "lucide-react";
import type {
SourceType,
Version,
JsOptions,
JsonOptions,
MarkdownOptions,
Expand Down Expand Up @@ -73,7 +73,7 @@ export const sourceTypes: {
];

export const versions: {
value: Version;
value: EcmaVersion;
label: string;
}[] = [
{
Expand Down
5 changes: 3 additions & 2 deletions src/lib/generate-code-path.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// @ts-nocheck

import { Linter } from "eslint-linter-browserify";
import type { EcmaVersion } from "espree";
import { CodePathStack } from "@/lib/code-path-stack";
import type { SourceType, Version } from "@/hooks/use-explorer";
import type { SourceType } from "@/hooks/use-explorer";

const makeDotArrows = codePath => {
const stack = [{ segment: codePath.initialSegment, index: 0 }];
Expand Down Expand Up @@ -55,7 +56,7 @@ const makeDotArrows = codePath => {

export const generateCodePath = async (
code: string,
esVersion: Version,
esVersion: EcmaVersion,
sourceType: SourceType,
isJSX: boolean,
): Promise<
Expand Down