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

fix(file-name-casing): ignore option works correctly #4848

Merged
merged 1 commit into from
Sep 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
}]
}
}