Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/weak-crews-shake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'eslint-plugin-svelte': minor
---

Added a suggestion for `no-at-debug-tags` rule which removes the tags
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ These rules relate to better ways of doing things to help you avoid problems:
|:--------|:------------|:---|
| [svelte/block-lang](https://sveltejs.github.io/eslint-plugin-svelte/rules/block-lang/) | disallows the use of languages other than those specified in the configuration for the lang attribute of `<script>` and `<style>` blocks. | :bulb: |
| [svelte/button-has-type](https://sveltejs.github.io/eslint-plugin-svelte/rules/button-has-type/) | disallow usage of button without an explicit type attribute | |
| [svelte/no-at-debug-tags](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-at-debug-tags/) | disallow the use of `{@debug}` | :star: |
| [svelte/no-at-debug-tags](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-at-debug-tags/) | disallow the use of `{@debug}` | :star::bulb: |
| [svelte/no-ignored-unsubscribe](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-ignored-unsubscribe/) | disallow ignoring the unsubscribe method returned by the `subscribe()` on Svelte stores. | |
| [svelte/no-immutable-reactive-statements](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-immutable-reactive-statements/) | disallow reactive statements that don't reference reactive values. | :star: |
| [svelte/no-inline-styles](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-inline-styles/) | disallow attributes and directives that produce inline styles | |
Expand Down
2 changes: 1 addition & 1 deletion docs/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ These rules relate to better ways of doing things to help you avoid problems:
| :--------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------- | :------------- |
| [svelte/block-lang](./rules/block-lang.md) | disallows the use of languages other than those specified in the configuration for the lang attribute of `<script>` and `<style>` blocks. | :bulb: |
| [svelte/button-has-type](./rules/button-has-type.md) | disallow usage of button without an explicit type attribute | |
| [svelte/no-at-debug-tags](./rules/no-at-debug-tags.md) | disallow the use of `{@debug}` | :star: |
| [svelte/no-at-debug-tags](./rules/no-at-debug-tags.md) | disallow the use of `{@debug}` | :star::bulb: |
| [svelte/no-ignored-unsubscribe](./rules/no-ignored-unsubscribe.md) | disallow ignoring the unsubscribe method returned by the `subscribe()` on Svelte stores. | |
| [svelte/no-immutable-reactive-statements](./rules/no-immutable-reactive-statements.md) | disallow reactive statements that don't reference reactive values. | :star: |
| [svelte/no-inline-styles](./rules/no-inline-styles.md) | disallow attributes and directives that produce inline styles | |
Expand Down
1 change: 1 addition & 0 deletions docs/rules/no-at-debug-tags.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ since: 'v0.0.1'
> disallow the use of `{@debug}`

- :gear: This rule is included in `"plugin:svelte/recommended"`.
- :bulb: Some problems reported by this rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).

## :book: Rule Details

Expand Down
12 changes: 10 additions & 2 deletions packages/eslint-plugin-svelte/src/rules/no-at-debug-tags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ export default createRule('no-at-debug-tags', {
recommended: true,
default: 'warn'
},
hasSuggestions: true,
schema: [],
messages: {
unexpected: 'Unexpected `{@debug}`.'
unexpected: 'Unexpected `{@debug}`.',
suggestRemove: 'Remove `{@debug}` from the source'
},
type: 'problem'
},
Expand All @@ -19,7 +21,13 @@ export default createRule('no-at-debug-tags', {
SvelteDebugTag(node) {
context.report({
node,
messageId: 'unexpected'
messageId: 'unexpected',
suggest: [
{
messageId: 'suggestRemove',
fix: (fixer) => fixer.remove(node)
}
]
});
}
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
- message: Unexpected `{@debug}`.
line: 11
column: 1
suggestions: null
suggestions:
- desc: Remove `{@debug}` from the source
messageId: suggestRemove
output: |
<script>
let user = {
firstname: 'Ada',
lastname: 'Lovelace'
};
</script>

<input bind:value={user.firstname} />
<input bind:value={user.lastname} />



<h1>Hello {user.firstname}!</h1>
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
- message: Unexpected `{@debug}`.
line: 11
column: 1
suggestions: null
suggestions:
- desc: Remove `{@debug}` from the source
messageId: suggestRemove
output: |
<script>
let user = {
firstname: 'Ada',
lastname: 'Lovelace'
};
</script>

<input bind:value={user.firstname} />
<input bind:value={user.lastname} />



<h1>Hello {user.firstname}!</h1>
Loading