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 3.1.1 to 3.1.2

4

CHANGELOG.md

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

# 3.1.2
- Silence some incorrect `unsafe-member-access` errors - see README for current limitations
# 3.1.1

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

47

index.js

@@ -503,3 +503,8 @@ 'use strict';

block.transformed_code = vars.filter(v => v.injected || v.module).map(v => `let ${v.name};`).join('');
if (ast.module && processor_options.typescript) {
block.transformed_code = vars.filter(v => v.injected).map(v => `let ${v.name};`).join('');
block.transformed_code += text.slice(ast.module.content.start, ast.module.content.end);
} else {
block.transformed_code = vars.filter(v => v.injected || v.module).map(v => `let ${v.name};`).join('');
}

@@ -516,3 +521,15 @@ get_translation(text, block, ast.instance.content);

block.transformed_code = vars.map(v => `let ${v.name};`).join('');
if (processor_options.typescript) {
block.transformed_code = '';
if (ast.module) {
block.transformed_code += text.slice(ast.module.content.start, ast.module.content.end);
}
if (ast.instance) {
block.transformed_code += '\n';
block.transformed_code += vars.filter(v => v.injected).map(v => `let ${v.name};`).join('');
block.transformed_code += text.slice(ast.instance.content.start, ast.instance.content.end);
}
} else {
block.transformed_code = vars.map(v => `let ${v.name};`).join('');
}

@@ -603,10 +620,6 @@ const nodes_with_contextual_scope = new WeakSet();

function compile_code(text, compiler, processor_options) {
let ast;
let warnings;
let vars;
const ts = processor_options.typescript;
let mapper;
let ts_result;
if (ts) {
if (!ts) {
return compiler.compile(text, { generate: false, ...processor_options.compiler_options });
} else {
const diffs = [];

@@ -640,3 +653,5 @@ let accumulated_diff = 0;

});
mapper = new DocumentMapper(text, transpiled, diffs);
const mapper = new DocumentMapper(text, transpiled, diffs);
let ts_result;
try {

@@ -659,14 +674,8 @@ ts_result = compiler.compile(transpiled, { generate: false, ...processor_options.compiler_options });

});
}
if (!ts) {
({ ast, warnings, vars } = compiler.compile(text, { generate: false, ...processor_options.compiler_options }));
} else {
// if we do a full recompile Svelte can fail due to the blank script tag not declaring anything
// so instead we just parse for the AST (which is likely faster, anyways)
ast = compiler.parse(text, { ...processor_options.compiler_options });
({ warnings, vars } = ts_result);
const ast = compiler.parse(text, { ...processor_options.compiler_options });
const{ warnings, vars } = ts_result;
return { ast, warnings, vars, mapper };
}
return { ast, warnings, vars, mapper };
}

@@ -673,0 +682,0 @@

{
"name": "eslint-plugin-svelte3",
"version": "3.1.1",
"version": "3.1.2",
"description": "An ESLint plugin for Svelte v3 components.",

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

@@ -105,2 +105,20 @@ # eslint-plugin-svelte3

There are some limitations to these type-aware rules currently. Specifically, checks in the context of reactive assignments and store subscriptions will report false positives or false negatives, depending on the rule. In the case of reactive assignments, you can work around this by explicitly typing the reactive variable. An example with the `no-unsafe-member-access` rule:
```svelte
<script lang="ts">
import { writable } from 'svelte/store';
const store = writable([]);
$store.length; // incorrect no-unsafe-member-access error
$: assignment = [];
assignment.length; // incorrect no-unsafe-member-access error
// You can work around this by doing
let another_assignment: string[];
$: another_assignment = [];
another_assignment.length; // OK
</script>
```
## Interactions with other plugins

@@ -107,0 +125,0 @@

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