Skip to content

Commit b5d54a0

Browse files
committed
docs: create separate rule docs
1 parent 15cab6d commit b5d54a0

10 files changed

+69
-30
lines changed

.eslintrc.js

+10
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,14 @@ module.exports = {
1010
es2017: true,
1111
node: true,
1212
},
13+
rules: {
14+
'eslint-plugin/require-meta-docs-description': 'error',
15+
'eslint-plugin/require-meta-docs-url': [
16+
'error',
17+
{
18+
pattern:
19+
'https://github.com/emberjs/eslint-plugin-ember-internal/tree/master/docs/rules/{{name}}.md',
20+
},
21+
],
22+
},
1323
};

README.md

+6-30
Original file line numberDiff line numberDiff line change
@@ -42,36 +42,12 @@ Then configure the rules you want to use under the rules section.
4242
}
4343
```
4444

45-
## Supported Rules
46-
47-
- `require-yuidoc-access` - Ensures that every YUIDoc comment has `@public`, `@protected` or `@private` declared
48-
- `no-const-outside-module-scope` - Prevent `const` from being used outside of the module scope (e.g. in functions)
49-
- `no-empty-yuidoc-code-blocks` - Prevents empty code blocks in YUIDoc comments, e.g.
50-
51-
```js
52-
/**
53-
* See code below:
54-
*
55-
* ```js
56-
* ```
57-
*/
58-
```
59-
60-
- `require-yuidoc-code-block-type` - Ensures that every code blocks in YUIDoc comments has a type associated, e.g.
61-
62-
```js
63-
/**
64-
* See code below:
65-
*
66-
* ```js
67-
* good
68-
* ```
69-
*
70-
* ```
71-
* bad
72-
* ```
73-
*/
74-
```
45+
## Rules
46+
47+
- [`no-const-outside-module-scope`](./docs/rules/no-const-outside-module-scope.md)
48+
- [`no-empty-yuidoc-code-blocks`](./docs/rules/no-empty-yuidoc-code-blocks.md)
49+
- [`require-yuidoc-access`](./docs/rules/require-yuidoc-access.md)
50+
- [`require-yuidoc-code-block-type`](./docs/rules/require-yuidoc-code-block-type.md)
7551

7652
## License
7753

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# no-const-outside-module-scope
2+
3+
Prevent `const` from being used outside of the module scope (e.g. in functions).
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# no-empty-yuidoc-code-blocks
2+
3+
Prevents empty code blocks in YUIDoc comments, e.g.
4+
5+
```js
6+
/**
7+
* See code below:
8+
*
9+
* ```js
10+
* ```
11+
*/
12+
```

docs/rules/require-yuidoc-access.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# require-yuidoc-access
2+
3+
Ensures that every YUIDoc comment has `@public`, `@protected` or `@private` declared.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# require-yuidoc-code-block-type
2+
3+
Ensures that every code blocks in YUIDoc comments has a type associated.
4+
5+
```js
6+
/**
7+
* See code below:
8+
*
9+
* ```js
10+
* good
11+
* ```
12+
*
13+
* ```
14+
* bad
15+
* ```
16+
*/
17+
```

lib/rules/no-const-outside-module-scope.js

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ module.exports = {
66
type: 'suggestion',
77
fixable: 'code',
88
schema: [],
9+
docs: {
10+
description:
11+
'disallow `const` from being used outside of the module scope (e.g. in functions)',
12+
url: 'https://github.com/emberjs/eslint-plugin-ember-internal/tree/master/docs/rules/no-const-outside-module-scope.md',
13+
},
914
},
1015
create(context) {
1116
return {

lib/rules/no-empty-yuidoc-code-blocks.js

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ module.exports = {
1313
meta: {
1414
type: 'suggestion',
1515
schema: [],
16+
docs: {
17+
description: 'disallow empty code blocks in YUIDoc comments',
18+
url: 'https://github.com/emberjs/eslint-plugin-ember-internal/tree/master/docs/rules/no-empty-yuidoc-code-blocks.md',
19+
},
1620
},
1721
create: function (context) {
1822
var sourceCode = context.getSourceCode();

lib/rules/require-yuidoc-access.js

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ module.exports = {
1717
meta: {
1818
type: 'suggestion',
1919
schema: [],
20+
docs: {
21+
description:
22+
'require that every YUIDoc comment has `@public`, `@protected` or `@private` declared',
23+
url: 'https://github.com/emberjs/eslint-plugin-ember-internal/tree/master/docs/rules/require-yuidoc-access.md',
24+
},
2025
},
2126
create: function (context) {
2227
var sourceCode = context.getSourceCode();

lib/rules/require-yuidoc-code-block-type.js

+4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ module.exports = {
2626
meta: {
2727
type: 'suggestion',
2828
schema: [],
29+
docs: {
30+
description: 'require that every code blocks in YUIDoc comments has a type associated',
31+
url: 'https://github.com/emberjs/eslint-plugin-ember-internal/tree/master/docs/rules/require-yuidoc-code-block-type.md',
32+
},
2933
},
3034
create: function (context) {
3135
var sourceCode = context.getSourceCode();

0 commit comments

Comments
 (0)