sveltejs / eslint-plugin-svelte

ESLint plugin for Svelte using AST
https://sveltejs.github.io/eslint-plugin-svelte/
MIT License
279 stars 30 forks source link

Add `svelte/enhance-form` warning #653

Open LeoDog896 opened 6 months ago

LeoDog896 commented 6 months ago

Motivation

To stop developers from forgetting to enhance forms

Description

A rule that isn't on the recommended list (as sometimes, though I can't think of a case, a developer may want to implement it themselves) that ensures that all <form> elements have a use:enhance directive.

Examples

<script>
    import { enhance } from '$app/forms';
</script>

<!-- ✓ GOOD -->
<form method="POST" use:enhance>
<form use:enhance={{ ... }}>

<!-- ✗ BAD -->
<form>
<form method="POST">
<form use:otherMethod>

Additional comments

No response