eslint-plugin-svelte3
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -0,1 +1,5 @@ | ||
# v1.2.1 | ||
- Avoid mutating the AST while linting, which can have adverse effects | ||
# v1.2.0 | ||
@@ -2,0 +6,0 @@ |
19
index.js
@@ -6,2 +6,3 @@ 'use strict'; | ||
let compiler_options, messages, transformed_code, ignore_warnings, lint_template, translations; | ||
const skipping = new WeakSet(); | ||
@@ -215,11 +216,17 @@ // get the total length, number of lines, and length of the last line of a string | ||
enter(node) { | ||
if (skipping.has(node)) { | ||
this.skip(); | ||
} | ||
if (node.context && typeof node.context === 'object') { | ||
// find all the variables declared in this context (potentially involving spreads) | ||
// find all the variables declared in this context | ||
const names = []; | ||
walk(node.context, { | ||
enter(node) { | ||
if (node.name) { | ||
// When traversing the context, we want to skip over all `key` children | ||
// But if the context involves destructuring like { foo }, we have a node with `node.key === node.value` | ||
// This prevents us from being able to tell whether we got here via the parent's `key` or `value` | ||
// So we first detangle the shared references by stringifying and parsing | ||
walk(JSON.parse(JSON.stringify(node.context)), { | ||
enter(node, parent) { | ||
if (node.name && !(parent && parent.key === node)) { | ||
names.push(node.name); | ||
} | ||
delete node.key; | ||
}, | ||
@@ -237,3 +244,3 @@ }); | ||
transformed_code += ';\n'; | ||
delete node.expression; | ||
skipping.add(node.expression); | ||
} | ||
@@ -240,0 +247,0 @@ }, |
{ | ||
"name": "eslint-plugin-svelte3", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "An ESLint plugin for Svelte v3 components.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19793
320