Skip to content

Commit d606390

Browse files
authored
Chore: Improve docs (#204)
* Improve docs * update readme.md
1 parent 6b04778 commit d606390

File tree

7 files changed

+35
-15
lines changed

7 files changed

+35
-15
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,9 @@ Example **.vscode/settings.json**:
244244

245245
<!--RULES_SECTION_START-->
246246

247-
The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) automatically fixes problems reported by rules which have a wrench :wrench: below.
248-
The rules with the following star :star: are included in the configs.
247+
:wrench: Indicates that the rule is fixable, and using `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the reported problems.
248+
:bulb: Indicates that some problems reported by the rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
249+
:star: Indicates that the rule is included in the `plugin:svelte/recommended` config.
249250

250251
<!--RULES_TABLE_START-->
251252

@@ -281,7 +282,7 @@ These rules relate to better ways of doing things to help you avoid problems:
281282
|:--------|:------------|:---|
282283
| [svelte/button-has-type](https://ota-meshi.github.io/eslint-plugin-svelte/rules/button-has-type/) | disallow usage of button without an explicit type attribute | |
283284
| [svelte/no-at-debug-tags](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-at-debug-tags/) | disallow the use of `{@debug}` | :star: |
284-
| [svelte/no-reactive-literals](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-reactive-literals/) | Don't assign literal values in reactive statements | |
285+
| [svelte/no-reactive-literals](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-reactive-literals/) | Don't assign literal values in reactive statements | :bulb: |
285286
| [svelte/no-unused-svelte-ignore](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-unused-svelte-ignore/) | disallow unused svelte-ignore comments | :star: |
286287
| [svelte/no-useless-mustaches](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-useless-mustaches/) | disallow unnecessary mustache interpolations | :wrench: |
287288
| [svelte/require-optimized-style-attribute](https://ota-meshi.github.io/eslint-plugin-svelte/rules/require-optimized-style-attribute/) | require style attributes that can be optimized | |
@@ -298,7 +299,7 @@ These rules relate to style guidelines, and are therefore quite subjective:
298299
| [svelte/indent](https://ota-meshi.github.io/eslint-plugin-svelte/rules/indent/) | enforce consistent indentation | :wrench: |
299300
| [svelte/max-attributes-per-line](https://ota-meshi.github.io/eslint-plugin-svelte/rules/max-attributes-per-line/) | enforce the maximum number of attributes per line | :wrench: |
300301
| [svelte/mustache-spacing](https://ota-meshi.github.io/eslint-plugin-svelte/rules/mustache-spacing/) | enforce unified spacing in mustache | :wrench: |
301-
| [svelte/no-extra-reactive-curlies](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-extra-reactive-curlies/) | disallow wrapping single reactive statements in curly braces | |
302+
| [svelte/no-extra-reactive-curlies](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-extra-reactive-curlies/) | disallow wrapping single reactive statements in curly braces | :bulb: |
302303
| [svelte/no-spaces-around-equal-signs-in-attribute](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-spaces-around-equal-signs-in-attribute/) | disallow spaces around equal signs in attribute | :wrench: |
303304
| [svelte/prefer-class-directive](https://ota-meshi.github.io/eslint-plugin-svelte/rules/prefer-class-directive/) | require class directives instead of ternary expressions | :wrench: |
304305
| [svelte/prefer-style-directive](https://ota-meshi.github.io/eslint-plugin-svelte/rules/prefer-style-directive/) | require style directives instead of style attribute | :wrench: |

docs/rules.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ sidebarDepth: 0
44

55
# Available Rules
66

7-
The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) automatically fixes problems reported by rules which have a wrench :wrench: below.
8-
The rules with the following star :star: are included in the `plugin:svelte/recommended` config.
7+
:wrench: Indicates that the rule is fixable, and using `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the reported problems.
8+
:bulb: Indicates that some problems reported by the rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
9+
:star: Indicates that the rule is included in the `plugin:svelte/recommended` config.
910

1011
<!-- This file is automatically generated in tools/update-docs-rules-index.js, do not change! -->
1112

@@ -41,7 +42,7 @@ These rules relate to better ways of doing things to help you avoid problems:
4142
|:--------|:------------|:---|
4243
| [svelte/button-has-type](./rules/button-has-type.md) | disallow usage of button without an explicit type attribute | |
4344
| [svelte/no-at-debug-tags](./rules/no-at-debug-tags.md) | disallow the use of `{@debug}` | :star: |
44-
| [svelte/no-reactive-literals](./rules/no-reactive-literals.md) | Don't assign literal values in reactive statements | |
45+
| [svelte/no-reactive-literals](./rules/no-reactive-literals.md) | Don't assign literal values in reactive statements | :bulb: |
4546
| [svelte/no-unused-svelte-ignore](./rules/no-unused-svelte-ignore.md) | disallow unused svelte-ignore comments | :star: |
4647
| [svelte/no-useless-mustaches](./rules/no-useless-mustaches.md) | disallow unnecessary mustache interpolations | :wrench: |
4748
| [svelte/require-optimized-style-attribute](./rules/require-optimized-style-attribute.md) | require style attributes that can be optimized | |
@@ -58,7 +59,7 @@ These rules relate to style guidelines, and are therefore quite subjective:
5859
| [svelte/indent](./rules/indent.md) | enforce consistent indentation | :wrench: |
5960
| [svelte/max-attributes-per-line](./rules/max-attributes-per-line.md) | enforce the maximum number of attributes per line | :wrench: |
6061
| [svelte/mustache-spacing](./rules/mustache-spacing.md) | enforce unified spacing in mustache | :wrench: |
61-
| [svelte/no-extra-reactive-curlies](./rules/no-extra-reactive-curlies.md) | disallow wrapping single reactive statements in curly braces | |
62+
| [svelte/no-extra-reactive-curlies](./rules/no-extra-reactive-curlies.md) | disallow wrapping single reactive statements in curly braces | :bulb: |
6263
| [svelte/no-spaces-around-equal-signs-in-attribute](./rules/no-spaces-around-equal-signs-in-attribute.md) | disallow spaces around equal signs in attribute | :wrench: |
6364
| [svelte/prefer-class-directive](./rules/prefer-class-directive.md) | require class directives instead of ternary expressions | :wrench: |
6465
| [svelte/prefer-style-directive](./rules/prefer-style-directive.md) | require style directives instead of style attribute | :wrench: |

docs/rules/no-extra-reactive-curlies.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ description: "disallow wrapping single reactive statements in curly braces"
1010
> disallow wrapping single reactive statements in curly braces
1111
1212
- :exclamation: <badge text="This rule has not been released yet." vertical="middle" type="error"> **_This rule has not been released yet._** </badge>
13+
- :bulb: Some problems reported by this rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
1314

1415
## :book: Rule Details
1516

docs/rules/no-reactive-literals.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ description: "Don't assign literal values in reactive statements"
1010
> Don't assign literal values in reactive statements
1111
1212
- :exclamation: <badge text="This rule has not been released yet." vertical="middle" type="error"> **_This rule has not been released yet._** </badge>
13+
- :bulb: Some problems reported by this rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
1314

1415
## :book: Rule Details
1516

@@ -23,18 +24,25 @@ This rule reports on any assignment of a static, unchanging value within a react
2324
<script>
2425
/* eslint svelte/no-reactive-literals: "error" */
2526
/* ✓ GOOD */
26-
let foo = "bar";
27-
27+
let foo = "bar"
28+
2829
/* ✗ BAD */
29-
$: foo = "bar";
30+
$: foo = "bar"
3031
</script>
3132
```
3233

3334
</ESLintCodeBlock>
3435

3536
## :wrench: Options
3637

37-
Nothing
38+
Nothing.
39+
40+
## :heart: Compatibility
41+
42+
This rule was taken from [@tivac/eslint-plugin-svelte].
43+
This rule is compatible with `@tivac/svelte/reactive-literals` rule.
44+
45+
[@tivac/eslint-plugin-svelte]: https://github.com/tivac/eslint-plugin-svelte/
3846

3947
## :mag: Implementation
4048

tools/render-rules.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ export default function renderRulesTableContent(
5151
function toRuleRow(rule: RuleModule) {
5252
const mark = `${rule.meta.docs.recommended ? ":star:" : ""}${
5353
rule.meta.fixable ? ":wrench:" : ""
54-
}${rule.meta.deprecated ? ":warning:" : ""}`
54+
}${rule.meta.hasSuggestions ? ":bulb:" : ""}${
55+
rule.meta.deprecated ? ":warning:" : ""
56+
}`
5557
const link = `[${rule.meta.docs.ruleId}](${buildRulePath(
5658
rule.meta.docs.ruleName || "",
5759
)})`

tools/update-docs-rules-index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ sidebarDepth: 0
1212
1313
# Available Rules
1414
15-
The \`--fix\` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) automatically fixes problems reported by rules which have a wrench :wrench: below.
16-
The rules with the following star :star: are included in the \`plugin:svelte/recommended\` config.
15+
:wrench: Indicates that the rule is fixable, and using \`--fix\` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the reported problems.
16+
:bulb: Indicates that some problems reported by the rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
17+
:star: Indicates that the rule is included in the \`plugin:svelte/recommended\` config.
1718
1819
<!-- This file is automatically generated in tools/update-docs-rules-index.js, do not change! -->
1920
${renderRulesTableContent()}`,

tools/update-docs.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class DocFile {
6464
const {
6565
meta: {
6666
fixable,
67+
hasSuggestions,
6768
deprecated,
6869
replacedBy,
6970
docs: { ruleId, description, recommended },
@@ -103,6 +104,11 @@ class DocFile {
103104
"- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.",
104105
)
105106
}
107+
if (hasSuggestions) {
108+
notes.push(
109+
"- :bulb: Some problems reported by this rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).",
110+
)
111+
}
106112
if (!this.since) {
107113
notes.unshift(
108114
`- :exclamation: <badge text="This rule has not been released yet." vertical="middle" type="error"> **_This rule has not been released yet._** </badge>`,

0 commit comments

Comments
 (0)