Skip to content

Commit

Permalink
chore: minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi committed Feb 9, 2023
1 parent e61bbc3 commit d4b52e6
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .changeset/tasty-houses-behave.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"eslint-plugin-svelte": minor
---

Added the experimental-require-strict-events rule
feat: added the `svelte/experimental-require-strict-events` rule
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ These rules extend the rules provided by ESLint itself, or other plugins to work

| Rule ID | Description | |
|:--------|:------------|:---|
| [svelte/experimental-require-strict-events](https://ota-meshi.github.io/eslint-plugin-svelte/rules/experimental-require-strict-events/) | require the strictEvents attribute on <script> tags | |
| [svelte/experimental-require-strict-events](https://ota-meshi.github.io/eslint-plugin-svelte/rules/experimental-require-strict-events/) | require the strictEvents attribute on `<script>` tags | |

## System

Expand Down
5 changes: 5 additions & 0 deletions docs-svelte-kit/src/lib/eslint/scripts/linter.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ export const categories = [
classes: "svelte-category",
rules: [],
},
{
title: "Experimental",
classes: "svelte-category",
rules: [],
},
{
title: "System",
classes: "svelte-category",
Expand Down
1 change: 1 addition & 0 deletions docs-svelte-kit/src/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const categories = [
"Best Practices",
"Stylistic Issues",
"Extension Rules",
"Experimental",
"System",
]
svelteRules.forEach((rule) => {
Expand Down
2 changes: 1 addition & 1 deletion docs/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ These rules extend the rules provided by ESLint itself, or other plugins to work

| Rule ID | Description | |
|:--------|:------------|:---|
| [svelte/experimental-require-strict-events](./rules/experimental-require-strict-events.md) | require the strictEvents attribute on <script> tags | |
| [svelte/experimental-require-strict-events](./rules/experimental-require-strict-events.md) | require the strictEvents attribute on `<script>` tags | |

## System

Expand Down
25 changes: 23 additions & 2 deletions docs/rules/experimental-require-strict-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
pageClass: "rule-details"
sidebarDepth: 0
title: "svelte/experimental-require-strict-events"
description: "require the strictEvents attribute on <script> tags"
description: "require the strictEvents attribute on `<script>` tags"
---

# svelte/experimental-require-strict-events

> require the strictEvents attribute on <script> tags
> require the strictEvents attribute on `<script>` tags
- :exclamation: <badge text="This rule has not been released yet." vertical="middle" type="error"> **_This rule has not been released yet._** </badge>

Expand All @@ -25,10 +25,31 @@ This rule enforces the presence of the `strictEvents` attribute on the main `<sc
<!-- ✓ GOOD -->
<script lang="ts" strictEvents>
</script>
```

</ESLintCodeBlock>

<ESLintCodeBlock>

<!--eslint-skip-->

```svelte
<!-- eslint svelte/experimental-require-strict-events: "error" -->
<!-- ✓ GOOD -->
<script lang="ts">
interface $$Events {}
</script>
```

</ESLintCodeBlock>

<ESLintCodeBlock>

<!--eslint-skip-->

```svelte
<!-- eslint svelte/experimental-require-strict-events: "error" -->
<!-- ✗ BAD -->
<script lang="ts">
Expand Down
2 changes: 1 addition & 1 deletion src/rules/experimental-require-strict-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { findAttribute, getLangValue } from "../utils/ast-utils"
export default createRule("experimental-require-strict-events", {
meta: {
docs: {
description: "require the strictEvents attribute on <script> tags",
description: "require the strictEvents attribute on `<script>` tags",
category: "Experimental",
recommended: false,
},
Expand Down

0 comments on commit d4b52e6

Please sign in to comment.