Skip to content

Commit 5176019

Browse files
committed
Update doc
1 parent b4a3edb commit 5176019

File tree

7 files changed

+26
-52
lines changed

7 files changed

+26
-52
lines changed

README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -285,22 +285,22 @@ These rules relate to style guidelines, and are therefore quite subjective:
285285
| [@ota-meshi/svelte/shorthand-attribute](https://ota-meshi.github.io/eslint-plugin-svelte/rules/shorthand-attribute.html) | enforce use of shorthand syntax in attribute | :wrench: |
286286
| [@ota-meshi/svelte/spaced-html-comment](https://ota-meshi.github.io/eslint-plugin-svelte/rules/spaced-html-comment.html) | enforce consistent spacing after the `<!--` and before the `-->` in a HTML comment | :wrench: |
287287

288-
## System
288+
## Extension Rules
289289

290-
These rules relate to this plugin works:
290+
These rules extend the rules provided by ESLint itself to work well in Svelte:
291291

292292
| Rule ID | Description | |
293293
|:--------|:------------|:---|
294-
| [@ota-meshi/svelte/comment-directive](https://ota-meshi.github.io/eslint-plugin-svelte/rules/comment-directive.html) | support comment-directives in HTML template | :star: |
295-
| [@ota-meshi/svelte/system](https://ota-meshi.github.io/eslint-plugin-svelte/rules/system.html) | system rule for working this plugin | :star: |
294+
| [@ota-meshi/svelte/no-inner-declarations](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-inner-declarations.html) | disallow variable or `function` declarations in nested blocks | :star: |
296295

297-
## Extension Rules
296+
## System
298297

299-
These rules extend the rules provided by ESLint itself to work well in Svelte:
298+
These rules relate to this plugin works:
300299

301300
| Rule ID | Description | |
302301
|:--------|:------------|:---|
303-
| [@ota-meshi/svelte/no-inner-declarations](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-inner-declarations.html) | disallow variable or `function` declarations in nested blocks | :star: |
302+
| [@ota-meshi/svelte/comment-directive](https://ota-meshi.github.io/eslint-plugin-svelte/rules/comment-directive.html) | support comment-directives in HTML template | :star: |
303+
| [@ota-meshi/svelte/system](https://ota-meshi.github.io/eslint-plugin-svelte/rules/system.html) | system rule for working this plugin | :star: |
304304

305305
<!--RULES_TABLE_END-->
306306
<!--RULES_SECTION_END-->

docs/.vuepress/components/rules/index.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ const CATEGORY_INDEX = {
2424
"Security Vulnerability": 2,
2525
"Best Practices": 3,
2626
"Stylistic Issues": 4,
27-
System: 5,
28-
"Extension Rules": 5.5,
27+
"Extension Rules": 5,
28+
System: 5.5,
2929
"eslint-core-rules@Possible Errors": 6,
3030
"eslint-core-rules@Best Practices": 7,
3131
"eslint-core-rules@Strict Mode": 8,
@@ -39,8 +39,8 @@ const CATEGORY_CLASSES = {
3939
"Security Vulnerability": "eslint-plugin-svelte__category",
4040
"Best Practices": "eslint-plugin-svelte__category",
4141
"Stylistic Issues": "eslint-plugin-svelte__category",
42-
System: "eslint-plugin-svelte__category",
4342
"Extension Rules": "eslint-plugin-svelte__category",
43+
System: "eslint-plugin-svelte__category",
4444
}
4545

4646
const allRules = []
@@ -51,9 +51,7 @@ for (const k of Object.keys(plugin.rules)) {
5151
continue
5252
}
5353

54-
const category = rule.meta.docs.extensionRule
55-
? "Extension Rules"
56-
: rule.meta.docs.category
54+
const category = rule.meta.docs.category
5755

5856
allRules.push({
5957
classes: "eslint-plugin-svelte__rule",

docs/.vuepress/config.js

+2-16
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ const path = require("path")
22
// eslint-disable-next-line node/no-missing-require, node/no-unpublished-require -- no build
33
const { rules } = require("../../lib/utils/rules")
44

5-
const svelteRules = rules.filter(
6-
(rule) => !rule.meta.docs.extensionRule && !rule.meta.deprecated,
7-
)
5+
const svelteRules = rules.filter((rule) => !rule.meta.deprecated)
86

97
const categories = [
108
"Possible Errors",
119
"Security Vulnerability",
1210
"Best Practices",
1311
"Stylistic Issues",
12+
"Extension Rules",
1413
"System",
1514
]
1615
svelteRules.forEach((rule) => {
@@ -25,10 +24,6 @@ const categoryRules = categories.map((cat) => {
2524
}
2625
})
2726

28-
const extensionRules = rules.filter(
29-
(rule) => rule.meta.docs.extensionRule && !rule.meta.deprecated,
30-
)
31-
3227
function ruleToLink({
3328
meta: {
3429
docs: { ruleId, ruleName },
@@ -84,15 +79,6 @@ module.exports = {
8479
children: cat.rules.map(ruleToLink),
8580
}
8681
}),
87-
...(extensionRules.length
88-
? [
89-
{
90-
title: "Extension Rules",
91-
collapsable: false,
92-
children: extensionRules.map(ruleToLink),
93-
},
94-
]
95-
: []),
9682
// Rules in no category.
9783
...(rules.some((rule) => rule.meta.deprecated)
9884
? [

docs/rules/README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,19 @@ These rules relate to style guidelines, and are therefore quite subjective:
5353
| [@ota-meshi/svelte/shorthand-attribute](./shorthand-attribute.md) | enforce use of shorthand syntax in attribute | :wrench: |
5454
| [@ota-meshi/svelte/spaced-html-comment](./spaced-html-comment.md) | enforce consistent spacing after the `<!--` and before the `-->` in a HTML comment | :wrench: |
5555

56-
## System
56+
## Extension Rules
5757

58-
These rules relate to this plugin works:
58+
These rules extend the rules provided by ESLint itself to work well in Svelte:
5959

6060
| Rule ID | Description | |
6161
|:--------|:------------|:---|
62-
| [@ota-meshi/svelte/comment-directive](./comment-directive.md) | support comment-directives in HTML template | :star: |
63-
| [@ota-meshi/svelte/system](./system.md) | system rule for working this plugin | :star: |
62+
| [@ota-meshi/svelte/no-inner-declarations](./no-inner-declarations.md) | disallow variable or `function` declarations in nested blocks | :star: |
6463

65-
## Extension Rules
64+
## System
6665

67-
These rules extend the rules provided by ESLint itself to work well in Svelte:
66+
These rules relate to this plugin works:
6867

6968
| Rule ID | Description | |
7069
|:--------|:------------|:---|
71-
| [@ota-meshi/svelte/no-inner-declarations](./no-inner-declarations.md) | disallow variable or `function` declarations in nested blocks | :star: |
70+
| [@ota-meshi/svelte/comment-directive](./comment-directive.md) | support comment-directives in HTML template | :star: |
71+
| [@ota-meshi/svelte/system](./system.md) | system rule for working this plugin | :star: |

src/rules/no-inner-declarations.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default createRule("no-inner-declarations", {
1313
docs: {
1414
description:
1515
"disallow variable or `function` declarations in nested blocks",
16-
category: "Possible Errors",
16+
category: "Extension Rules",
1717
recommended: true,
1818
extensionRule: "no-inner-declarations",
1919
},

src/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export type RuleCategory =
6060
| "Security Vulnerability"
6161
| "Best Practices"
6262
| "Stylistic Issues"
63+
| "Extension Rules"
6364
| "System"
6465

6566
export interface RuleMetaData {

tools/render-rules.ts

+4-15
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const categories = [
66
"Security Vulnerability",
77
"Best Practices",
88
"Stylistic Issues",
9+
"Extension Rules",
910
"System",
1011
] as const
1112

@@ -18,14 +19,13 @@ const descriptions: Record<typeof categories[number], string> = {
1819
"These rules relate to better ways of doing things to help you avoid problems:",
1920
"Stylistic Issues":
2021
"These rules relate to style guidelines, and are therefore quite subjective:",
22+
"Extension Rules":
23+
"These rules extend the rules provided by ESLint itself to work well in Svelte:",
2124
System: "These rules relate to this plugin works:",
2225
}
2326

2427
const activeRules = rules.filter((rule) => !rule.meta.deprecated)
25-
const svelteRules = activeRules.filter((rule) => !rule.meta.docs.extensionRule)
26-
const extensionRules = activeRules.filter(
27-
(rule) => rule.meta.docs.extensionRule,
28-
)
28+
const svelteRules = activeRules
2929
const deprecatedRules = rules.filter((rule) => rule.meta.deprecated)
3030

3131
activeRules.forEach((rule) => {
@@ -87,17 +87,6 @@ ${cat.rules.map(toRuleRow).join("\n")}
8787
`
8888
})
8989
.join("")
90-
if (extensionRules.length >= 1) {
91-
rulesTableContent += `
92-
## Extension Rules
93-
94-
These rules extend the rules provided by ESLint itself to work well in Svelte:
95-
96-
| Rule ID | Description | |
97-
|:--------|:------------|:---|
98-
${extensionRules.map(toRuleRow).join("\n")}
99-
`
100-
}
10190

10291
// -----------------------------------------------------------------------------
10392
if (deprecatedRules.length >= 1) {

0 commit comments

Comments
 (0)