Enforces vertical alignment.
+ + + +Helps maintain a readable, consistent style in your codebase.
+ + + + +Three arguments may be optionally provided:
+ +"parameters"
checks alignment of function parameters."arguments"
checks alignment of function call arguments."statements"
checks alignment of statements."align": [true, "parameters", "statements"]+ + +
{+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/ban.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/ban.html new file mode 100644 index 0000000..06a3383 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/ban.html @@ -0,0 +1,30 @@ +
"type": "list",
"listType": {
"type": "enum",
"enumValues": [
"arguments",
"parameters",
"statements"
]
}
}
Bans the use of specific functions.
+ + +At this time, there is no way to disable global methods with this rule.
+ + + + + +A list of ['object', 'method']
pairs which ban object.method()
.
"ban": [true, ["console", "log"], ["someObject", "someFunction"]]+ + +
{+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/class-name.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/class-name.html new file mode 100644 index 0000000..4ac5148 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/class-name.html @@ -0,0 +1,31 @@ +
"type": "list",
"listType": {
"type": "array",
"arrayMembers": [
{
"type": "string"
},
{
"type": "string"
}
]
}
}
Enforces PascalCased class and interface names.
+ + + +Makes it easy to differentitate classes from regular variables at a glance.
+ + + + +Not configurable.
+ + +"class-name": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/comment-format.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/comment-format.html new file mode 100644 index 0000000..e89d167 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/comment-format.html @@ -0,0 +1,42 @@ +
Enforces formatting rules for single-line comments.
+ + + +Helps maintain a consistent, readable style in your codebase.
+ + + + +Three arguments may be optionally provided:
+ +"check-space"
requires that all single-line comments must begin with a space, as in // comment
+ ///
are also allowed, for things such as ///<reference>
"check-lowercase"
requires that the first non-whitespace character of a comment must be lowercase, if applicable."check-uppercase"
requires that the first non-whitespace character of a comment must be uppercase, if applicable."comment-format": [true, "check-space", "check-lowercase"]+ + +
{+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/curly.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/curly.html new file mode 100644 index 0000000..85f0c29 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/curly.html @@ -0,0 +1,36 @@ +
"type": "list",
"listType": {
"type": "enum",
"enumValues": [
"check-space",
"check-lowercase",
"check-uppercase"
]
}
}
Enforces braces for if
/for
/do
/while
statements.
if (foo === bar)
foo++;
bar++;
+
+In the code above, the author almost certainly meant for both foo++
and bar++
+to be executed only if foo === bar
. However, he forgot braces and bar++
will be executed
+no matter what. This rule could prevent such a mistake.
Not configurable.
+ + +"curly": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/eofline.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/eofline.html new file mode 100644 index 0000000..e77e912 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/eofline.html @@ -0,0 +1,31 @@ +
Ensures the file ends with a newline.
+ + + +It is a standard convention to end files with a newline.
+ + + + +Not configurable.
+ + +"eofline": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/forin.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/forin.html new file mode 100644 index 0000000..3dca177 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/forin.html @@ -0,0 +1,35 @@ +
Requires a for ... in
statement to be filtered with an if
statement.
for (let key in someObject) {
if (someObject.hasOwnProperty(key)) {
// code here
}
}
+Prevents accidental interation over properties inherited from an object’s prototype.
+See MDN’s for...in
+documentation for more information about for...in
loops.
Not configurable.
+ + +"forin": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/indent.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/indent.html new file mode 100644 index 0000000..b432c9f --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/indent.html @@ -0,0 +1,39 @@ +
Enforces indentation with tabs or spaces.
+ + + +Using only one of tabs or spaces for indentation leads to more consistent editor behavior, +cleaner diffs in version control, and easier programatic manipulation.
+ + + + +One of the following arguments must be provided:
+ +"spaces"
enforces consistent spaces."tabs"
enforces consistent tabs."indent": [true, "spaces"]+ + +
{+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/interface-name.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/interface-name.html new file mode 100644 index 0000000..ba0a4a1 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/interface-name.html @@ -0,0 +1,39 @@ +
"type": "enum",
"enumValues": [
"tabs",
"spaces"
]
}
Requires interface names to begin with a capital ‘I’
+ + + +Makes it easy to differentitate interfaces from regular classes at a glance.
+ + + + +One of the following two options must be provided:
+ +"always-prefix"
requires interface names to start with an “I”"never-prefix"
requires interface names to not have an “I” prefix"interface-name": [true, "always-prefix"]+ +
"interface-name": [true, "never-prefix"]+ + +
{+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/jsdoc-format.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/jsdoc-format.html new file mode 100644 index 0000000..9967284 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/jsdoc-format.html @@ -0,0 +1,42 @@ +
"type": "enum",
"enumValues": [
"always-prefix",
"never-prefix"
]
}
Enforces basic format rules for JSDoc comments.
+ + + +The following rules are enforced for JSDoc comments (comments starting with /**
):
/**
and end with */
Helps maintain a consistent, readable style for JSDoc comments.
+ + + + +Not configurable.
+ + +"jsdoc-format": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/label-position.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/label-position.html new file mode 100644 index 0000000..813f060 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/label-position.html @@ -0,0 +1,37 @@ +
Only allows labels in sensible locations.
+ + +This rule only allows labels to be on do/for/while/switch
statements.
Labels in JavaScript only can be used in conjunction with break
or continue
,
+constructs meant to be used for loop flow control. While you can theoretically use
+labels on any block statement in JS, it is considered poor code structure to do so.
Not configurable.
+ + +"label-position": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/label-undefined.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/label-undefined.html new file mode 100644 index 0000000..5fa9d1a --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/label-undefined.html @@ -0,0 +1,34 @@ +
Checks that labels are defined before usage.
+ + +This rule is now implemented in the TypeScript compiler and does not need to be used.
+ + + +Using break
or continue
to go to an out-of-scope label is an error in JS.
Not configurable.
+ + +"label-undefined": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/max-line-length.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/max-line-length.html new file mode 100644 index 0000000..676917f --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/max-line-length.html @@ -0,0 +1,34 @@ +
Requires lines to be under a certain max length.
+ + + +Limiting the length of a line of code improves code readability. +It also makes comparing code side-by-side easier and improves compatibility with +various editors, IDEs, and diff viewers.
+ + + + +An integer indicating the max length of lines.
+ + +"max-line-length": [true, 120]+ + +
{+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/member-access.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/member-access.html new file mode 100644 index 0000000..12e1e63 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/member-access.html @@ -0,0 +1,39 @@ +
"type": "number"
}
Requires explicit visibility declarations for class members.
+ + + +Explicit visibility declarations can make code more readable and accessible for those new to TS.
+ + + + +Two arguments may be optionally provided:
+ +"check-accessor"
enforces explicit visibility on get/set accessors (can only be public)"check-constructor"
enforces explicit visibility on constructors (can only be public)"member-access": true+ +
"member-access": [true, "check-accessor"]+ + +
{+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/member-ordering.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/member-ordering.html new file mode 100644 index 0000000..9fa58ac --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/member-ordering.html @@ -0,0 +1,59 @@ +
"type": "list",
"listType": {
"type": "enum",
"enumValues": [
"check-accessor",
"check-constructor"
]
}
}
Enforces member ordering.
+ + + +A consistent ordering for class members can make classes easier to read, navigate, and edit.
+ + + + +One argument, which is an object, must be provided. It should contain an order
property.
+The order
property should have a value of one of the following strings:
fields-first
statics-first
instance-sandwich
Alternatively, the value for order
maybe be an array consisting of the following strings:
public-static-field
protected-static-field
private-static-field
public-instance-field
protected-instance-field
private-instance-field
constructor
public-static-method
protected-static-method
private-static-method
public-instance-method
protected-instance-method
private-instance-method
This is useful if one of the preset orders does not meet your needs.
+ + +"member-ordering": [true, { "order": "fields-first" }]+ + +
{+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/new-parens.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/new-parens.html new file mode 100644 index 0000000..085e9ff --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/new-parens.html @@ -0,0 +1,31 @@ +
"type": "object",
"properties": {
"order": {
"type": "enum",
"enumValues": [
"fields-first",
"statics-first",
"instance-sandwich"
]
}
}
}
Requires parentheses when invoking a constructor via the new
keyword.
Maintains stylistic consistency with other function calls.
+ + + + +Not configurable.
+ + +"new-parens": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-angle-bracket-type-assertion.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-angle-bracket-type-assertion.html new file mode 100644 index 0000000..4b5a7e4 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-angle-bracket-type-assertion.html @@ -0,0 +1,34 @@ +
Requires the use of as Type
for type assertions instead of <Type>
.
Both formats of type assertions have the same effect, but only as
type assertions
+work in .tsx
files. This rule ensures that you have a consistent type assertion style
+across your codebase.
Not configurable.
+ + +"no-angle-bracket-type-assertion": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-any.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-any.html new file mode 100644 index 0000000..4cdb8c1 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-any.html @@ -0,0 +1,31 @@ +
Diallows usages of any
as a type declaration.
Using any
as a type declaration nullifies the compile-time benefits of the type system.
Not configurable.
+ + +"no-any": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-arg.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-arg.html new file mode 100644 index 0000000..30e73f1 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-arg.html @@ -0,0 +1,34 @@ +
Disallows use of arguments.callee
.
Using arguments.callee
makes various performance optimizations impossible.
+See MDN
+for more details on why to avoid arguments.callee
.
Not configurable.
+ + +"no-arg": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-bitwise.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-bitwise.html new file mode 100644 index 0000000..0382bb6 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-bitwise.html @@ -0,0 +1,41 @@ +
Disallows bitwise operators.
+ + + +Specifically, the following bitwise operators are banned:
+&
, &=
, |
, |=
,
+^
, ^=
, <<
, <<=
,
+>>
, >>=
, >>>
, >>>=
, and ~
.
+This rule does not ban the use of &
and |
for intersection and union types.
Bitwise operators are often typos - for example bool1 & bool2
instead of bool1 && bool2
.
+They also can be an indicator of overly clever code which decreases maintainability.
Not configurable.
+ + +"no-bitwise": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-conditional-assignment.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-conditional-assignment.html new file mode 100644 index 0000000..3ecde97 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-conditional-assignment.html @@ -0,0 +1,37 @@ +
Disallows any type of assignment in conditionals.
+ + +This applies to do-while
, for
, if
, and while
statements.
Assignments in conditionals are often typos:
+for example if (var1 = var2)
instead of if (var1 == var2)
.
+They also can be an indicator of overly clever code which decreases maintainability.
Not configurable.
+ + +"no-conditional-assignment": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-consecutive-blank-lines.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-consecutive-blank-lines.html new file mode 100644 index 0000000..e9e014d --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-consecutive-blank-lines.html @@ -0,0 +1,31 @@ +
Disallows more than one blank line in a row.
+ + + +Helps maintain a readable style in your codebase.
+ + + + +Not configurable.
+ + +"no-consecutive-blank-lines": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-console.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-console.html new file mode 100644 index 0000000..479c9c4 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-console.html @@ -0,0 +1,31 @@ +
Bans the use of specified console
methods.
In general, console
methods aren’t appropriate for production code.
A list of method names to ban.
+ + +"no-console": [true, ["log", "error"]]+ + +
{+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-construct.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-construct.html new file mode 100644 index 0000000..d433bb1 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-construct.html @@ -0,0 +1,37 @@ +
"type": "list",
"listType": {
"type": "string"
}
}
Disallows access to the constructors of String
, Number
, and Boolean
.
Disallows constructor use such as new Number(foo)
but does not disallow Number(foo)
.
There is little reason to use String
, Number
, or Boolean
as constructors.
+In almost all cases, the regular function-call version is more appropriate.
+More details are available on StackOverflow.
Not configurable.
+ + +"no-construct": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-constructor-vars.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-constructor-vars.html new file mode 100644 index 0000000..025d752 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-constructor-vars.html @@ -0,0 +1,33 @@ +
Disallows parameter properties.
+ + + +Parameter properties can be confusing to those new to TS as they are less explicit +than other ways of declaring and initializing class members.
+ + + + +Not configurable.
+ + +"no-constructor-vars": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-debugger.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-debugger.html new file mode 100644 index 0000000..339dbbe --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-debugger.html @@ -0,0 +1,31 @@ +
Disallows debugger
statements.
In general, debugger
statements aren’t appropriate for production code.
Not configurable.
+ + +"no-debugger": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-default-export.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-default-export.html new file mode 100644 index 0000000..c76ee80 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-default-export.html @@ -0,0 +1,37 @@ +
Disallows default exports in ES6-style modules.
+ + +Use named exports instead.
+ + + +Named imports/exports promote clarity. +In addition, current tooling differs on the correct way to handle default imports/exports. +Avoiding them all together can help avoid tooling bugs and conflicts.
+ + + + +Not configurable.
+ + +"no-default-export": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-duplicate-key.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-duplicate-key.html new file mode 100644 index 0000000..59e7aaf --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-duplicate-key.html @@ -0,0 +1,33 @@ +
Disallows duplicate keys in object literals.
+ + + +There is no good reason to define an object literal with the same key twice. +This rule is now implemented in the TypeScript compiler and does not need to be used.
+ + + + +Not configurable.
+ + +"no-duplicate-key": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-duplicate-variable.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-duplicate-variable.html new file mode 100644 index 0000000..91091e6 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-duplicate-variable.html @@ -0,0 +1,38 @@ +
Disallows duplicate variable declarations in the same block scope.
+ + + +This rule is only useful when using the var
keyword -
+the compiler will detect redeclarations of let
and const
variables.
A variable can be reassigned if necessary - +there’s no good reason to have a duplicate variable declaration.
+ + + + +Not configurable.
+ + +"no-duplicate-variable": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-empty.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-empty.html new file mode 100644 index 0000000..2de7aa4 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-empty.html @@ -0,0 +1,34 @@ +
Disallows empty blocks.
+ + +Blocks with a comment inside are not considered empty.
+ + + +Empty blocks are often indicators of missing code.
+ + + + +Not configurable.
+ + +"no-empty": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-eval.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-eval.html new file mode 100644 index 0000000..28e76d3 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-eval.html @@ -0,0 +1,34 @@ +
Disallows eval
function invocations.
eval()
is dangerous as it allows arbitrary code execution with full privileges. There are
+alternatives
+for most of the use cases for eval()
.
Not configurable.
+ + +"no-eval": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-inferrable-types.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-inferrable-types.html new file mode 100644 index 0000000..2456a7f --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-inferrable-types.html @@ -0,0 +1,39 @@ +
Disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean.
+ + + +Explicit types where they can be easily infered by the compiler make code more verbose.
+ + + + +One argument may be optionally provided:
+ +ignore-params
allows specifying an inferrable type annotation for function params.
+This can be useful when combining with the typedef
rule."no-inferrable-types": true+ +
"no-inferrable-types": [true, "ignore-params"]+ + +
{+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-internal-module.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-internal-module.html new file mode 100644 index 0000000..1ce01b3 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-internal-module.html @@ -0,0 +1,31 @@ +
"type": "list",
"listType": {
"type": "enum",
"enumValues": [
"ignore-params"
]
}
}
Disallows internal module
Using module
leads to a confusion of concepts with external modules. Use the newer namespace
keyword instead.
Not configurable.
+ + +"no-internal-module": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-invalid-this.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-invalid-this.html new file mode 100644 index 0000000..ebe6191 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-invalid-this.html @@ -0,0 +1,38 @@ +
Disallows using the this
keyword outside of classes.
See the rule’s author’s rationale here.
+ + + + +One argument may be optionally provided:
+ +check-function-in-method
disallows using the this
keyword in functions within class methods."no-invalid-this": true+ +
"no-invalid-this": [true, "check-function-in-method"]+ + +
{+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-namespace.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-namespace.html new file mode 100644 index 0000000..850069b --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-namespace.html @@ -0,0 +1,43 @@ +
"type": "list",
"listType": {
"type": "enum",
"enumValues": [
"check-function-in-method"
]
}
}
Disallows use of internal module
s and namespace
s.
This rule still allows the use of declare module ... {}
ES6-style external modules are the standard way to modularize code.
+Using module {}
and namespace {}
are outdated ways to organize TypeScript code.
One argument may be optionally provided:
+ +allow-declarations
allows declare namespace ... {}
to describe external APIs."no-namespace": true+ +
"no-namespace": [true, "allow-declarations"]+ + +
{+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-null-keyword.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-null-keyword.html new file mode 100644 index 0000000..2e87659 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-null-keyword.html @@ -0,0 +1,33 @@ +
"type": "list",
"listType": {
"type": "enum",
"enumValues": [
"allow-declarations"
]
}
}
Disallows use of the null
keyword literal.
Instead of having the dual concepts of null
andundefined
in a codebase,
+this rule ensures that only undefined
is used.
Not configurable.
+ + +"no-null-keyword": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-reference.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-reference.html new file mode 100644 index 0000000..0ab2baf --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-reference.html @@ -0,0 +1,33 @@ +
Disallows /// <reference path=>
imports (use ES6-style imports instead).
Using /// <reference path=>
comments to load other files is outdated.
+Use ES6-style imports to reference other files.
Not configurable.
+ + +"no-reference": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-require-imports.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-require-imports.html new file mode 100644 index 0000000..3c6d2a7 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-require-imports.html @@ -0,0 +1,31 @@ +
Disallows invocation of require()
.
Prefer the newer ES6-style imports over require()
.
Not configurable.
+ + +"no-require-imports": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-shadowed-variable.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-shadowed-variable.html new file mode 100644 index 0000000..f1fef2a --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-shadowed-variable.html @@ -0,0 +1,31 @@ +
Disallows shadowing variable declarations.
+ + + +Shadowing a variable masks access to it and obscures to what value an identifier actually refers.
+ + + + +Not configurable.
+ + +"no-shadowed-variable": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-string-literal.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-string-literal.html new file mode 100644 index 0000000..deea3c8 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-string-literal.html @@ -0,0 +1,31 @@ +
Disallows object access via string literals.
+ + + +Encourages using strongly-typed property access.
+ + + + +Not configurable.
+ + +"no-string-literal": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-switch-case-fall-through.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-switch-case-fall-through.html new file mode 100644 index 0000000..3056e29 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-switch-case-fall-through.html @@ -0,0 +1,42 @@ +
Disallows falling through case statements.
+ + + +For example, the following is not allowed:
+ +switch(foo) {
case 1:
someFunc(foo);
case 2:
someOtherFunc(foo);
}
+
+However, fall through is allowed when case statements are consecutive or
+a magic /* falls through */
comment is present. The following is valid:
switch(foo) {
case 1:
someFunc(foo);
/* falls through */
case 2:
case 3:
someOtherFunc(foo);
}
+
+
+
+ Fall though in switch statements is often unintentional and a bug.
+ + + + +Not configurable.
+ + +"no-switch-case-fall-through": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-trailing-whitespace.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-trailing-whitespace.html new file mode 100644 index 0000000..aee4742 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-trailing-whitespace.html @@ -0,0 +1,31 @@ +
Disallows trailing whitespace at the end of a line.
+ + + +Keeps version control diffs clean as it prevents accidental whitespace from being committed.
+ + + + +Not configurable.
+ + +"no-trailing-whitespace": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-unreachable.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-unreachable.html new file mode 100644 index 0000000..4d9b8b7 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-unreachable.html @@ -0,0 +1,31 @@ +
Disallows unreachable code after break
, catch
, throw
, and return
statements.
Unreachable code is often indication of a logic error.
+ + + + +Not configurable.
+ + +"no-unreachable": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-unused-expression.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-unused-expression.html new file mode 100644 index 0000000..d44a6f6 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-unused-expression.html @@ -0,0 +1,38 @@ +
Disallows unused expression statements.
+ + + +Unused expressions are expression statements which are not assignments or function calls +(and thus usually no-ops).
+ + + +Detects potential errors where an assignment or function call was intended. Also detects constructs such as
+new SomeClass()
, where a constructor is used solely for its side effects, which is considered poor style.
Not configurable.
+ + +"no-unused-expression": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-unused-variable.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-unused-variable.html new file mode 100644 index 0000000..b6cb98f --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-unused-variable.html @@ -0,0 +1,45 @@ +
Disallows unused imports, variables, functions and private class members.
+ + + + + +Three optional arguments may be optionally provided:
+ +"check-parameters"
disallows unused function and constructor parameters.
+ "react"
relaxes the rule for a namespace import named React
+(from either the module "react"
or "react/addons"
).
+Any JSX expression in the file will be treated as a usage of React
+(because it expands to React.createElement
).{"ignore-pattern": "pattern"}
where pattern is a case-sensitive regexp.
+Variable names that match the pattern will be ignored."no-unused-variable": [true, "react"]+ +
"no-unused-variable": [true, {"ignore-pattern": "^_"}]+ + +
{+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-use-before-declare.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-use-before-declare.html new file mode 100644 index 0000000..089f66c --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-use-before-declare.html @@ -0,0 +1,32 @@ +
"type": "array",
"arrayMembers": [
{
"type": "list",
"listType": {
"type": "enum",
"enumValues": [
"check-parameters",
"react"
]
}
},
{
"type": "object",
"properties": {
"ignore-pattern": {
"type": "string"
}
}
}
]
}
Disallows usage of variables before their declaration.
+ + + +This rule is primarily useful when using the var
keyword -
+the compiler will detect if a let
and const
variable is used before it is declared.
Not configurable.
+ + +"no-use-before-declare": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-var-keyword.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-var-keyword.html new file mode 100644 index 0000000..bbf9480 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-var-keyword.html @@ -0,0 +1,30 @@ +
Disallows usage of the var
keyword.
Use let
or const
instead.
Not configurable.
+ + +"no-var-keyword": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-var-requires.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-var-requires.html new file mode 100644 index 0000000..4b4670d --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/no-var-requires.html @@ -0,0 +1,32 @@ +
Disallows the use of require statements except in import statements.
+ + + +In other words, the use of forms such as var module = require("module")
are banned.
+Instead use ES6 style imports or import foo = require('foo')
imports.
Not configurable.
+ + +"no-var-requires": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/object-literal-sort-keys.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/object-literal-sort-keys.html new file mode 100644 index 0000000..097844c --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/object-literal-sort-keys.html @@ -0,0 +1,31 @@ +
Requires keys in object literals to be sorted alphabetically
+ + + +Useful in preventing merge conflicts
+ + + + +Not configurable.
+ + +"object-literal-sort-keys": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/one-line.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/one-line.html new file mode 100644 index 0000000..245aeaa --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/one-line.html @@ -0,0 +1,36 @@ +
Requires the specified tokens to be on the same line as the expression preceding them.
+ + + + + +Five arguments may be optionally provided:
+ +"check-catch"
checks that catch
is on the same line as the closing brace for try
."check-finally"
checks that finally
is on the same line as the closing brace for catch
."check-else"
checks that else
is on the same line as the closing brace for if
."check-open-brace"
checks that an open brace falls on the same line as its preceding expression."check-whitespace"
checks preceding whitespace for the specified tokens."one-line": [true, "check-catch", "check-finally", "check-else"]+ + +
{+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/one-variable-per-declaration.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/one-variable-per-declaration.html new file mode 100644 index 0000000..1a5a5e2 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/one-variable-per-declaration.html @@ -0,0 +1,34 @@ +
"type": "list",
"listType": {
"type": "enum",
"enumValues": [
"check-catch",
"check-finally",
"check-else",
"check-open-brace",
"check-whitespace"
]
}
}
Disallows multiple variable definitions in the same declaration statement.
+ + + + + +One argument may be optionally provided:
+ +ignore-for-loop
allows multiple variable definitions in a for loop declaration."one-variable-per-declaration": true+ +
"one-variable-per-declaration": [true, "ignore-for-loop"]+ + +
{+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/quotemark.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/quotemark.html new file mode 100644 index 0000000..090cfb6 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/quotemark.html @@ -0,0 +1,39 @@ +
"type": "list",
"listType": {
"type": "enum",
"enumValues": [
"ignore-for-loop"
]
}
}
Requires single or double quotes for string literals.
+ + + + + +Five arguments may be optionally provided:
+ +"single"
enforces single quotes."double"
enforces double quotes."jsx-single"
enforces single quotes for JSX attributes."jsx-double"
enforces double quotes for JSX attributes."avoid-escape"
allows you to use the “other” quotemark in cases where escaping would normally be required.
+For example, [true, "double", "avoid-escape"]
would not report a failure on the string literal 'Hello "World"'
."quotemark": [true, "single", "avoid-escape"]+ +
"quotemark": [true, "single", "jsx-double"]+ + +
{+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/radix.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/radix.html new file mode 100644 index 0000000..49a7a78 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/radix.html @@ -0,0 +1,34 @@ +
"type": "list",
"listType": {
"type": "enum",
"enumValues": [
"single",
"double",
"jsx-single",
"jsx-double",
"avoid-escape"
]
}
}
Requires the radix parameter to be specified when calling parseInt
.
From MDN: +> Always specify this parameter to eliminate reader confusion and to guarantee predictable behavior. +> Different implementations produce different results when a radix is not specified, usually defaulting the value to 10.
+ + + + +Not configurable.
+ + +"radix": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/semicolon.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/semicolon.html new file mode 100644 index 0000000..d9dbd5b --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/semicolon.html @@ -0,0 +1,35 @@ +
Enforces consistent semicolon usage at the end of every statement.
+ + + + + +One of the following arguments must be provided:
+ +"always"
enforces semicolons at the end of every statement."never"
disallows semicolons at the end of every statement except for when they are necessary."semicolon": [true, "always"]+ +
"semicolon": [true, "never"]+ + +
{+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/switch-default.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/switch-default.html new file mode 100644 index 0000000..e186954 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/switch-default.html @@ -0,0 +1,27 @@ +
"type": "enum",
"enumValues": [
"always",
"never"
]
}
Require a default
case in all switch
statements.
Not configurable.
+ + +"switch-default": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/trailing-comma.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/trailing-comma.html new file mode 100644 index 0000000..fbfec2c --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/trailing-comma.html @@ -0,0 +1,38 @@ +
Requires or disallows trailing commas in array and object literals, destructuring assignments and named imports.
+ + + + + +One argument which is an object with the keys multiline
and singleline
.
+Both should be set to either "always"
or "never"
.
"multiline"
checks multi-line object literals."singleline"
checks single-line object literals.A array is considered “multiline” if its closing bracket is on a line +after the last array element. The same general logic is followed for +object literals and named import statements.
+ + +"trailing-comma": [true, {"multiline": "always", "singleline": "never"}]+ + +
{+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/triple-equals.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/triple-equals.html new file mode 100644 index 0000000..970f923 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/triple-equals.html @@ -0,0 +1,37 @@ +
"type": "object",
"properties": {
"multiline": {
"type": "enum",
"enumValues": [
"always",
"never"
]
},
"singleline": {
"type": "enum",
"enumValues": [
"always",
"never"
]
}
}
}
Requires ===
and !==
in place of ==
and !=
.
Two arguments may be optionally provided:
+ +"allow-null-check"
allows ==
and !=
when comparing to null
."allow-undefined-check"
allows ==
and !=
when comparing to undefined
."triple-equals": true+ +
"triple-equals": [true, "allow-null-check"]+ +
"triple-equals": [true, "allow-undefined-check"]+ + +
{+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/typedef-whitespace.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/typedef-whitespace.html new file mode 100644 index 0000000..9f81c0a --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/typedef-whitespace.html @@ -0,0 +1,43 @@ +
"type": "list",
"listType": {
"type": "enum",
"enumValues": [
"allow-null-check",
"allow-undefined-check"
]
}
}
Requires or disallows whitespace for type definitions.
+ + +Determines if a space is required or not before the colon in a type specifier.
+ + + + + +Two arguments which are both objects.
+The first argument specifies how much space should be to the left of a typedef colon.
+The second argument specifies how much space should be to the right of a typedef colon.
+Each key should have a value of "space"
or "nospace"
.
+Possible keys are:
"call-signature"
checks return type of functions."index-signature"
checks index type specifier of indexers."parameter"
checks function parameters."property-declaration"
checks object property declarations."variable-declaration"
checks variable declaration."typedef-whitespace":+ + +
[
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
},
{
"call-signature": "onespace",
"index-signature": "onespace",
"parameter": "onespace",
"property-declaration": "onespace",
"variable-declaration": "onespace"
}
]
{+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/typedef.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/typedef.html new file mode 100644 index 0000000..5b81a22 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/typedef.html @@ -0,0 +1,37 @@ +
"type": "array",
"arrayMembers": [
{
"type": "object",
"properties": {
"call-signature": {
"type": "enum",
"enumValues": [
"nospace",
"onespace",
"space"
]
},
"index-signature": {
"type": "enum",
"enumValues": [
"nospace",
"onespace",
"space"
]
},
"parameter": {
"type": "enum",
"enumValues": [
"nospace",
"onespace",
"space"
]
},
"property-declaration": {
"type": "enum",
"enumValues": [
"nospace",
"onespace",
"space"
]
},
"variable-declaration": {
"type": "enum",
"enumValues": [
"nospace",
"onespace",
"space"
]
}
}
},
{
"type": "object",
"properties": {
"call-signature": {
"type": "enum",
"enumValues": [
"nospace",
"onespace",
"space"
]
},
"index-signature": {
"type": "enum",
"enumValues": [
"nospace",
"onespace",
"space"
]
},
"parameter": {
"type": "enum",
"enumValues": [
"nospace",
"onespace",
"space"
]
},
"property-declaration": {
"type": "enum",
"enumValues": [
"nospace",
"onespace",
"space"
]
},
"variable-declaration": {
"type": "enum",
"enumValues": [
"nospace",
"onespace",
"space"
]
}
}
}
]
}
Requires type definitions to exist.
+ + + + + +Six arguments may be optionally provided:
+ +"call-signature"
checks return type of functions."parameter"
checks type specifier of function parameters for non-arrow functions."arrow-parameter"
checks type specifier of function parameters for arrow functions."property-declaration"
checks return types of interface properties."variable-declaration"
checks variable declarations."member-variable-declaration"
checks member variable declarations."typedef": [true, "call-signature", "parameter", "member-variable-declaration"]+ + +
{+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/use-isnan.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/use-isnan.html new file mode 100644 index 0000000..2b8be45 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/use-isnan.html @@ -0,0 +1,33 @@ +
"type": "list",
"listType": {
"type": "enum",
"enumValues": [
"call-signature",
"parameter",
"arrow-parameter",
"property-declaration",
"variable-declaration",
"member-variable-declaration"
]
}
}
Enforces use of the isNaN()
function to check for NaN references instead of a comparison to the NaN
constant.
Since NaN !== NaN
, comparisons with regular operators will produce unexpected results.
+So, instead of if (myVar === NaN)
, do if (isNaN(myVar))
.
Not configurable.
+ + +"use-isnan": true+ + +
{}+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/use-strict.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/use-strict.html new file mode 100644 index 0000000..67e26e5 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/use-strict.html @@ -0,0 +1,33 @@ +
Requires using ECMAScript 5’s strict mode.
+ + + + + +Two arguments may be optionally provided:
+ +check-module
checks that all top-level modules are using strict mode.check-function
checks that all top-level functions are using strict mode."use-strict": [true, "check-module"]+ + +
{+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/variable-name.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/variable-name.html new file mode 100644 index 0000000..c5a843f --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/variable-name.html @@ -0,0 +1,40 @@ +
"type": "list",
"listType": {
"type": "enum",
"enumValues": [
"check-module",
"check-function"
]
}
}
Checks variable names for various errors.
+ + + + + +Five arguments may be optionally provided:
+ +"check-format"
: allows only camelCased or UPPER_CASED variable names
+ "allow-leading-underscore"
allows underscores at the beginning (only has an effect if “check-format” specified)"allow-trailing-underscore"
allows underscores at the end. (only has an effect if “check-format” specified)"allow-pascal-case
allows PascalCase in addtion to camelCase."ban-keywords"
: disallows the use of certain TypeScript keywords (any
, Number
, number
, String
,
+string
, Boolean
, boolean
, undefined
) as variable or parameter names."variable-name": [true, "ban-keywords", "check-format", "allow-leading-underscore"]+ + +
{+ \ No newline at end of file diff --git a/sonar-web-frontend-typescript/src/main/resources/rules/tslint/whitespace.html b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/whitespace.html new file mode 100644 index 0000000..a133bd0 --- /dev/null +++ b/sonar-web-frontend-typescript/src/main/resources/rules/tslint/whitespace.html @@ -0,0 +1,42 @@ +
"type": "list",
"listType": {
"type": "enum",
"enumValues": [
"check-format",
"allow-leading-underscore",
"allow-trailing-underscore",
"allow-pascal-case",
"ban-keywords"
]
}
}
Enforces whitespace style conventions.
+ + + +Helps maintain a readable, consistent style in your codebase.
+ + + + +Seven arguments may be optionally provided:
+ +"check-branch"
checks branching statements (if
/else
/for
/while
) are followed by whitespace."check-decl"
checks that variable declarations have whitespace around the equals token."check-operator"
checks for whitespace around operator tokens."check-module"
checks for whitespace in import & export statements."check-separator"
checks for whitespace after separator tokens (,
/;
)."check-type"
checks for whitespace before a variable type specification."check-typecast"
checks for whitespace between a typecast and its target."whitespace": [true, "check-branch", "check-operator", "check-typecast"]+ + +
{+ \ No newline at end of file
"type": "list",
"listType": {
"type": "enum",
"enumValues": [
"check-branch",
"check-decl",
"check-operator",
"check-module",
"check-seperator",
"check-type",
"check-typecast"
]
}
}