eslint-plugin-svelte3
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -0,1 +1,6 @@ | ||
# v1.2.0 | ||
- Pass a second argument to the `svelte3/ignore-warnings` function that contains the entire warning object | ||
- Disregard `no-labels` rule and `no-restricted-syntax` rule in places where it disallows labels | ||
# v1.1.0 | ||
@@ -2,0 +7,0 @@ |
15
index.js
@@ -162,3 +162,3 @@ 'use strict'; | ||
// convert warnings to linting messages | ||
messages = (ignore_warnings ? warnings.filter(({ code }) => !ignore_warnings(code)) : warnings).map(({ code, message, start, end }) => ({ | ||
messages = (ignore_warnings ? warnings.filter(warning => !ignore_warnings(warning.code, warning)) : warnings).map(({ code, message, start, end }) => ({ | ||
ruleId: code, | ||
@@ -258,2 +258,13 @@ severity: 1, | ||
// determine whether this message from ESLint is something we care about | ||
const is_valid_message = message => { | ||
switch (message.ruleId) { | ||
case 'no-labels': return false; | ||
case 'no-restricted-syntax': return message.nodeType !== 'LabeledStatement'; | ||
case 'no-self-assign': return false; | ||
case 'no-unused-labels': return !message.message.includes("'$:'"); | ||
} | ||
return true; | ||
}; | ||
// transform linting messages and combine with compiler warnings | ||
@@ -265,3 +276,3 @@ const postprocess = ([raw_messages]) => { | ||
const message = raw_messages[i]; | ||
if (message.ruleId !== 'no-self-assign' && (message.ruleId !== 'no-unused-labels' || !message.message.includes("'$:'"))) { | ||
if (is_valid_message(message)) { | ||
for (let k = 0; k < translations.length; k++) { | ||
@@ -268,0 +279,0 @@ if (transform_message(message, translations[k])) { |
{ | ||
"name": "eslint-plugin-svelte3", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "An ESLint plugin for Svelte v3 components.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -63,3 +63,3 @@ # eslint-plugin-svelte3 | ||
This can be `true` or `false` or an array of Svelte compiler warning codes or a function that accepts a warning code and returns whether to ignore it in the linting. | ||
This can be `true` or `false` or an array of Svelte compiler warning codes or a function that indicates whether to ignore it in the linting. The function will be passed two arguments - the warning code and the full warning object - and should return a boolean. | ||
@@ -66,0 +66,0 @@ The default is to not ignore any warnings. |
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
19233
313