Socket
Socket
Sign inDemoInstall

svelte-eslint-parser

Package Overview
Dependencies
Maintainers
1
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.0.5 to 0.0.6

15

lib/ast.d.ts

@@ -15,3 +15,3 @@ import type ESTree from "estree";

export interface Token extends BaseNode {
type: "Boolean" | "Null" | "Identifier" | "Keyword" | "Punctuator" | "JSXIdentifier" | "JSXText" | "Numeric" | "String" | "RegularExpression" | "Template" | "HTMLText" | "HTMLIdentifier" | "MustacheKeyword";
type: "Boolean" | "Null" | "Identifier" | "Keyword" | "Punctuator" | "JSXIdentifier" | "JSXText" | "Numeric" | "String" | "RegularExpression" | "Template" | "HTMLText" | "HTMLIdentifier" | "MustacheKeyword" | "HTMLComment";
value: string;

@@ -29,3 +29,3 @@ }

}
export declare type SvelteNode = SvelteProgram | SvelteScriptElement | SvelteStyleElement | SvelteElement | SvelteName | SvelteText | SvelteMustacheTag | SvelteDebugTag | SvelteIfBlock | SvelteElseBlock | SvelteEachBlock | SvelteAwaitBlock | SvelteAwaitPendingBlock | SvelteAwaitThenBlock | SvelteAwaitCatchBlock | SvelteKeyBlock | SvelteAttribute | SvelteSpreadAttribute | SvelteDirective | SvelteReactiveStatement;
export declare type SvelteNode = SvelteProgram | SvelteScriptElement | SvelteStyleElement | SvelteElement | SvelteName | SvelteText | SvelteMustacheTag | SvelteDebugTag | SvelteIfBlock | SvelteElseBlock | SvelteEachBlock | SvelteAwaitBlock | SvelteAwaitPendingBlock | SvelteAwaitThenBlock | SvelteAwaitCatchBlock | SvelteKeyBlock | SvelteAttribute | SvelteSpreadAttribute | SvelteDirective | SvelteHTMLComment | SvelteReactiveStatement;
export interface SvelteProgram extends BaseNode {

@@ -54,3 +54,3 @@ type: "Program";

}
export interface SvelteHtmlElement extends BaseSvelteElement {
export interface SvelteHTMLElement extends BaseSvelteElement {
type: "SvelteElement";

@@ -79,3 +79,3 @@ kind: "html";

}
export declare type SvelteElement = SvelteHtmlElement | SvelteComponentElement | SvelteSpecialElement;
export declare type SvelteElement = SvelteHTMLElement | SvelteComponentElement | SvelteSpecialElement;
export interface SvelteName extends BaseNode {

@@ -86,3 +86,3 @@ type: "SvelteName";

}
declare type Child = SvelteElement | SvelteText | SvelteMustacheTag | SvelteDebugTag | SvelteIfBlock | SvelteEachBlock | SvelteAwaitBlock | SvelteKeyBlock;
declare type Child = SvelteElement | SvelteText | SvelteMustacheTag | SvelteDebugTag | SvelteIfBlock | SvelteEachBlock | SvelteAwaitBlock | SvelteKeyBlock | SvelteHTMLComment;
export interface SvelteText extends BaseNode {

@@ -159,2 +159,7 @@ type: "SvelteText";

}
export interface SvelteHTMLComment extends BaseNode {
type: "SvelteHTMLComment";
value: string;
parent: SvelteProgram | SvelteElement | SvelteIfBlock | SvelteElseBlock | SvelteEachBlock | SvelteAwaitPendingBlock | SvelteAwaitThenBlock | SvelteAwaitCatchBlock | SvelteKeyBlock;
}
export interface SvelteAttributeNonShorthand extends BaseNode {

@@ -161,0 +166,0 @@ type: "SvelteAttribute";

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

import type { SvelteAwaitBlock, SvelteAwaitCatchBlock, SvelteAwaitPendingBlock, SvelteAwaitThenBlock, SvelteDebugTag, SvelteEachBlock, SvelteElement, SvelteElseBlock, SvelteIfBlock, SvelteKeyBlock, SvelteMustacheTag, SvelteProgram, SvelteScriptElement, SvelteStyleElement, SvelteText } from "../../ast";
import type { SvelteAwaitBlock, SvelteAwaitCatchBlock, SvelteAwaitPendingBlock, SvelteAwaitThenBlock, SvelteDebugTag, SvelteEachBlock, SvelteElement, SvelteElseBlock, SvelteHTMLComment, SvelteIfBlock, SvelteKeyBlock, SvelteMustacheTag, SvelteProgram, SvelteScriptElement, SvelteStyleElement, SvelteText } from "../../ast";
import type { Context } from "../../context";

@@ -7,3 +7,3 @@ import type * as SvAST from "../svelte-ast-types";

children: SvAST.TemplateNode[];
}, parent: SvelteProgram | SvelteElement | SvelteIfBlock | SvelteElseBlock | SvelteEachBlock | SvelteAwaitPendingBlock | SvelteAwaitThenBlock | SvelteAwaitCatchBlock | SvelteKeyBlock, ctx: Context): IterableIterator<SvelteText | SvelteElement | SvelteMustacheTag | SvelteDebugTag | SvelteIfBlock | SvelteEachBlock | SvelteAwaitBlock | SvelteKeyBlock>;
}, parent: SvelteProgram | SvelteElement | SvelteIfBlock | SvelteElseBlock | SvelteEachBlock | SvelteAwaitPendingBlock | SvelteAwaitThenBlock | SvelteAwaitCatchBlock | SvelteKeyBlock, ctx: Context): IterableIterator<SvelteText | SvelteElement | SvelteMustacheTag | SvelteDebugTag | SvelteIfBlock | SvelteEachBlock | SvelteAwaitBlock | SvelteKeyBlock | SvelteHTMLComment>;
/** Extract element block tokens */

@@ -10,0 +10,0 @@ export declare function extractElementTokens<E extends SvelteScriptElement | SvelteElement | SvelteStyleElement>(element: E, ctx: Context, options: {

@@ -17,5 +17,3 @@ "use strict";

if (child.type === "Comment") {
const comment = Object.assign({ type: "Block", value: child.data }, ctx.getConvertLocation(child));
comment.html = true;
ctx.addComment(comment);
yield convertComment(child, parent, ctx);
continue;

@@ -28,3 +26,3 @@ }

if (child.type === "Element") {
yield convertHtmlElement(child, parent, ctx);
yield convertHTMLElement(child, parent, ctx);
continue;

@@ -101,4 +99,10 @@ }

exports.convertChildren = convertChildren;
/** Convert for HtmlElement */
function convertHtmlElement(node, parent, ctx) {
/** Convert for HTML Comment */
function convertComment(node, parent, ctx) {
const comment = Object.assign({ type: "SvelteHTMLComment", value: node.data, parent }, ctx.getConvertLocation(node));
ctx.addToken("HTMLComment", node);
return comment;
}
/** Convert for HTMLElement */
function convertHTMLElement(node, parent, ctx) {
const element = Object.assign({ type: "SvelteElement", kind: "html", name: null, attributes: [], children: [], parent }, ctx.getConvertLocation(node));

@@ -163,4 +167,4 @@ element.attributes.push(...attr_1.convertAttributes(node.attributes, element, ctx));

function convertSlotElement(node, parent, ctx) {
// Slot translates to SvelteHtmlElement.
return convertHtmlElement(node, parent, ctx);
// Slot translates to SvelteHTMLElement.
return convertHTMLElement(node, parent, ctx);
}

@@ -167,0 +171,0 @@ /** Convert for window element. e.g. <svelte:window> */

@@ -33,3 +33,4 @@ "use strict";

SvelteText: [],
SvelteHTMLComment: [],
};
exports.KEYS = eslint_visitor_keys_1.unionWith(svelteKeys);
{
"name": "svelte-eslint-parser",
"version": "0.0.5",
"version": "0.0.6",
"description": "Svelte parser for ESLint",

@@ -56,3 +56,3 @@ "main": "lib/index.js",

"@typescript-eslint/parser": "^4.9.1",
"code-red": "^0.1.4",
"code-red": "^0.2.0",
"eslint": "^7.5.0",

@@ -67,3 +67,3 @@ "eslint-config-prettier": "^8.0.0",

"eslint-plugin-vue": "^7.2.0",
"estree-walker": "^2.0.0",
"estree-walker": "^3.0.0",
"locate-character": "^2.0.5",

@@ -70,0 +70,0 @@ "magic-string": "^0.25.7",

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