Skip to content

Commit

Permalink
no-file-name-articles: forbid teh
Browse files Browse the repository at this point in the history
It is sometimes used as an alternative to "the", so
`no-file-name-articles` rule should also forbid it.

Closes GH-100.
  • Loading branch information
ChALkeR authored and wooorm committed Oct 2, 2016
1 parent 3b11ff4 commit e4640fe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions doc/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -1460,6 +1460,12 @@ When turned on is passed in, the following error is given:

When turned on is passed in, the following error is given:

```text
1:1: Do not start file names with `teh`
```

When turned on is passed in, the following error is given:

```text
1:1: Do not start file names with `an`
```
Expand Down
6 changes: 5 additions & 1 deletion packages/remark-lint/lib/rules/no-file-name-articles.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
*
* 1:1: Do not start file names with `the`
*
* @example {"name": "teh-title.md", "label": "output", "config": {"positionless": true}}
*
* 1:1: Do not start file names with `teh`
*
* @example {"name": "an-article.md", "label": "output", "config": {"positionless": true}}
*
* 1:1: Do not start file names with `an`
Expand All @@ -33,7 +37,7 @@ module.exports = noFileNameArticles;
* @param {File} file - Virtual file.
*/
function noFileNameArticles(ast, file) {
var match = file.stem && file.stem.match(/^(the|an?)\b/i);
var match = file.stem && file.stem.match(/^(the|teh|an?)\b/i);

if (match) {
file.message('Do not start file names with `' + match[0] + '`');
Expand Down

0 comments on commit e4640fe

Please sign in to comment.