@tivac/eslint-plugin-svelte
v3.1.0
Published
Svelte.js focused ESLint rules
Downloads
496
Maintainers
Readme
@tivac/eslint-plugin-svelte
Installing the plugin
Install the plugin and its dependencies via npm.
$> npm install --save-dev @tivac/eslint-plugin-svelte
Using the plugin
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"
]
}
Rules
derived-inputs-outputs
, input & value names ofderived()
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 useasync
/await
inside svelte stores because it causes issues with the auto-unsubscribing features