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.2.1 to 2.2.2

4

CHANGELOG.md

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

# 2.2.2
- Stop using inline configuration comments internally, to avoid issues with `--no-inline-config` and `--report-unused-disable-directives`
# 2.2.1

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

52

index.js

@@ -57,5 +57,2 @@ 'use strict';

const transform_message = (message, { unoffsets, dedent, offsets, range }) => {
if (message.line < unoffsets.lines) {
return false;
}
// strip out the start and end of the fix if they are not actually changes

@@ -131,3 +128,2 @@ if (message.fix) {

}
return true;
};

@@ -204,7 +200,7 @@

// include declarations of all injected identifiers
transformed_code = injected_vars.length ? `/* eslint-disable */let ${injected_vars.map(v => v.name).join(',')};\n/* eslint-enable */` : '';
transformed_code = injected_vars.length ? `let ${injected_vars.map(v => v.name).join(',')};\n` : '';
// get translation info and include the processed scripts in transformed_code
const get_translation = node => {
const translation = { unoffsets: get_offsets(transformed_code) };
const get_translation = (node, type) => {
const translation = { type, unoffsets: get_offsets(transformed_code) };
translation.range = [node.start, node.end];

@@ -215,14 +211,17 @@ const { dedented, offsets } = dedent_code(text.slice(node.start, node.end));

translation.dedent = offsets;
translations.push(translation);
const end = get_offsets(transformed_code).lines;
for (let i = translation.unoffsets.lines; i <= end; i++) {
translations.set(i, translation);
}
};
translations = [];
translations = new Map();
if (ast.module) {
get_translation(ast.module.content);
get_translation(ast.module.content, 'module');
}
transformed_code += '/* eslint-disable */\n/* eslint-enable */';
transformed_code += '\n';
if (ast.instance) {
get_translation(ast.instance.content);
get_translation(ast.instance.content, 'instance');
}
transformed_code += '/* eslint-disable */\n';
transformed_code += '\n';

@@ -256,9 +255,9 @@ // no-unused-vars: create references to all identifiers referred to by the template

nodes_with_contextual_scope.add(node);
transformed_code += `{let ${contextual_names.map(name => `${name}=0`).join(',')};\n`;
transformed_code += `{let ${contextual_names.map(name => `${name}=0`).join(',')};`;
}
if (node.expression && typeof node.expression === 'object') {
// add the expression in question to the constructed string
transformed_code += '(/* eslint-enable *//* eslint-disable indent, no-unused-expressions, quotes */';
get_translation(node.expression);
transformed_code += '/* eslint-disable */);\n';
transformed_code += '(\n';
get_translation(node.expression, 'template');
transformed_code += '\n);';
}

@@ -274,5 +273,2 @@ },

// reverse sort the translations
translations.sort((a, b) => b.unoffsets.length - a.unoffsets.length);
// return processed string

@@ -301,4 +297,5 @@ return [transformed_code];

// determine whether this message from ESLint is something we care about
const is_valid_message = message => {
const is_valid_message = (message, type) => {
switch (message.ruleId) {
case 'indent': return type !== 'template';
case 'eol-last': return false;

@@ -308,3 +305,5 @@ case 'no-labels': return get_identifier(get_referenced_string(message)) !== '$';

case 'no-self-assign': return false;
case 'no-unused-expressions': return type !== 'template';
case 'no-unused-labels': return get_referenced_string(message) !== '$';
case 'quotes': return type !== 'template';
}

@@ -320,9 +319,6 @@ return true;

const message = raw_messages[i];
if (is_valid_message(message)) {
for (let k = 0; k < translations.length; k++) {
if (transform_message(message, translations[k])) {
messages.push(message);
break;
}
}
const translation = translations.get(message.line);
if (translation && is_valid_message(message, translation.type)) {
transform_message(message, translation);
messages.push(message);
}

@@ -329,0 +325,0 @@ }

{
"name": "eslint-plugin-svelte3",
"version": "2.2.1",
"version": "2.2.2",
"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