Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Commit

Permalink
fix(file-name-casing): ignore option works correctly (#4848)
Browse files Browse the repository at this point in the history
  • Loading branch information
adidahiya authored Sep 9, 2019
1 parent a15541d commit 38ef9d9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
10 changes: 8 additions & 2 deletions src/rules/fileNameCasingRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { isCamelCased, isKebabCased, isPascalCased, isSnakeCased } from "../util
enum Casing {
CamelCase = "camel-case",
PascalCase = "pascal-case",
Ignored = "ignored",
Ignored = "ignore",
KebabCase = "kebab-case",
SnakeCase = "snake-case",
}
Expand All @@ -40,7 +40,13 @@ type ValidationResult = Casing | undefined;

type Validator<T extends Config> = (sourceFile: ts.SourceFile, casing: T) => ValidationResult;

const rules = [Casing.CamelCase, Casing.PascalCase, Casing.KebabCase, Casing.SnakeCase];
const rules = [
Casing.CamelCase,
Casing.Ignored,
Casing.PascalCase,
Casing.KebabCase,
Casing.SnakeCase,
];

const validCasingOptions = new Set(rules);

Expand Down
6 changes: 3 additions & 3 deletions test/rules/file-name-casing/complex/tslint.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"rules": {
"file-name-casing": [true, {
".component.ts": "pascal-case",
".tsx": "pascal-case",
".ts": "camel-case"
".component.ts$": "pascal-case",
".tsx$": "pascal-case",
".ts$": "camel-case"
}]
}
}
4 changes: 2 additions & 2 deletions test/rules/file-name-casing/ignore/tslint.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"rules": {
"file-name-casing": [true, {
".ts": "ignore",
".tsx": "pascal-case"
".ts$": "ignore",
".tsx$": "pascal-case"
}]
}
}

0 comments on commit 38ef9d9

Please sign in to comment.