This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 889
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add OPTION_ALLOW_SNAKE_CASE to variable name options
- Loading branch information
1 parent
d33f538
commit 6767f45
Showing
4 changed files
with
101 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
var validName1 = "hi"; | ||
var VALIDNAME2 = "there"; | ||
var valid_name3 = "tslint"; | ||
var Invalid_name1 = " "; // failure | ||
~~~~~~~~~~~~~ [variable name must be in camelcase, snakecase or uppercase] | ||
var InvalidName2 = " "; // failure | ||
~~~~~~~~~~~~ [variable name must be in camelcase, snakecase or uppercase] | ||
|
||
class Test { | ||
private valid_name = " "; | ||
private Invalid_name1 = "how"; // failure | ||
~~~~~~~~~~~~~ [variable name must be in camelcase, snakecase or uppercase] | ||
private _optionallyValid = "are"; // sometimes a failure | ||
~~~~~~~~~~~~~~~~ [variable name must be in camelcase, snakecase or uppercase] | ||
} | ||
|
||
function test() { | ||
() => { | ||
var valid_name = " "; | ||
var InVaLiDnAmE4 = "you"; // failure | ||
~~~~~~~~~~~~ [variable name must be in camelcase, snakecase or uppercase] | ||
}; | ||
} | ||
|
||
declare var DeclaresAreValid: any; | ||
|
||
export function functionWithInvalidParamNames (ok_name, BadName) { // 1 failure | ||
~~~~~~~ [variable name must be in camelcase, snakecase or uppercase] | ||
} | ||
|
||
let { foo, bar } = { foo: 1, bar: 2 }; | ||
let [ InvalidFoo, invalid_bar, ...invalid_baz ] = [1, 2, 3, 4]; // 1 failure | ||
~~~~~~~~~~ [variable name must be in camelcase, snakecase or uppercase] | ||
|
||
export function anotherFunctionWithInvalidParamNames ([first_element, SecondElement]) { // 1 failure | ||
~~~~~~~~~~~~~ [variable name must be in camelcase, snakecase or uppercase] | ||
// | ||
} | ||
|
||
export function functionWithInvalidSpread(InvalidArg: ...number) { // 1 failure | ||
~~~~~~~~~~ [variable name must be in camelcase, snakecase or uppercase] | ||
// | ||
} | ||
|
||
let optionallyValid_ = "bar"; | ||
~~~~~~~~~~~~~~~~ [variable name must be in camelcase, snakecase or uppercase] | ||
let _$httpBackend_ = "leading and trailing"; | ||
~~~~~~~~~~~~~~ [variable name must be in camelcase, snakecase or uppercase] | ||
|
||
// Aliases. | ||
class X { | ||
ValidAlias = ValidAlias; | ||
} | ||
|
||
var ValidAlias = some.ValidAlias; | ||
var ValidAlias = some.InValidAlias; | ||
~~~~~~~~~~ [variable name must be in camelcase, snakecase or uppercase] | ||
|
||
var someObject = {MoreValidAlias: 1}; | ||
var {MoreValidAlias: localVar} = someObject; | ||
var {MoreValidAlias: local_var} = someObject; | ||
var {MoreValidAlias: LocalVar} = someObject; | ||
~~~~~~~~ [variable name must be in camelcase, snakecase or uppercase] | ||
var {MoreValidAlias} = someObject; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"rules": { | ||
"variable-name": [true, "allow-snake-case"] | ||
} | ||
} |