diff --git a/README.md b/README.md index fb31df855..c511f7f07 100644 --- a/README.md +++ b/README.md @@ -246,6 +246,7 @@ These rules relate to possible syntax or logic errors in Svelte code: | Rule ID | Description | | |:--------|:------------|:---| | [@ota-meshi/svelte/no-dupe-else-if-blocks](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-dupe-else-if-blocks.html) | disallow duplicate conditions in `{#if}` / `{:else if}` chains | :star: | +| [@ota-meshi/svelte/no-not-function-handler](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-not-function-handler.html) | disallow use of not function in event handler | :star: | | [@ota-meshi/svelte/no-object-in-text-mustaches](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-object-in-text-mustaches.html) | disallow objects in text mustache interpolation | :star: | ## Security Vulnerability diff --git a/docs/rules/README.md b/docs/rules/README.md index d3baf4bdc..6a2d2cb02 100644 --- a/docs/rules/README.md +++ b/docs/rules/README.md @@ -16,6 +16,7 @@ These rules relate to possible syntax or logic errors in Svelte code: | Rule ID | Description | | |:--------|:------------|:---| | [@ota-meshi/svelte/no-dupe-else-if-blocks](./no-dupe-else-if-blocks.md) | disallow duplicate conditions in `{#if}` / `{:else if}` chains | :star: | +| [@ota-meshi/svelte/no-not-function-handler](./no-not-function-handler.md) | disallow use of not function in event handler | :star: | | [@ota-meshi/svelte/no-object-in-text-mustaches](./no-object-in-text-mustaches.md) | disallow objects in text mustache interpolation | :star: | ## Security Vulnerability diff --git a/docs/rules/no-not-function-handler.md b/docs/rules/no-not-function-handler.md new file mode 100644 index 000000000..99b977e3c --- /dev/null +++ b/docs/rules/no-not-function-handler.md @@ -0,0 +1,61 @@ +--- +pageClass: "rule-details" +sidebarDepth: 0 +title: "@ota-meshi/svelte/no-not-function-handler" +description: "disallow use of not function in event handler" +--- + +# @ota-meshi/svelte/no-not-function-handler + +> disallow use of not function in event handler + +- :exclamation: **_This rule has not been released yet._** +- :gear: This rule is included in `"plugin:@ota-meshi/svelte/recommended"`. + +## :book: Rule Details + +This rule reports where you used not function value in event handlers. +If you use a non-function value for the event handler, it event handler will not be called. It's almost always a mistake. You may have written a lot of unnecessary curly braces. + + + + + +```svelte + + + +