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

eslint-plugin-svelte3

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-svelte3 - npm Package Compare versions

Comparing version 2.0.2 to 2.1.0

4

CHANGELOG.md

@@ -0,1 +1,5 @@

# 2.1.0
- Preserve linting messages about labels other than `$`
# 2.0.2

@@ -2,0 +6,0 @@

@@ -5,3 +5,3 @@ 'use strict';

let compiler_options, messages, transformed_code, ignore_warnings, ignore_styles, translations;
let compiler_options, messages, transformed_code, line_offsets, ignore_warnings, ignore_styles, translations;

@@ -271,2 +271,20 @@ // get the total length, number of lines, and length of the last line of a string

// extract the string referenced by a message
const get_referenced_string = message => {
if (message.line && message.column && message.endLine && message.endColumn) {
if (!line_offsets) {
line_offsets = [-1, -1];
for (let i = 0; i < transformed_code.length; i++) {
if (transformed_code[i] === '\n') {
line_offsets.push(i);
}
}
}
return transformed_code.slice(line_offsets[message.line] + message.column, line_offsets[message.endLine] + message.endColumn);
}
};
// 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];
// determine whether this message from ESLint is something we care about

@@ -276,6 +294,6 @@ const is_valid_message = message => {

case 'eol-last': return false;
case 'no-labels': return false;
case 'no-restricted-syntax': return message.nodeType !== 'LabeledStatement';
case 'no-labels': return get_identifier(get_referenced_string(message)) !== '$';
case 'no-restricted-syntax': return message.nodeType !== 'LabeledStatement' || get_identifier(get_referenced_string(message)) !== '$';
case 'no-self-assign': return false;
case 'no-unused-labels': return !message.message.includes("'$:'");
case 'no-unused-labels': return get_referenced_string(message) !== '$';
}

@@ -303,3 +321,5 @@ return true;

// sort messages and return
return messages.sort((a, b) => a.line - b.line || a.column - b.column);
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;
return sorted_messages;
};

@@ -306,0 +326,0 @@

2

package.json
{
"name": "eslint-plugin-svelte3",
"version": "2.0.2",
"version": "2.1.0",
"description": "An ESLint plugin for Svelte v3 components.",

@@ -5,0 +5,0 @@ "keywords": [

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