Skip to content

Commit 0873bb5

Browse files
committed
feat: init the filename-naming-convention rule
1 parent 481e17a commit 0873bb5

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# The filename should follow the filename naming convention (filename-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.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* @fileoverview The filename should follow the filename naming convention
3+
* @author Duke Luo
4+
*/
5+
'use strict';
6+
7+
/**
8+
* @type {import('eslint').Rule.RuleModule}
9+
*/
10+
module.exports = {
11+
meta: {
12+
type: 'layout',
13+
docs: {
14+
description: 'The filename should follow the filename naming convention',
15+
category: 'Layout & Formatting',
16+
recommended: false,
17+
url: null, // TODO: URL to the documentation page for this rule
18+
},
19+
fixable: null, // Or `code` or `whitespace`
20+
schema: [], // Add a schema if the rule has options
21+
},
22+
23+
create() {
24+
return {};
25+
},
26+
};
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* @fileoverview The filename should follow the filename naming convention
3+
* @author Duke Luo
4+
*/
5+
'use strict';
6+
7+
const rule = require('../../../lib/rules/filename-naming-convention'),
8+
RuleTester = require('eslint').RuleTester;
9+
const ruleTester = new RuleTester();
10+
11+
ruleTester.run('filename-naming-convention', rule, {
12+
valid: [],
13+
14+
invalid: [
15+
{
16+
code: '',
17+
errors: [{ message: 'Fill me in.', type: 'Me too' }],
18+
},
19+
],
20+
});

0 commit comments

Comments
 (0)