New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-svelte

Package Overview
Dependencies
Maintainers
0
Versions
117
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-svelte - npm Package Compare versions

Comparing version 3.0.0-next.15 to 3.0.0-next.16

lib/utils/events.d.ts

23

lib/configs/flat/recommended.js

@@ -9,15 +9,34 @@ import base from './base.js';

'svelte/comment-directive': 'error',
'svelte/infinite-reactive-loop': 'error',
'svelte/no-at-debug-tags': 'warn',
'svelte/no-at-html-tags': 'error',
'svelte/no-dom-manipulating': 'error',
'svelte/no-dupe-else-if-blocks': 'error',
'svelte/no-dupe-on-directives': 'error',
'svelte/no-dupe-style-properties': 'error',
'svelte/no-dynamic-slot-name': 'error',
'svelte/no-dupe-use-directives': 'error',
'svelte/no-export-load-in-svelte-module-in-kit-pages': 'error',
'svelte/no-immutable-reactive-statements': 'error',
'svelte/no-inner-declarations': 'error',
'svelte/no-inspect': 'warn',
'svelte/no-not-function-handler': 'error',
'svelte/no-object-in-text-mustaches': 'error',
'svelte/no-raw-special-elements': 'error',
'svelte/no-reactive-functions': 'error',
'svelte/no-reactive-literals': 'error',
'svelte/no-reactive-reassign': 'error',
'svelte/no-shorthand-style-property-overrides': 'error',
'svelte/no-store-async': 'error',
'svelte/no-svelte-internal': 'error',
'svelte/no-unknown-style-directive-property': 'error',
'svelte/no-unused-svelte-ignore': 'error',
'svelte/no-useless-children-snippet': 'error',
'svelte/no-useless-mustaches': 'error',
'svelte/require-each-key': 'error',
'svelte/require-event-dispatcher-types': 'error',
'svelte/require-store-reactive-access': 'error',
'svelte/require-stores-init': 'error',
'svelte/system': 'error',
'svelte/valid-compile': 'error'
'svelte/valid-each-key': 'error',
'svelte/valid-prop-names-in-kit-pages': 'error'
}

@@ -24,0 +43,0 @@ }

2

lib/main.d.ts

@@ -17,3 +17,3 @@ import './rule-types.js';

name: "eslint-plugin-svelte";
version: "3.0.0-next.15";
version: "3.0.0-next.16";
};

@@ -20,0 +20,0 @@ export declare const processors: {

export declare const name = "eslint-plugin-svelte";
export declare const version = "3.0.0-next.15";
export declare const version = "3.0.0-next.16";

@@ -5,2 +5,2 @@ // IMPORTANT!

export const name = 'eslint-plugin-svelte';
export const version = '3.0.0-next.15';
export const version = '3.0.0-next.16';

@@ -133,2 +133,3 @@ import type { Linter } from 'eslint';

* @see https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dynamic-slot-name/
* @deprecated
*/

@@ -135,0 +136,0 @@ 'svelte/no-dynamic-slot-name'?: Linter.RuleEntry<[]>;

@@ -101,3 +101,3 @@ import { createRule } from '../../utils/index.js';

},
type: 'suggestion', // "problem", or "layout",
type: 'suggestion',
deprecated: true,

@@ -104,0 +104,0 @@ replacedBy: {

@@ -300,4 +300,3 @@ import { ReferenceTracker } from '@eslint-community/eslint-utils';

category: 'Possible Errors',
// TODO Switch to recommended in the major version.
recommended: false
recommended: true
},

@@ -304,0 +303,0 @@ schema: [],

@@ -33,3 +33,3 @@ import { createRule } from '../utils/index.js';

category: 'Possible Errors',
recommended: false
recommended: true
},

@@ -36,0 +36,0 @@ schema: [],

@@ -9,3 +9,3 @@ import { createRule } from '../utils/index.js';

category: 'Possible Errors',
recommended: false
recommended: true
},

@@ -12,0 +12,0 @@ schema: [],

@@ -9,3 +9,3 @@ import { createRule } from '../utils/index.js';

category: 'Possible Errors',
recommended: false
recommended: true
},

@@ -12,0 +12,0 @@ schema: [],

@@ -9,5 +9,6 @@ import { createRule } from '../utils/index.js';

category: 'Possible Errors',
recommended: true
recommended: false
},
fixable: 'code',
deprecated: true,
schema: [],

@@ -18,3 +19,6 @@ messages: {

},
type: 'problem'
type: 'problem',
replacedBy: {
note: 'Now Svelte compiler itself throws an compile error.'
}
},

@@ -21,0 +25,0 @@ create(context) {

@@ -7,4 +7,3 @@ import { createRule } from '../utils/index.js';

category: 'SvelteKit',
// TODO Switch to recommended in the major version.
recommended: false
recommended: true
},

@@ -11,0 +10,0 @@ schema: [],

@@ -9,4 +9,3 @@ import { createRule } from '../utils/index.js';

category: 'Best Practices',
// TODO Switch to recommended in the major version.
recommended: false
recommended: true
},

@@ -13,0 +12,0 @@ schema: [],

@@ -7,4 +7,3 @@ import { createRule } from '../utils/index.js';

category: 'Best Practices',
// TODO: Enable recommended in major version
recommended: false,
recommended: true,
default: 'warn'

@@ -11,0 +10,0 @@ },

import { createRule } from '../utils/index.js';
import { findVariable } from '../utils/ast-utils.js';
import { EVENT_NAMES } from '../utils/events.js';
const PHRASES = {

@@ -32,3 +33,3 @@ ObjectExpression: 'object',

},
type: 'problem' // "problem", or "layout",
type: 'problem'
},

@@ -87,2 +88,14 @@ create(context) {

verify(node.expression);
},
SvelteAttribute(node) {
if (node.key.type === 'SvelteName' && EVENT_NAMES.includes(node.key.name)) {
const { value } = node;
if (Array.isArray(value)) {
for (const v of value) {
if (v.type === 'SvelteMustacheTag') {
verify(v.expression);
}
}
}
}
}

@@ -89,0 +102,0 @@ };

@@ -20,3 +20,3 @@ import { createRule } from '../utils/index.js';

},
type: 'problem' // "problem", or "layout",
type: 'problem'
},

@@ -23,0 +23,0 @@ create(context) {

@@ -9,4 +9,3 @@ import { createRule } from '../utils/index.js';

category: 'Possible Errors',
// TODO: Switch to recommended in the major version
recommended: false
recommended: true
},

@@ -13,0 +12,0 @@ schema: [],

@@ -8,3 +8,3 @@ import { createRule } from '../utils/index.js';

category: 'Best Practices',
recommended: false
recommended: true
},

@@ -11,0 +11,0 @@ hasSuggestions: true,

@@ -8,3 +8,3 @@ import { createRule } from '../utils/index.js';

category: 'Best Practices',
recommended: false
recommended: true
},

@@ -17,3 +17,12 @@ hasSuggestions: true,

},
type: 'suggestion'
type: 'suggestion',
conditions: [
{
svelteVersions: ['3/4']
},
{
svelteVersions: ['5'],
runes: [false, 'undetermined']
}
]
},

@@ -20,0 +29,0 @@ create(context) {

@@ -9,4 +9,3 @@ import { createRule } from '../utils/index.js';

category: 'Possible Errors',
// TODO Switch to recommended in the major version.
recommended: false
recommended: true
},

@@ -13,0 +12,0 @@ schema: [

@@ -8,5 +8,3 @@ import { createRule } from '../utils/index.js';

category: 'Possible Errors',
// TODO Switch to recommended in the major version.
// recommended: true,
recommended: false,
recommended: true,
default: 'error'

@@ -13,0 +11,0 @@ },

@@ -7,5 +7,3 @@ import { createRule } from '../utils/index.js';

category: 'Best Practices',
// TODO Switch to recommended in the major version.
// recommended: true,
recommended: false
recommended: true
},

@@ -12,0 +10,0 @@ schema: [],

@@ -7,3 +7,3 @@ import { createRule } from '../utils/index.js';

category: 'Best Practices',
recommended: false
recommended: true
},

@@ -14,3 +14,8 @@ schema: [],

},
type: 'suggestion'
type: 'suggestion',
conditions: [
{
svelteVersions: ['5']
}
]
},

@@ -17,0 +22,0 @@ create(context) {

@@ -18,3 +18,3 @@ import { createRule } from '../utils/index.js';

category: 'Best Practices',
recommended: false
recommended: true
},

@@ -79,2 +79,5 @@ fixable: 'code',

}
if (expression.type === 'TemplateLiteral' && /[\n\r]/.test(rawValue)) {
return;
}
let hasEscape = false;

@@ -81,0 +84,0 @@ if (rawValue !== strValue) {

@@ -7,3 +7,3 @@ import { createRule } from '../utils/index.js';

category: 'Best Practices',
recommended: false
recommended: true
},

@@ -10,0 +10,0 @@ schema: [],

@@ -10,3 +10,3 @@ import { ReferenceTracker } from '@eslint-community/eslint-utils';

category: 'Best Practices',
recommended: false
recommended: true
},

@@ -17,3 +17,8 @@ schema: [],

},
type: 'suggestion'
type: 'suggestion',
conditions: [
{
svelteVersions: ['3/4']
}
]
},

@@ -20,0 +25,0 @@ create(context) {

@@ -9,5 +9,3 @@ import { createRule } from '../utils/index.js';

category: 'Possible Errors',
// TODO Switch to recommended in the major version.
// recommended: true,
recommended: false
recommended: true
},

@@ -14,0 +12,0 @@ fixable: 'code',

@@ -8,3 +8,3 @@ import { createRule } from '../utils/index.js';

category: 'Best Practices',
recommended: false
recommended: true
},

@@ -11,0 +11,0 @@ schema: [],

@@ -26,3 +26,3 @@ import { createRule } from '../utils/index.js';

},
type: 'layout' // "problem", or "layout",
type: 'layout'
},

@@ -29,0 +29,0 @@ create(context) {

import { createRule } from '../utils/index.js';
import { getSvelteCompileWarnings } from '../shared/svelte-compile-warns/index.js';
import { getSourceCode } from '../utils/compat.js';
const ignores = [
'missing-declaration',
// Svelte v4
'dynamic-slot-name',
// Svelte v5
'invalid-slot-name'
];
const ignores = ['missing-declaration'];
const unusedSelectorWarnings = ['css_unused_selector', 'css-unused-selector'];

@@ -27,3 +21,3 @@ function isGlobalStyleNode(globalStyleRanges, start, end) {

category: 'Possible Errors',
recommended: true
recommended: false
},

@@ -30,0 +24,0 @@ schema: [

@@ -8,4 +8,3 @@ import { createRule } from '../utils/index.js';

category: 'Best Practices',
// TODO Switch to recommended in the major version.
recommended: false
recommended: true
},

@@ -12,0 +11,0 @@ schema: [],

@@ -23,4 +23,3 @@ import { createRule } from '../utils/index.js';

category: 'SvelteKit',
// TODO Switch to recommended in the major version.
recommended: false
recommended: true
},

@@ -27,0 +26,0 @@ schema: [],

{
"name": "eslint-plugin-svelte",
"version": "3.0.0-next.15",
"version": "3.0.0-next.16",
"description": "ESLint plugin for Svelte using AST",

@@ -5,0 +5,0 @@ "repository": "git+https://github.com/sveltejs/eslint-plugin-svelte.git",

@@ -322,19 +322,18 @@ # Introduction

|:--------|:------------|:---|
| [svelte/infinite-reactive-loop](https://sveltejs.github.io/eslint-plugin-svelte/rules/infinite-reactive-loop/) | Svelte runtime prevents calling the same reactive statement twice in a microtask. But between different microtask, it doesn't prevent. | |
| [svelte/no-dom-manipulating](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dom-manipulating/) | disallow DOM manipulating | |
| [svelte/infinite-reactive-loop](https://sveltejs.github.io/eslint-plugin-svelte/rules/infinite-reactive-loop/) | Svelte runtime prevents calling the same reactive statement twice in a microtask. But between different microtask, it doesn't prevent. | :star: |
| [svelte/no-dom-manipulating](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dom-manipulating/) | disallow DOM manipulating | :star: |
| [svelte/no-dupe-else-if-blocks](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dupe-else-if-blocks/) | disallow duplicate conditions in `{#if}` / `{:else if}` chains | :star: |
| [svelte/no-dupe-on-directives](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dupe-on-directives/) | disallow duplicate `on:` directives | |
| [svelte/no-dupe-on-directives](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dupe-on-directives/) | disallow duplicate `on:` directives | :star: |
| [svelte/no-dupe-style-properties](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dupe-style-properties/) | disallow duplicate style properties | :star: |
| [svelte/no-dupe-use-directives](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dupe-use-directives/) | disallow duplicate `use:` directives | |
| [svelte/no-dynamic-slot-name](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dynamic-slot-name/) | disallow dynamic slot name | :star::wrench: |
| [svelte/no-dupe-use-directives](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dupe-use-directives/) | disallow duplicate `use:` directives | :star: |
| [svelte/no-not-function-handler](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-not-function-handler/) | disallow use of not function in event handler | :star: |
| [svelte/no-object-in-text-mustaches](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-object-in-text-mustaches/) | disallow objects in text mustache interpolation | :star: |
| [svelte/no-raw-special-elements](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-raw-special-elements/) | Checks for invalid raw HTML elements | :wrench: |
| [svelte/no-reactive-reassign](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-reactive-reassign/) | disallow reassigning reactive values | |
| [svelte/no-raw-special-elements](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-raw-special-elements/) | Checks for invalid raw HTML elements | :star::wrench: |
| [svelte/no-reactive-reassign](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-reactive-reassign/) | disallow reassigning reactive values | :star: |
| [svelte/no-shorthand-style-property-overrides](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-shorthand-style-property-overrides/) | disallow shorthand style properties that override related longhand properties | :star: |
| [svelte/no-store-async](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-store-async/) | disallow using async/await inside svelte stores because it causes issues with the auto-unsubscribing features | |
| [svelte/no-store-async](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-store-async/) | disallow using async/await inside svelte stores because it causes issues with the auto-unsubscribing features | :star: |
| [svelte/no-unknown-style-directive-property](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-unknown-style-directive-property/) | disallow unknown `style:property` | :star: |
| [svelte/require-store-callbacks-use-set-param](https://sveltejs.github.io/eslint-plugin-svelte/rules/require-store-callbacks-use-set-param/) | store callbacks must use `set` param | |
| [svelte/require-store-reactive-access](https://sveltejs.github.io/eslint-plugin-svelte/rules/require-store-reactive-access/) | disallow to use of the store itself as an operand. Need to use $ prefix or get function. | :wrench: |
| [svelte/valid-compile](https://sveltejs.github.io/eslint-plugin-svelte/rules/valid-compile/) | disallow warnings when compiling. | :star: |
| [svelte/require-store-reactive-access](https://sveltejs.github.io/eslint-plugin-svelte/rules/require-store-reactive-access/) | disallow to use of the store itself as an operand. Need to use $ prefix or get function. | :star::wrench: |
| [svelte/valid-compile](https://sveltejs.github.io/eslint-plugin-svelte/rules/valid-compile/) | disallow warnings when compiling. | |

@@ -360,19 +359,19 @@ ## Security Vulnerability

| [svelte/no-ignored-unsubscribe](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-ignored-unsubscribe/) | disallow ignoring the unsubscribe method returned by the `subscribe()` on Svelte stores. | |
| [svelte/no-immutable-reactive-statements](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-immutable-reactive-statements/) | disallow reactive statements that don't reference reactive values. | |
| [svelte/no-immutable-reactive-statements](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-immutable-reactive-statements/) | disallow reactive statements that don't reference reactive values. | :star: |
| [svelte/no-inline-styles](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-inline-styles/) | disallow attributes and directives that produce inline styles | |
| [svelte/no-inspect](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-inspect/) | Warns against the use of `$inspect` directive | |
| [svelte/no-reactive-functions](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-reactive-functions/) | it's not necessary to define functions in reactive statements | :bulb: |
| [svelte/no-reactive-literals](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-reactive-literals/) | don't assign literal values in reactive statements | :bulb: |
| [svelte/no-svelte-internal](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-svelte-internal/) | svelte/internal will be removed in Svelte 6. | |
| [svelte/no-inspect](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-inspect/) | Warns against the use of `$inspect` directive | :star: |
| [svelte/no-reactive-functions](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-reactive-functions/) | it's not necessary to define functions in reactive statements | :star::bulb: |
| [svelte/no-reactive-literals](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-reactive-literals/) | don't assign literal values in reactive statements | :star::bulb: |
| [svelte/no-svelte-internal](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-svelte-internal/) | svelte/internal will be removed in Svelte 6. | :star: |
| [svelte/no-unused-class-name](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-unused-class-name/) | disallow the use of a class in the template without a corresponding style | |
| [svelte/no-unused-svelte-ignore](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-unused-svelte-ignore/) | disallow unused svelte-ignore comments | :star: |
| [svelte/no-useless-children-snippet](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-useless-children-snippet/) | disallow explicit children snippet where it's not needed | |
| [svelte/no-useless-mustaches](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-useless-mustaches/) | disallow unnecessary mustache interpolations | :wrench: |
| [svelte/no-useless-children-snippet](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-useless-children-snippet/) | disallow explicit children snippet where it's not needed | :star: |
| [svelte/no-useless-mustaches](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-useless-mustaches/) | disallow unnecessary mustache interpolations | :star::wrench: |
| [svelte/prefer-const](https://sveltejs.github.io/eslint-plugin-svelte/rules/prefer-const/) | Require `const` declarations for variables that are never reassigned after declared | :wrench: |
| [svelte/prefer-destructured-store-props](https://sveltejs.github.io/eslint-plugin-svelte/rules/prefer-destructured-store-props/) | destructure values from object stores for better change tracking & fewer redraws | :bulb: |
| [svelte/require-each-key](https://sveltejs.github.io/eslint-plugin-svelte/rules/require-each-key/) | require keyed `{#each}` block | |
| [svelte/require-event-dispatcher-types](https://sveltejs.github.io/eslint-plugin-svelte/rules/require-event-dispatcher-types/) | require type parameters for `createEventDispatcher` | |
| [svelte/require-each-key](https://sveltejs.github.io/eslint-plugin-svelte/rules/require-each-key/) | require keyed `{#each}` block | :star: |
| [svelte/require-event-dispatcher-types](https://sveltejs.github.io/eslint-plugin-svelte/rules/require-event-dispatcher-types/) | require type parameters for `createEventDispatcher` | :star: |
| [svelte/require-optimized-style-attribute](https://sveltejs.github.io/eslint-plugin-svelte/rules/require-optimized-style-attribute/) | require style attributes that can be optimized | |
| [svelte/require-stores-init](https://sveltejs.github.io/eslint-plugin-svelte/rules/require-stores-init/) | require initial value in store | |
| [svelte/valid-each-key](https://sveltejs.github.io/eslint-plugin-svelte/rules/valid-each-key/) | enforce keys to use variables defined in the `{#each}` block | |
| [svelte/require-stores-init](https://sveltejs.github.io/eslint-plugin-svelte/rules/require-stores-init/) | require initial value in store | :star: |
| [svelte/valid-each-key](https://sveltejs.github.io/eslint-plugin-svelte/rules/valid-each-key/) | enforce keys to use variables defined in the `{#each}` block | :star: |

@@ -420,5 +419,5 @@ ## Stylistic Issues

|:--------|:------------|:---|
| [svelte/no-export-load-in-svelte-module-in-kit-pages](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-export-load-in-svelte-module-in-kit-pages/) | disallow exporting load functions in `*.svelte` module in SvelteKit page components. | |
| [svelte/no-export-load-in-svelte-module-in-kit-pages](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-export-load-in-svelte-module-in-kit-pages/) | disallow exporting load functions in `*.svelte` module in SvelteKit page components. | :star: |
| [svelte/no-navigation-without-base](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-navigation-without-base/) | disallow using navigation (links, goto, pushState, replaceState) without the base path | |
| [svelte/valid-prop-names-in-kit-pages](https://sveltejs.github.io/eslint-plugin-svelte/rules/valid-prop-names-in-kit-pages/) | disallow props other than data or errors in SvelteKit page components. | |
| [svelte/valid-prop-names-in-kit-pages](https://sveltejs.github.io/eslint-plugin-svelte/rules/valid-prop-names-in-kit-pages/) | disallow props other than data or errors in SvelteKit page components. | :star: |

@@ -451,2 +450,3 @@ ## Experimental

| [svelte/@typescript-eslint/no-unnecessary-condition](https://sveltejs.github.io/eslint-plugin-svelte/rules/@typescript-eslint/no-unnecessary-condition/) | This rule is no longer needed when using svelte-eslint-parser>=v0.19.0. |
| [svelte/no-dynamic-slot-name](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dynamic-slot-name/) | Now Svelte compiler itself throws an compile error. |
| [svelte/no-goto-without-base](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-goto-without-base/) | [svelte/no-navigation-without-base](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-navigation-without-base/) |

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