eslint-plugin-svelte
now does everything this plugin does (and more) with less weirdness.
Use it instead!
Install the plugin and its dependencies via npm.
$> npm install --save-dev @tivac/eslint-plugin-svelte
Add one of the shared configs provided by this plugin to the extends
section in your ESLint config.
{
"extends" : [
// Only enables the plugin, no rule config
"plugin:@tivac/svelte/base"
// or
// Enables the plugin and all rules
"plugin:@tivac/svelte/recommended"
]
}
derived-inputs-outputs
, input & value names of derived()
should matchreactive-curlies
, don't add { ... }
if there's only a single statementreactive-destructuring
, prefer destructuring for reactive reassignmentsreactive-functions
, don't define functions inside reactive statementsreactive-literals
, don't assign literals in a reactive statementstore-prop-destructuring
, don't access store values as $foo.bar
but instead destructure them $: ({ bar } = $foo);
for more granular redrawsstores-initial-value
, always give svelte stores a default valuestores-no-async
, don't use async
/await
inside svelte stores because it causes issues with the auto-unsubscribing features