eslint-plugin-svelte3
Advanced tools
Comparing version 2.4.0 to 2.4.1
@@ -0,1 +1,5 @@ | ||
# 2.4.1 | ||
- Fix attribute parsing edge case in `svelte3/ignore-styles` callback | ||
# 2.4.0 | ||
@@ -2,0 +6,0 @@ |
20
index.js
@@ -154,4 +154,8 @@ 'use strict'; | ||
attributes.split(/\s+/).filter(Boolean).forEach(attr => { | ||
const [name, value] = attr.split('='); | ||
attrs[name] = value ? /^['"]/.test(value) ? value.slice(1, -1) : value : true; | ||
const p = attr.indexOf('='); | ||
if (p === -1) { | ||
attrs[attr] = true; | ||
} else { | ||
attrs[attr.slice(0, p)] = '\'"'.includes(attr[p + 1]) ? attr.slice(p + 2, -1) : attr.slice(p + 1); | ||
} | ||
}); | ||
@@ -164,3 +168,3 @@ return ignore_styles(attrs) ? match.replace(/\S/g, ' ') : match; | ||
try { | ||
result = compile(text, compiler_options); | ||
result = compile(text, { generate: false, ...compiler_options }); | ||
} catch ({ name, message, start, end }) { | ||
@@ -244,3 +248,3 @@ // convert the error to a linting message, store it, and return | ||
return this.skip(); | ||
} else if (prop === 'attributes' && /['"]/.test(text[node.end - 1])) { | ||
} else if (prop === 'attributes' && '\'"'.includes(text[node.end - 1])) { | ||
in_quoted_attribute = true; | ||
@@ -301,3 +305,3 @@ } | ||
// determine whether this message from ESLint is something we care about | ||
const is_valid_message = (message, type) => { | ||
const is_valid_message = (message, { type }) => { | ||
switch (message.ruleId) { | ||
@@ -322,3 +326,3 @@ case 'eol-last': return false; | ||
const translation = translations.get(message.line); | ||
if (translation && is_valid_message(message, translation.type)) { | ||
if (translation && is_valid_message(message, translation)) { | ||
transform_message(message, translation); | ||
@@ -332,3 +336,3 @@ messages.push(message); | ||
const sorted_messages = messages.sort((a, b) => a.line - b.line || a.column - b.column); | ||
compiler_options = messages = transformed_code = line_offsets = ignore_warnings = ignore_styles = translations = null; | ||
compiler_options = messages = transformed_code = line_offsets = ignore_warnings = ignore_styles = translations = var_names = null; | ||
return sorted_messages; | ||
@@ -353,3 +357,3 @@ }; | ||
ignore_styles = settings['svelte3/ignore-styles']; | ||
compiler_options = Object.assign({ generate: false }, settings['svelte3/compiler-options']); | ||
compiler_options = settings['svelte3/compiler-options']; | ||
// call original Linter#verify | ||
@@ -356,0 +360,0 @@ return verify.call(this, code, config, options); |
{ | ||
"name": "eslint-plugin-svelte3", | ||
"version": "2.4.0", | ||
"version": "2.4.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
21368
44495
333