Socket
Socket
Sign inDemoInstall

svelte-eslint-parser

Package Overview
Dependencies
Maintainers
4
Versions
111
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-eslint-parser - npm Package Compare versions

Comparing version 0.39.2 to 0.40.0

lib/parser/svelte-ast-types-for-v5.d.ts

4

lib/context/index.d.ts
import type { Comment, Locations, SvelteElement, SvelteHTMLElement, SvelteScriptElement, SvelteSnippetBlock, SvelteStyleElement, Token } from "../ast";
import type ESTree from "estree";
import type * as SvAST from "../parser/svelte-ast-types";
import type * as Compiler from "svelte/compiler";
import type * as Compiler from "../parser/svelte-ast-types-for-v5";
import { ScriptLetContext } from "./script-let";

@@ -43,3 +43,3 @@ import { LetDirectiveCollections } from "./let-directive-collection";

readonly slots: Set<SvelteHTMLElement>;
readonly elements: Map<SvelteElement, SvAST.Element | SvAST.InlineComponent | SvAST.Window | SvAST.Document | SvAST.Body | SvAST.Head | SvAST.Title | SvAST.Options | SvAST.SlotTemplate | SvAST.Slot | Compiler.Component | Compiler.TitleElement | Compiler.SlotElement | Compiler.RegularElement | Compiler.SvelteBody | Compiler.SvelteComponent | Compiler.SvelteDocument | Compiler.SvelteElement | Compiler.SvelteFragment | Compiler.SvelteHead | Compiler.SvelteOptionsRaw | Compiler.SvelteSelf | Compiler.SvelteWindow>;
readonly elements: Map<SvelteElement, SvAST.Element | SvAST.InlineComponent | SvAST.Window | SvAST.Document | SvAST.Body | SvAST.Head | SvAST.Title | SvAST.Options | SvAST.SlotTemplate | SvAST.Slot | Compiler.ElementLike>;
readonly snippets: SvelteSnippetBlock[];

@@ -46,0 +46,0 @@ private readonly state;

export declare const name = "svelte-eslint-parser";
export declare const version = "0.39.2";
export declare const version = "0.40.0";

@@ -8,2 +8,2 @@ "use strict";

exports.name = "svelte-eslint-parser";
exports.version = "0.39.2";
exports.version = "0.40.0";
/** Compatibility for Svelte v4 <-> v5 */
import type ESTree from "estree";
import type * as SvAST from "./svelte-ast-types";
import type * as Compiler from "svelte/compiler";
import type * as Compiler from "./svelte-ast-types-for-v5";
export type Child = Compiler.Text | Compiler.Tag | Compiler.ElementLike | Compiler.Block | Compiler.Comment;

@@ -6,0 +6,0 @@ type HasChildren = {

import type { SvelteAttribute, SvelteShorthandAttribute, SvelteDirective, SvelteSpreadAttribute, SvelteStartTag, SvelteStyleDirective } from "../../ast";
import type { Context } from "../../context";
import type * as SvAST from "../svelte-ast-types";
import type * as Compiler from "svelte/compiler";
import type * as Compiler from "../svelte-ast-types-for-v5";
/** Convert for Attributes */
export declare function convertAttributes(attributes: (SvAST.AttributeOrDirective | Compiler.Attribute | Compiler.SpreadAttribute | Compiler.Directive)[], parent: SvelteStartTag, ctx: Context): IterableIterator<SvelteAttribute | SvelteShorthandAttribute | SvelteSpreadAttribute | SvelteDirective | SvelteStyleDirective>;
import type * as SvAST from "../svelte-ast-types";
import type * as Compiler from "svelte/compiler";
import type * as Compiler from "../svelte-ast-types-for-v5";
import type { SvelteAwaitBlock, SvelteEachBlock, SvelteIfBlock, SvelteIfBlockAlone, SvelteIfBlockElseIf, SvelteKeyBlock, SvelteSnippetBlock } from "../../ast";
import type { Context } from "../../context";
export declare function convertIfBlock(node: SvAST.IfBlock | Compiler.IfBlock, parent: SvelteIfBlock["parent"], ctx: Context): SvelteIfBlockAlone;
export declare function convertIfBlock(node: SvAST.IfBlock | Compiler.IfBlock, parent: SvelteIfBlock["parent"], ctx: Context, elseif: true): SvelteIfBlockElseIf;
export declare function convertIfBlock(node: SvAST.IfBlock | Compiler.IfBlock, parent: SvelteIfBlock["parent"], ctx: Context, elseifContext?: {
start: number;
}): SvelteIfBlockElseIf;
/** Convert for EachBlock */

@@ -8,0 +10,0 @@ export declare function convertEachBlock(node: SvAST.EachBlock | Compiler.EachBlock, parent: SvelteEachBlock["parent"], ctx: Context): SvelteEachBlock;

@@ -49,6 +49,8 @@ "use strict";

/** Convert for IfBlock */
function convertIfBlock(node, parent, ctx, elseif) {
function convertIfBlock(node, parent, ctx, elseifContext) {
var _a;
// {#if expr} {:else} {/if}
// {:else if expr} {/if}
const nodeStart = startBlockIndex(ctx.code, elseif ? node.start - 1 : node.start, elseif ? ":else" : "#if");
const elseif = Boolean(elseifContext);
const nodeStart = startBlockIndex(ctx.code, (_a = elseifContext === null || elseifContext === void 0 ? void 0 : elseifContext.start) !== null && _a !== void 0 ? _a : node.start, elseif ? ":else" : "#if");
const ifBlock = Object.assign({ type: "SvelteIfBlock", elseif: Boolean(elseif), expression: null, children: [], else: null, parent }, ctx.getConvertLocation({ start: nodeStart, end: node.end }));

@@ -85,3 +87,5 @@ const test = (0, compat_1.getTestFromIfBlock)(node);

ifBlock.else = elseBlock;
const elseIfBlock = convertIfBlock(c, elseBlock, ctx, true);
const elseIfBlock = convertIfBlock(c, elseBlock, ctx, {
start: elseStart,
});
// adjust loc

@@ -113,18 +117,17 @@ elseBlock.range[1] = elseIfBlock.range[1];

function startBlockIndexForElse(elseFragment, beforeFragment, lastExpression, ctx) {
let baseStart;
const elseChildren = (0, compat_1.getChildren)(elseFragment);
if (elseChildren.length > 0) {
const c = elseChildren[0];
baseStart = c.start;
if (c.type === "IfBlock" && c.elseif) {
baseStart = Math.min(baseStart, (0, common_1.getWithLoc)((0, compat_1.getTestFromIfBlock)(c)).start);
const contentStart = (0, common_1.getWithLoc)((0, compat_1.getTestFromIfBlock)(c)).start;
if (contentStart <= c.start) {
return startBlockIndex(ctx.code, contentStart - 1, ":else");
}
}
return startBlockIndex(ctx.code, c.start, ":else");
}
else {
const beforeEnd = endIndexFromFragment(beforeFragment, () => {
return ctx.code.indexOf("}", (0, common_1.getWithLoc)(lastExpression).end) + 1;
});
baseStart = beforeEnd + 1;
}
return startBlockIndex(ctx.code, baseStart - 1, ":else");
const beforeEnd = endIndexFromFragment(beforeFragment, () => {
return ctx.code.indexOf("}", (0, common_1.getWithLoc)(lastExpression).end) + 1;
});
return startBlockIndex(ctx.code, beforeEnd, ":else");
}

@@ -131,0 +134,0 @@ /** Convert for EachBlock */

import type { SvelteConstTag } from "../../ast";
import type { Context } from "../../context";
import type * as SvAST from "../svelte-ast-types";
import type * as Compiler from "svelte/compiler";
import type * as Compiler from "../svelte-ast-types-for-v5";
/** Convert for ConstTag */
export declare function convertConstTag(node: SvAST.ConstTag | Compiler.ConstTag, parent: SvelteConstTag["parent"], ctx: Context): SvelteConstTag;
import type { SvelteAwaitBlock, SvelteAwaitCatchBlock, SvelteAwaitPendingBlock, SvelteAwaitThenBlock, SvelteConstTag, SvelteDebugTag, SvelteEachBlock, SvelteElement, SvelteElseBlockAlone, SvelteHTMLComment, SvelteIfBlock, SvelteIfBlockAlone, SvelteKeyBlock, SvelteMustacheTag, SvelteProgram, SvelteRenderTag, SvelteScriptElement, SvelteSnippetBlock, SvelteStyleElement, SvelteText } from "../../ast";
import type { Context } from "../../context";
import type * as SvAST from "../svelte-ast-types";
import type * as Compiler from "svelte/compiler";
import type * as Compiler from "../svelte-ast-types-for-v5";
import type { Child } from "../compat";

@@ -6,0 +6,0 @@ /** Convert for Fragment or Element or ... */

import type { SvelteDebugTag, SvelteMustacheTag, SvelteMustacheTagRaw, SvelteMustacheTagText } from "../../ast";
import type { Context } from "../../context";
import type * as SvAST from "../svelte-ast-types";
import type * as Compiler from "svelte/compiler";
import type * as Compiler from "../svelte-ast-types-for-v5";
/** Convert for MustacheTag */

@@ -6,0 +6,0 @@ export declare function convertMustacheTag(node: SvAST.MustacheTag | Compiler.ExpressionTag, parent: SvelteMustacheTag["parent"], typing: string | null, ctx: Context): SvelteMustacheTagText;

import type { SvelteRenderTag } from "../../ast";
import type { Context } from "../../context";
import type * as Compiler from "svelte/compiler";
import type * as Compiler from "../svelte-ast-types-for-v5";
/** Convert for RenderTag */
export declare function convertRenderTag(node: Compiler.RenderTag, parent: SvelteRenderTag["parent"], ctx: Context): SvelteRenderTag;
import type * as SvAST from "../svelte-ast-types";
import type * as Compiler from "svelte/compiler";
import type * as Compiler from "../svelte-ast-types-for-v5";
import type { SvelteProgram } from "../../ast";

@@ -4,0 +4,0 @@ import type { Context } from "../../context";

@@ -1,2 +0,2 @@

import type * as Compiler from "svelte/compiler";
import type * as Compiler from "./svelte-ast-types-for-v5";
/** Parse HTML attributes */

@@ -3,0 +3,0 @@ export declare function parseAttributes(code: string, startIndex: number): {

@@ -5,3 +5,3 @@ import type { Comment, SvelteProgram, Token } from "../ast";

import type * as SvAST from "./svelte-ast-types";
import type * as Compiler from "svelte/compiler";
import type * as Compiler from "./svelte-ast-types-for-v5";
import { type StyleContext, type StyleContextNoStyleElement, type StyleContextParseError, type StyleContextSuccess, type StyleContextUnknownLang } from "./style-context";

@@ -8,0 +8,0 @@ import { type SvelteParseContext } from "./svelte-parse-context";

@@ -1,2 +0,2 @@

import type * as Compiler from "svelte/compiler";
import type * as Compiler from "./svelte-ast-types-for-v5";
import type * as SvAST from "./svelte-ast-types";

@@ -3,0 +3,0 @@ import type { NormalizedParserOptions } from "./parser-options";

@@ -1,2 +0,2 @@

import type * as Compiler from "svelte/compiler";
import type * as Compiler from "./svelte-ast-types-for-v5";
import type * as SvAST from "./svelte-ast-types";

@@ -3,0 +3,0 @@ import type { Context } from "../context";

{
"name": "svelte-eslint-parser",
"version": "0.39.2",
"version": "0.40.0",
"description": "Svelte parser for ESLint",

@@ -29,3 +29,3 @@ "repository": "git+https://github.com/sveltejs/svelte-eslint-parser.git",

"peerDependencies": {
"svelte": "^3.37.0 || ^4.0.0 || ^5.0.0-next.115"
"svelte": "^3.37.0 || ^4.0.0 || ^5.0.0-next.181"
},

@@ -41,3 +41,3 @@ "peerDependenciesMeta": {

"espree": "^9.6.1",
"postcss": "^8.4.38",
"postcss": "^8.4.39",
"postcss-scss": "^4.0.9"

@@ -47,4 +47,4 @@ },

"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.5",
"@changesets/get-release-plan": "^4.0.2",
"@changesets/cli": "^2.27.7",
"@changesets/get-release-plan": "^4.0.3",
"@ota-meshi/eslint-plugin": "^0.15.3",

@@ -57,12 +57,12 @@ "@types/benchmark": "^2.1.5",

"@types/estree": "^1.0.5",
"@types/mocha": "^10.0.6",
"@types/node": "^20.14.4",
"@types/mocha": "^10.0.7",
"@types/node": "^20.14.10",
"@types/semver": "^7.5.8",
"@typescript-eslint/eslint-plugin": "^7.13.1",
"@typescript-eslint/parser": "~7.13.1",
"@typescript-eslint/types": "~7.13.1",
"@typescript-eslint/eslint-plugin": "^7.16.0",
"@typescript-eslint/parser": "~7.16.0",
"@typescript-eslint/types": "~7.16.0",
"benchmark": "^2.1.4",
"chai": "^4.4.1",
"env-cmd": "^10.1.0",
"esbuild": "^0.21.5",
"esbuild": "^0.23.0",
"esbuild-register": "^3.5.0",

@@ -72,3 +72,3 @@ "eslint": "^8.57.0",

"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-json-schema-validator": "^5.1.0",
"eslint-plugin-json-schema-validator": "^5.1.2",
"eslint-plugin-jsonc": "^2.16.0",

@@ -79,3 +79,3 @@ "eslint-plugin-n": "^17.9.0",

"eslint-plugin-regexp": "^2.6.0",
"eslint-plugin-svelte": "^2.40.0",
"eslint-plugin-svelte": "^2.41.0",
"eslint-plugin-yml": "^1.14.0",

@@ -85,3 +85,3 @@ "estree-walker": "^3.0.3",

"magic-string": "^0.30.10",
"mocha": "^10.4.0",
"mocha": "^10.6.0",
"mocha-chai-jest-snapshot": "^1.1.4",

@@ -91,8 +91,8 @@ "nyc": "^17.0.0",

"prettier-plugin-pkg": "^0.18.1",
"prettier-plugin-svelte": "^3.2.4",
"rimraf": "^5.0.7",
"prettier-plugin-svelte": "^3.2.5",
"rimraf": "^6.0.0",
"semver": "^7.6.2",
"svelte": "^5.0.0-next.158",
"svelte2tsx": "^0.7.10",
"typescript": "~5.5.0",
"svelte": "^5.0.0-next.181",
"svelte2tsx": "^0.7.13",
"typescript": "~5.5.3",
"typescript-eslint-parser-for-extra-files": "^0.7.0"

@@ -99,0 +99,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc