Socket
Socket
Sign inDemoInstall

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.5.0 to 2.6.0

4

CHANGELOG.md

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

# 2.6.0
- Add `svelte3/compiler` setting to allow overriding which instance of the Svelte compiler is used
# 2.5.0

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

11

index.js
'use strict';
const { compile, walk } = require('svelte/compiler');
const SCRIPT = 1, TEMPLATE_QUOTED = 2, TEMPLATE_UNQUOTED = 3;
let compiler_options, messages, transformed_code, line_offsets, ignore_warnings, ignore_styles, translations, var_names;
let compiler, default_compiler, compiler_options, messages, transformed_code, line_offsets, ignore_warnings, ignore_styles, translations, var_names;
const get_compiler = () => compiler || default_compiler || (default_compiler = require('svelte/compiler'));

@@ -136,3 +136,3 @@ // get the total length, number of lines, and length of the last line of a string

} else if (typeof node === 'object') {
walk(node, {
get_compiler().walk(node, {
enter(node, parent, prop) {

@@ -168,3 +168,3 @@ if (node.name && prop !== 'key') {

try {
result = compile(text, { generate: false, ...compiler_options });
result = get_compiler().compile(text, { generate: false, ...compiler_options });
} catch ({ name, message, start, end }) {

@@ -244,3 +244,3 @@ // convert the error to a linting message, store it, and return

let in_quoted_attribute = false;
walk(ast.html, {
get_compiler().walk(ast.html, {
enter(node, parent, prop) {

@@ -355,2 +355,3 @@ if (prop === 'expression') {

const settings = config && (typeof config.extractConfig === 'function' ? config.extractConfig(options.filename) : config).settings || {};
compiler = settings['svelte3/compiler'];
ignore_warnings = settings['svelte3/ignore-warnings'];

@@ -357,0 +358,0 @@ ignore_styles = settings['svelte3/ignore-styles'];

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

@@ -27,3 +27,10 @@ "keywords": [

"svelte": "^3.2.0"
},
"scripts": {
"test": "node test"
},
"devDependencies": {
"eslint": ">=6.0.0",
"svelte": "^3.2.0"
}
}

@@ -44,3 +44,3 @@ # eslint-plugin-svelte3

{
files: '*.svelte',
files: ['*.svelte'],
processor: 'svelte3/svelte3'

@@ -58,3 +58,3 @@ }

This plugin needs to be able to `require('svelte/compiler')`. If ESLint, this plugin, and Svelte are all installed locally in your project, this should not be a problem.
By default, this plugin needs to be able to `require('svelte/compiler')`. If ESLint, this plugin, and Svelte are all installed locally in your project, this should not be a problem.

@@ -73,3 +73,3 @@ ## Interactions with other plugins

This can be a function that indicates whether to ignore a warning in the linting. The function will be passed a warning object and should return a boolean.
This setting can be given a function that indicates whether to ignore a warning in the linting. The function will be passed a warning object and should return a boolean.

@@ -82,3 +82,3 @@ The default is to not ignore any warnings.

This can be an object of compiler options.
This setting can be given an object of compiler options.

@@ -91,6 +91,14 @@ The default is to compile with `{ generate: false }`.

This can be a function that accepts an object of attributes on a `<style>` tag (like that passed to a Svelte preprocessor) and returns whether to ignore the style block for the purposes of linting.
This setting can be given a function that accepts an object of attributes on a `<style>` tag (like that passed to a Svelte preprocessor) and returns whether to ignore the style block for the purposes of linting.
The default is to not ignore any styles.
### `svelte3/compiler`
In some esoteric setups, this plugin might not be able to find the correct instance of the Svelte compiler to use.
This setting can be given the result of `require('.../path/to/svelte/compiler')` to indicate which instance should be used in linting the components.
The default is `require('svelte/compiler')` from wherever the plugin is installed to.
## Using the CLI

@@ -97,0 +105,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