Skip to content

Commit

Permalink
Merge pull request #4 from Jokero/addStylizedAliases
Browse files Browse the repository at this point in the history
Added stylized versions of existing aliases
  • Loading branch information
dolsem committed Sep 18, 2020
2 parents 43a6984 + 803365c commit a1d4a5a
Show file tree
Hide file tree
Showing 3 changed files with 251 additions and 238 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = {

## Plugin Options

The following built-in values are supported: `'pascalcase'`, `'camelcase'`, `'snakecase'`, `'kebabcase'`. You can also provide your own regex:
The following built-in values are supported: `pascalcase`/`PascalCase`, `camelcase`/`camelCase`, `snakecase`/`snake_case`, `kebabcase`/`kebab-case`. You can also provide your own regex:

```js
...
Expand All @@ -42,7 +42,7 @@ You can also specify different options for different file extensions. In this ca

```js
...
'filename-rules/match': [2, { '.js': 'camelcase', '.ts': /^([a-z]+-)*[a-z]+(?:\..*)?$/ }],
'filename-rules/match': [2, { '.js': 'camelCase', '.ts': /^([a-z]+-)*[a-z]+(?:\..*)?$/ }],
...
```

Expand Down
5 changes: 5 additions & 0 deletions lib/match.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ const aliases = {
kebabcase: /^([a-z]+-)*[a-z]+(?:\..*)?$/,
};

aliases.PascalCase = aliases.pascalcase;
aliases.camelCase = aliases.camelcase;
aliases.snake_case = aliases.snakecase;
aliases['kebab-case'] = aliases.kebabcase;

const getRegex = (value, filename) => {
if (value instanceof RegExp) return [value, value.toString()];
if (typeof value === 'string') {
Expand Down

0 comments on commit a1d4a5a

Please sign in to comment.