Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

svelte-eslint-parser

Package Overview
Dependencies
Maintainers
1
Versions
113
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.3.0 to 0.4.0

4

lib/ast.d.ts

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

name: string;
parent: SvelteElement | SvelteScriptElement | SvelteStyleElement | SvelteAttribute | SvelteMemberExpressionName;
parent: SvelteElement | SvelteScriptElement | SvelteStyleElement | SvelteAttribute | SvelteMemberExpressionName | SvelteDirectiveKey;
}

@@ -237,3 +237,3 @@ /** Nodes that may be used in component names. The component names separated by dots. */

type: "SvelteDirectiveKey";
name: ESTree.Identifier;
name: ESTree.Identifier | SvelteName;
modifiers: string[];

@@ -240,0 +240,0 @@ parent: SvelteDirective;

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

import type { SvelteLetDirective, SvelteNode } from "../ast";
import type { SvelteLetDirective, SvelteName, SvelteNode } from "../ast";
import type * as ESTree from "estree";

@@ -8,7 +8,7 @@ import type { ScriptLetCallback, ScriptLetCallbackOption } from "./script-let";

isEmpty(): boolean;
getLetParams(): ESTree.Pattern[];
getLetParams(): (ESTree.Pattern | SvelteName)[];
getParents(): SvelteNode[];
getCallback(): (nodes: ESTree.Pattern[], options: ScriptLetCallbackOption) => void;
getTypes(): string[];
addPattern(pattern: ESTree.Pattern, directive: SvelteLetDirective, typing: string, ...callbacks: ScriptLetCallback<ESTree.Pattern>[]): ScriptLetCallback<ESTree.Pattern>[];
addPattern(pattern: ESTree.Pattern | SvelteName, directive: SvelteLetDirective, typing: string, ...callbacks: ScriptLetCallback<ESTree.Pattern>[]): ScriptLetCallback<ESTree.Pattern>[];
}

@@ -15,0 +15,0 @@ export declare class LetDirectiveCollections {

import type { ScopeManager, Scope } from "eslint-scope";
import type * as ESTree from "estree";
import type { Context } from ".";
import type { Comment, SvelteEachBlock, SvelteIfBlock, SvelteNode, Token } from "../ast";
import type { Comment, SvelteEachBlock, SvelteIfBlock, SvelteName, SvelteNode, Token } from "../ast";
import type { ESLintExtendedProgram } from "../parser";

@@ -36,3 +36,3 @@ export declare type ScriptLetCallback<E extends ESTree.Node> = (es: E, options: ScriptLetCallbackOption) => void;

constructor(ctx: Context);
addExpression<E extends ESTree.Expression>(expression: E, parent: SvelteNode, typing?: string | null, ...callbacks: ScriptLetCallback<E>[]): ScriptLetCallback<E>[];
addExpression<E extends ESTree.Expression>(expression: E | SvelteName, parent: SvelteNode, typing?: string | null, ...callbacks: ScriptLetCallback<E>[]): ScriptLetCallback<E>[];
nestIfBlock(expression: ESTree.Expression, ifBlock: SvelteIfBlock, callback: ScriptLetCallback<ESTree.Expression>): void;

@@ -44,3 +44,3 @@ nestEachBlock(expression: ESTree.Expression, context: ESTree.Pattern, indexRange: {

nestBlock(block: SvelteNode): void;
nestBlock(block: SvelteNode, params: ESTree.Pattern[], parents: SvelteNode[], callback: (nodes: ESTree.Pattern[], options: ScriptLetCallbackOption) => void, typings: string[]): void;
nestBlock(block: SvelteNode, params: (ESTree.Pattern | SvelteName)[], parents: SvelteNode[], callback: (nodes: ESTree.Pattern[], options: ScriptLetCallbackOption) => void, typings: string[]): void;
closeScope(): void;

@@ -47,0 +47,0 @@ private appendScript;

@@ -222,10 +222,15 @@ "use strict";

}
let isShorthand = false;
let isShorthandExpression = false;
if (node.expression) {
isShorthand =
isShorthandExpression =
node.expression.type === "Identifier" &&
node.expression.name === node.name &&
common_1.getWithLoc(node.expression).start === nameRange.start &&
common_1.getWithLoc(node.expression).end === nameRange.end;
processExpression(node.expression).push((es) => {
common_1.getWithLoc(node.expression).start === nameRange.start;
if (isShorthandExpression &&
common_1.getWithLoc(node.expression).end !== nameRange.end) {
// The identifier location may be incorrect in some edge cases.
// e.g. bind:value=""
common_1.getWithLoc(node.expression).end = nameRange.end;
}
processExpression(node.expression, isShorthandExpression).push((es) => {
directive.expression = es;

@@ -236,4 +241,4 @@ });

// put name
key.name = Object.assign({ type: "Identifier", name: node.name, parent: key }, ctx.getConvertLocation(nameRange));
if (!isShorthand) {
key.name = Object.assign({ type: "SvelteName", name: node.name, parent: key }, ctx.getConvertLocation(nameRange));
if (!isShorthandExpression) {
if (processName) {

@@ -240,0 +245,0 @@ processName(key.name).push((es) => {

{
"name": "svelte-eslint-parser",
"version": "0.3.0",
"version": "0.4.0",
"description": "Svelte parser for ESLint",

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

"eslint-scope": "^5.1.1",
"eslint-visitor-keys": "^2.0.0",
"eslint-visitor-keys": "^3.0.0",
"espree": "^7.3.1"

@@ -49,3 +49,3 @@ },

"@ota-meshi/eslint-plugin": "^0.7.0",
"@ota-meshi/eslint-plugin-svelte": "0.2.0",
"@ota-meshi/eslint-plugin-svelte": "0.4.1",
"@types/eslint": "^7.2.0",

@@ -52,0 +52,0 @@ "@types/eslint-scope": "^3.7.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