eslint-plugin-svelte3
Advanced tools
Comparing version 2.3.0 to 2.4.0
@@ -0,1 +1,6 @@ | ||
# 2.4.0 | ||
- Respect `no-self-assign` rule unless self-assignment is to a top-level variable known to the compiler | ||
- Better handling of identifiers containing unicode characters | ||
# 2.3.0 | ||
@@ -2,0 +7,0 @@ |
@@ -5,3 +5,3 @@ 'use strict'; | ||
const SCRIPT = 1, TEMPLATE_QUOTED = 2, TEMPLATE_UNQUOTED = 3; | ||
let compiler_options, messages, transformed_code, line_offsets, ignore_warnings, ignore_styles, translations; | ||
let compiler_options, messages, transformed_code, line_offsets, ignore_warnings, ignore_styles, translations, var_names; | ||
@@ -181,2 +181,3 @@ // get the total length, number of lines, and length of the last line of a string | ||
const { ast, warnings, vars } = result; | ||
var_names = new Set(vars.map(v => v.name)); | ||
const injected_vars = vars.filter(v => v.injected); | ||
@@ -295,4 +296,4 @@ const referenced_vars = vars.filter(v => v.referenced); | ||
// extract something that looks like an identifier (minus insane unicode stuff) from the beginning of a string | ||
const get_identifier = str => (str && str.match(/^[a-zA-Z_$][0-9a-zA-Z_$]*/) || [])[0]; | ||
// extract something that looks like an identifier (minus unicode escape stuff) from the beginning of a string | ||
const get_identifier = str => (str && str.match(/^[^\s!"#%&\\'()*+,\-./:;<=>?@[\\\]^`{|}~]+/) || [])[0]; | ||
@@ -306,3 +307,3 @@ // determine whether this message from ESLint is something we care about | ||
case 'no-restricted-syntax': return message.nodeType !== 'LabeledStatement' || get_identifier(get_referenced_string(message)) !== '$'; | ||
case 'no-self-assign': return false; | ||
case 'no-self-assign': return !var_names.has(get_identifier(get_referenced_string(message))); | ||
case 'no-unused-labels': return get_referenced_string(message) !== '$'; | ||
@@ -309,0 +310,0 @@ case 'quotes': return type !== TEMPLATE_QUOTED; |
{ | ||
"name": "eslint-plugin-svelte3", | ||
"version": "2.3.0", | ||
"version": "2.4.0", | ||
"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
21211
329