diff --git a/explorer-v2/src/app.html b/explorer-v2/src/app.html index 1930861a..2f321182 100644 --- a/explorer-v2/src/app.html +++ b/explorer-v2/src/app.html @@ -5,10 +5,10 @@ - %svelte.head% + %sveltekit.head% -
%svelte.body%
+
%sveltekit.body%
diff --git a/src/parser/analyze-scope.ts b/src/parser/analyze-scope.ts index 89c93915..1c942662 100644 --- a/src/parser/analyze-scope.ts +++ b/src/parser/analyze-scope.ts @@ -27,7 +27,7 @@ export function analyzeScope( ignoreEval: true, nodejsScope: false, impliedStrict: ecmaFeatures.impliedStrict, - ecmaVersion, + ecmaVersion: typeof ecmaVersion === "number" ? ecmaVersion : 2022, sourceType, fallback: getFallbackKeys, }) diff --git a/tests/src/parser/eslint.ts b/tests/src/parser/eslint.ts index 7250ac20..281c38d3 100644 --- a/tests/src/parser/eslint.ts +++ b/tests/src/parser/eslint.ts @@ -1,5 +1,6 @@ import { Linter } from "eslint" import assert from "assert" +import semver from "semver" import * as parser from "../../../src/index" import { BASIC_PARSER_OPTIONS } from "./test-utils" @@ -52,6 +53,7 @@ describe("eslint custom parser", () => { line: number column: number }[] + parserOptions?: any }[] = [ { code: ` @@ -217,14 +219,37 @@ describe("eslint custom parser", () => { output: null, messages: [], }, + ...(semver.satisfies( + // eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires -- ignore + require("eslint/package.json").version, + ">=8.0.0", + ) + ? [ + { + // test for ecmaVersion latest + code: ` + +

The count is {$count}

+ `, + output: null, + parserOptions: { ecmaVersion: "latest" }, + messages: [], + }, + ] + : []), ] - for (const { code, output, messages } of tests) { + for (const { code, output, messages, parserOptions } of tests) { it(code, () => { const linter = createLinter() const result = linter.verifyAndFix(code, { parser: "svelte-eslint-parser", - parserOptions: BASIC_PARSER_OPTIONS, + parserOptions: { + ...BASIC_PARSER_OPTIONS, + ...(parserOptions ? parserOptions : {}), + }, rules: { "no-unused-labels": "error", "no-extra-label": "error",