Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
Make import-name camelCase begin with lowercase
Browse files Browse the repository at this point in the history
`camelCase` currently allows the first letter to be uppercase.
`any-case` is either `PascalCase` or `camelCase`, but since `camelCase`
allows the first letter to be uppercase, `any-case` and `camelCase` are
currently equivalent. Enforce the first letter to be lowercase.
  • Loading branch information
dosentmatter committed Jul 19, 2019
1 parent b26592e commit 971f8b5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/importNameRule.ts
Expand Up @@ -233,12 +233,14 @@ function walk(ctx: Lint.WalkContext<Option>) {
}

function makeCamelCase(input: string): string {
return input.replace(
let result = `${input.charAt(0)}${input.slice(1)}`;
result = result.replace(
/[-|\.|_](.)/g, // tslint:disable-next-line:variable-name
(_match: string, group1: string): string => {
return group1.toUpperCase();
}
);
return result;
}

function makePascalCase(input: string): string {
Expand Down

0 comments on commit 971f8b5

Please sign in to comment.