Skip to content

Commit 3bf94c7

Browse files
committed
feat: init new rule folder-naming-convention
1 parent 085ddaf commit 3bf94c7

File tree

3 files changed

+84
-0
lines changed

3 files changed

+84
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# The folder should follow the folder naming convention (folder-naming-convention)
2+
3+
Please describe the origin of the rule here.
4+
5+
## Rule Details
6+
7+
This rule aims to...
8+
9+
Examples of **incorrect** code for this rule:
10+
11+
```js
12+
13+
// fill me in
14+
15+
```
16+
17+
Examples of **correct** code for this rule:
18+
19+
```js
20+
21+
// fill me in
22+
23+
```
24+
25+
### Options
26+
27+
If there are any options, describe them here. Otherwise, delete this section.
28+
29+
## When Not To Use It
30+
31+
Give a short description of when it would be appropriate to turn off this rule.
32+
33+
## Further Reading
34+
35+
If there are other links that describe the issue this rule addresses, please include them here in a bulleted list.

lib/rules/folder-naming-convention.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
* @fileoverview The folder should follow the folder naming convention
3+
* @author Duke Luo
4+
*/
5+
'use strict';
6+
7+
const { getDocUrl } = require('../utils/doc');
8+
9+
/**
10+
* @type {import('eslint').Rule.RuleModule}
11+
*/
12+
module.exports = {
13+
meta: {
14+
type: 'layout',
15+
docs: {
16+
description: 'The folder should follow the folder naming convention',
17+
category: 'Layout & Formatting',
18+
recommended: false,
19+
url: getDocUrl('folder-naming-convention'),
20+
},
21+
fixable: null,
22+
schema: [],
23+
},
24+
25+
create() {
26+
return {};
27+
},
28+
};
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* @fileoverview The folder should follow the folder naming convention
3+
* @author Duke Luo
4+
*/
5+
'use strict';
6+
7+
const rule = require('../../../lib/rules/folder-naming-convention');
8+
const RuleTester = require('eslint').RuleTester;
9+
10+
const ruleTester = new RuleTester();
11+
12+
ruleTester.run('folder-naming-convention', rule, {
13+
valid: [],
14+
15+
invalid: [
16+
{
17+
code: '',
18+
errors: [{ message: 'Fill me in.', type: 'Me too' }],
19+
},
20+
],
21+
});

0 commit comments

Comments
 (0)