0.0.11 • Published 2 years ago

eslint-plugin-svelte-runes v0.0.11

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

eslint-plugin-svelte-runes

This plugin intends to provide a collection of rules specifically tailored for enforcing correct and safe usage of Svelte 5 runes.

🚧 NOTE: This plugin is still in early development and is subject to breaking changes.

🎯 Why This Plugin?

This plugin proactively prepares for the upcoming Svelte 5 release by establishing rules for best practices and addressing the nuanced universal reactivity challenges between Svelte and non-Svelte code in js/ts files. While the official eslint-plugin-svelte may take time to support Svelte 5 and js/ts files, this plugin aims to fill that void.

📦 Installation

Using npm:

# Using npm
npm install eslint-plugin-svelte-runes --save-dev

# Using yarn
yarn add eslint-plugin-svelte-runes --dev

# Using pnpm
pnpm add -D eslint-plugin-svelte-runes

# Using bun
bun add eslint-plugin-svelte-runes --dev

🚀 Usage

Add eslint-plugin-svelte-runes to the plugins section of your .eslintrc configuration file:

{
    "plugins": ["eslint-plugin-svelte-runes"]
}

Then configure the rules you want to use under the rules section.

🔧 Recommended Configuration

This plugin ships with a recommended configuration that sets up all the provided rules to their default values:

{
    "extends": ["plugin:svelte-runes/recommended"]
}

📜 Rules

Rule NameDescription
no-external-svelte-importsDisallow importing from .svelte.js/ts files outside of .svelte.js/ts files and .svelte files.
no-external-svelte-exportsDisallow exporting directly from .svelte.js/ts files outside of .svelte.js/ts files.
no-external-rune-callsDisallow the usage of $derived(), $effect(), $state(), and $props() in non-Svelte files unless explicitly declared or imported.
no-effect-outside-componentsDisallow usage of the $effect rune outside of .svelte files.
no-props-outside-componentsDisallow usage of the $props rune outside of .svelte files.
no-direct-rune-assignDisallow the assignment of Svelte runes as object properties or direct variable assignments.
no-initialized-rune-exportsDisallow the export of variables or values initialized with a Svelte rune CallExpression.

🤝 Contributions

Contributions to eslint-plugin-svelte-runes are always welcome!

📄 License

eslint-plugin-svelte-runes is licensed under the MIT License.

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago