SharePoint Framework Coding Best Practice Rules

DescriptionSeverityArea of ImpactAdditional ReferenceImpactAction
'Overloaded functions should be defined consecutively'LOWSCALABILITY'https://palantir.github.io/tslint/rules/adjacent-overload-signatures/''Having overloaded functions at different locations in a class can be confusing.'Reorder the members in the class so that overloaded functions are defined consecutively.'
'Code should be vertically aligned'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/align/''Consistent alignment for code statements helps keep code readable and clear. Statements misaligned from the standard can be harder to read and understand.''Re-align the code'
'T[]or "Array" should be used to define arrays.'HIGHSCALABILITY'https://palantir.github.io/tslint/rules/array-type/''Not using these operators loses type safety''Use "T[]" or "Array" to define arrays.'
'Parenthesis should be used around the parameters of arrow function definitions.'HIGHMANAGEABILITY'https://palantir.github.io/tslint/rules/arrow-parens/''Maintains stylistic consistency with other arrow function definitions.''Add parenthesis around the parameters of arrow function definitions.'
'The shortened version of return should be used in arrow functions'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/arrow-return-shorthand/'It's unnecessary to include return and {} brackets in arrow lambdas. Leaving them out results in simpler and easier to read code.'Use () => x instead of () => { return x;}'
Should not use 'await' of a non-Promise value and 'for-await-of' of a non-AsyncIterable value.'HIGHSCALABILITY'https://palantir.github.io/tslint/rules/await-promise/''While it is valid JavaScript to await a non-Promise-like value (it will resolve immediately), this pattern is often a programmer error and the resulting semantics can be unintuitive.''Ensure that only Promise-like values are waited for'
'These specific functions or global methods should not be used.'HIGHSECURITY'https://palantir.github.io/tslint/rules/ban/''Certain functions or global methods can be disallowed by this rule as they are considered unsafe (such as eval)''Replace use of disallowed functions'
'The comma operator should not be used'HIGHMANAGEABILITY'https://palantir.github.io/tslint/rules/ban-comma-operator/''Using the comma operator can create a potential for many non-obvious bugs or lead to misunderstanding of code.''Avoid using the comma operator'
'"// @ts-ignore comments should not be used'HIGHMANAGEABILITY'https://palantir.github.io/tslint/rules/ban-ts-ignore/''Use of ts-ignore suppresses compilation warnings, and can hide issues in the code.''Remove all usages of ts-ignore comments. Address warnings appropriately.'
'General types representing boxed primitves should not be used'HIGHMANAGEABILITY'https://palantir.github.io/tslint/rules/ban-types/''Non-primitive boxed objects are almost never used appropriately in JavaScript code.''Use the primitive types instead.'
'Yoda" expressions should be avoided'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/binary-expression-operand-order/'Expressions like 1 + x are sometimes referred to as "Yoda" expressions because they read opposite to how we would normally speak the expression. Sticking to a consistent grammar for conditions helps keep code readable and understandable.''Place literals on the right-hand side of expressions if possible.'
'Interfaces or literal types with only a call signature should be expreesed as function types'LOWSCALABILITY'https://palantir.github.io/tslint/rules/callable-types/''An interface or literal type with just a call signature can be written as a function type.''Change the implementation to a function type'
'Class and Interface names should use PascalCase'MEDIUMMANAGEABILITY'https://palantir.github.io/tslint/rules/class-name/'JavaScript and general programming convention is to refer to classes in PascalCase. It's confusing to use camelCase or other conventions for class names.''Ensure that Classes and Interfaces are named with PascalCase'
'Single line comments should be consistently formatted'LOWSCALABILITY'https://palantir.github.io/tslint/rules/comment-format/''Helps maintain a consistent, readable style in your codebase.''Ensure that single line comments follow a consistent format'
'Only a limited set of comment types should be used'LOWSCALABILITY'https://palantir.github.io/tslint/rules/comment-type/''Helps maintain a consistent, readable style in your codebase.''Ensure that only a limited set of comment types are used'
'Important items should have JSDoc comments'MEDIUMMANAGEABILITY'https://palantir.github.io/tslint/rules/completed-docs/''Important components should be documented.''Ensure that important items include JSDoc comments'
'For loop statements should use braces'HIGHMANAGEABILITY'https://palantir.github.io/tslint/rules/curly/''Not including braces in loop statements may cause unexpected bugs''Include braces in all loop statements'
'Cyclomatic complexity should not be too high'HIGHMANAGEABILITY'https://palantir.github.io/tslint/rules/cyclomatic-complexity/''Cyclomatic complexity is a code metric which indicates the level of complexity in a function. High cyclomatic complexity indicates confusing code which may be prone to errors or difficult to modify.''Refactor to simple functions with self-descriptive names'
'Deprecated APIs should not be used.'HIGHSECURITY'https://palantir.github.io/tslint/rules/deprecation/''Using deprecated APIs is a security risk''Upgrade to using supported versions'
'UTF-8 file encoding should be used'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/encoding/''Using different encodings can cause issues with code merges, etc''Ensure that code is consistently UTF-8 encoded'
'Files should end with en-of-line'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/eofline/''It is a standard convention to end files with a newline.''Add a newline character to the end of each file'
'A consistent file header should be used'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/file-header/''Using a consistent file header can provide important information across your code base''Ensure that a consistent header is used'
'A consistent file naming convention should be used'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/file-name-casing/''Maintaining a consistent style across a file hierarchy makes the code easier to navigate''Ensure that a consistent file naming convention is used'
'for (... in ...) statements should be filtered with an if statement'HIGHSCALABILITY'https://palantir.github.io/tslint/rules/forin/'Using for (... in ...) statements without a filtering if statement can accidental iteration over properties inherited from an object's prototype.'Consider using a Map or Set if you are storing collections of objects. Using Objects can cause occasional edge case bugs, such as if a key is named hasOwnProperty'
'Function constructors should not be used'HIGHSECURITY'https://palantir.github.io/tslint/rules/function-constructor/'Calling the constructor directly is similar to eval, which is a symptom of design issues. String inputs don't receive type checking and can cause performance issues, particularly when dynamically created.'If you need to dynamically create functions, use factory functions that themselves return functions.'
'These specific modules should not be imported'HIGHSECURITY'https://palantir.github.io/tslint/rules/import-blacklist/''For some libraries, importing the library directly can cause unused submodules to be loaded, so you may want to block these imports and require that users directly import only the submodules they need. In other cases, you may simply want to ban an import because using it is undesirable or unsafe.''Validate why a forbidden module was attempted to be imported.'
'Import statement keywords should be properly spaced'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/import-spacing/''Proper spacing aids readability''Use at least one whitespace between import statement keywords'
'The explicit += and -= operators should be used'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/increment-decrement/'It's easy to type +i or i instead of  --i or ++i, and won't always result in invalid code.''Ensure that the operators += and -= are used instead of ++i, --i'
'Spaces should be used instead of tabs'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/indent/''Using only one of tabs or spaces for indentation leads to more consistent editor behavior, cleaner diffs in version control, and easier programmatic manipulation.''Replace tabs with four spaces'
'Interface names should begin with I'LOWSCALABILITY'https://palantir.github.io/tslint/rules/interface-name/''Makes it easy to differentiate interfaces from regular classes at a glance.''Ensure that all interface names begin with "I"'
'Interfaces should be used instead of type literals'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/interface-over-type-literal/''Interfaces are generally preferred over type literals because interfaces can be implemented, extended and merged.''Replace type literals with interfaces'
'JSDoc comments should be follow proper standards'MEDIUMMANAGEABILITY'https://palantir.github.io/tslint/rules/jsdoc-format/''Helps maintain a consistent, readable style for JSDoc comments.''Use standards for JSDoc comments'
'Labels should only be used for flow loop control'MEDIUMMANAGEABILITY'https://palantir.github.io/tslint/rules/label-position/''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.''Use labels only in the context of loop flow control.'
'A consistent line break character should be used'MEDIUMMANAGEABILITY'https://palantir.github.io/tslint/rules/linebreak-style/''All files should use the same linebreak character''Ensure that all files use the same line break character'
'A default import shuld have the same name as the declaration it imports'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/match-default-export-name/''This aids readability of the code''Ensure that a default import has the same name as the declaration it imports.'
'A file should only contain one class'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/max-classes-per-file/''Files should have a single responsibility so that that classes each exist in their own files''Refactor to ensure that each class is defined in its own file'
'Files should not exceed a set number of lines'HIGHSCALABILITY'https://palantir.github.io/tslint/rules/max-file-line-count/''Excessively long files indicate that a class is taking on too many responsibilities''Refactor to more modular classes'
'Lines should have a maximum length'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/max-line-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.''Ensure that lines do not exceed the maximum allowed size'
'Class members should have explicit visbility declarations'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/member-access/'Explicit visibility declarations can make code more readable . Also, because TypeScript's default visibility is public, members lacking a visibility declaration may be an indication of an accidental leak of class internals.''Explicitly include member visibility declarations, even if they are "public".'
'Class structure should be consistent'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/member-ordering/''A consistent ordering for class members can make classes easier to read, navigate, and edit.''Ensure that all your classes follow the same structure.'
'Parenthesis should be used when invoking a constructor via the new keyword.'MEDIUMMANAGEABILITY'https://palantir.github.io/tslint/rules/new-parens/''Maintains stylistic consistency with other function calls.''Use parentheses when invoking a constructor via the new keyword.'
'A return statement should be preceeded by a blank line'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/newline-before-return/''Helps maintain a readable style in your codebase.''Add carriage returns where necessary'
'Chained method calls should be broken apart onto separate lines'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/newline-per-chained-call/'This style helps to keep code 'òvertical', avoiding the need for side-scrolling in IDEs or text editors.''Chained method calls should be placed in separate lines.'
'"as Type" should be used for type assertions instead of "<Type>"'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/no-angle-bracket-type-assertion/''Both formats of type assertions have the same effect, but only as type assertions work in .tsx files.''Ensure that "as Type" is consistently used'
'"Any" should not be used as a type declaration'HIGHSCALABILITY'https://palantir.github.io/tslint/rules/no-any/''Using any as a type declaration nullifies the compile-time benefits of the type system.'If you are dealing with data of unknown or any types, you shouldn not be accessing members of it. Either add type annotations for properties that may exist or change the data type to the empty object type {}.Alternately, if you are creating storage or handling for consistent but unknown types, such as in data structures or serialization, use <T> template types for generic type handling.'
'"arguments.callee" should not be used'MEDIUMPERFORMANCE'https://palantir.github.io/tslint/rules/no-arg/''Using arguments.callee makes various performance optimizations impossible.''Do not use arguments.callee'
'Bitwise operators should not be used'HIGHMANAGEABILITY'https://palantir.github.io/tslint/rules/no-bitwise/''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.''Do not use bitwise operators'
'Comparing boolean values to boolean literals should be avoided'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/no-boolean-literal-compare/''Comparing boolean values to boolean literals is unnecessary, as those expressions will result in booleans too. Just use the boolean values directly or negate them.''Avoid comparing boolean values to boolean literals'
'Assignments in conditionals should not be used'HIGHMANAGEABILITY'https://palantir.github.io/tslint/rules/no-conditional-assignment/''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.''Do not use assignments in conditionals'
'More than one consecutive blank line shold be avoided.'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/no-consecutive-blank-lines/''Extra blank lines take up extra space and add little to a semantic understanding of the code. It can be harder to read through files when fewer components can fit into the screen. If you find a file is so large you feel a need to split them up with extra blank lines or comments, consider splitting your file into smaller files.''Remove unnecessary blank lines.'
'Console methods should not be used'HIGHSECURITY'https://palantir.github.io/tslint/rules/no-console/''Console methods are not appropriate for production code.''Do not use console methods.'
'String, Number, and Boolean constructors should not be used'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/no-construct/''There is little reason to use String, Number, or Boolean as constructors. In almost all cases, the regular function-call version is more appropriate.''Use the regular function-call version'
'Debugger statements should not be used'HIGHSECURITY'https://palantir.github.io/tslint/rules/no-debugger/'Debugger statements aren't appropriate for production code.''Remove debugger statements'
'Default exports should be avoided in ES6-style modules.'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/no-default-export/''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.''Use named exports instead.'
'Importing default members from ES6-style modules should be avoided'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/no-default-import/''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.''Replace default with named imports'
'Multiple import statements from the same module should not be used'LOWSCALABILITY'https://palantir.github.io/tslint/rules/no-duplicate-imports/''Using a single import statement per module will make the code clearer because you can see everything being imported from that module on one line.''Use a single import statement per module'
'Super should only be called once in constructors'HIGHSCALABILITY'https://palantir.github.io/tslint/rules/no-duplicate-super/'The second call to 'super()' will fail at runtime.'Remove any extra calls to super()'
'Switch statements should not contain duplicate cases'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/no-duplicate-switch-case/''Duplicate cases in switch statements are always a mistake''Remove the duplicate cases'
'Duplicate variables should not be defined in the same block scope'HIGHMANAGEABILITY'https://palantir.github.io/tslint/rules/no-duplicate-variable/''duplicate variable declarations in the same block scope will cause problems at runtime. This is only possible when using the var keyword - the compiler will detect redeclarations of let and const variables.''Remove duplicate variables'
'The delete operator should not be used with computed key expressions'HIGHMANAGEABILITY'https://palantir.github.io/tslint/rules/no-dynamic-delete/''Deleting dynamically computed keys is dangerous and not well optimized.'Consider using a Map or Set if you are storing collections of objects. Using Objects can cause occasional edge case bugs, such as if a key is named hasOwnProperty'
'Empty blocks should not be uses'LOWSCALABILITY'https://palantir.github.io/tslint/rules/no-empty/''Empty blocks are often indicators of missing code.''Remove, or complete, empty blocks'
'Empty interfaces (interfaces declaring no members) should not be used'HIGHSCALABILITY'https://palantir.github.io/tslint/rules/no-empty-interface/''An empty interface is equivalent to its supertype (or {}). Therefore it is unnecessary and can be confusing.''Remove the empty interface or add methods to it.'
'The eval() function should not be used'HIGHSECURITY'https://palantir.github.io/tslint/rules/no-eval/''eval() is dangerous as it allows arbitrary code execution with full privileges''Remove all uses of the eval function'
'Unhandled promises should not be used'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/no-floating-promises/''Unhandled Promises can cause unexpected behavior, such as resolving at unexpected times.''Return Promises from functions that start them, then handle them in calling code.'
'Arrays should not be iterated with a for - in loop'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/no-for-in-array/'A for-in loop (for (var k in o)) iterates over the properties of an Object. While it is legal to use for-in loops with array types, it is not common. for-in will iterate over the indices of the array as strings, omitting any holes in the array.''Use a for-of loop instead'
Modules which are not listed as dependency in the project's package.json should not be imported'HIGHSECURITY'https://palantir.github.io/tslint/rules/no-implicit-dependencies/''Uncontrolled module imports can be a security risk''Ensure that only controlled modules are imported'
'Imports with explicit side-effects should not be used'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/no-import-side-effect/''Imports with side effects may have behavior which is hard for static verification.''Avoid import statements with side-effect.'
'Trivially inferred types should not be used'LOWSCALABILITY'https://palantir.github.io/tslint/rules/no-inferrable-types/''Explicitly declaring the type of a variable which is initialized adds unneed verbosity.''Remove the type declaration.'
'Type inference of {} (empty object type) at function and constructor call sites should not be used'MEDIUMMANAGEABILITY'https://palantir.github.io/tslint/rules/no-inferred-empty-object-type/''Prior to TypeScript 3.4, generic type parameters for functions and constructors are inferred as {} (the empty object type) by default when no type parameter is explicitly supplied or when the compiler cannot infer a more specific type. This is often undesirable as the call is meant to be of a more specific type.''Use specific type parameters'
The internal 'module' syntax should not be used'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/no-internal-module/''Using module leads to a confusion of concepts with external modules.''Use the newer namespace keyword instead.'
'The sequence "${" should not be used in non-template strings'LOWSCALABILITY'https://palantir.github.io/tslint/rules/no-invalid-template-strings/''Interpolation will only work for template strings.''Use "${" only in template strings'
'The "this" keyword should not be used outside classes'MEDIUMMANAGEABILITY'https://palantir.github.io/tslint/rules/no-invalid-this/''this outside of a class in code that is using ES6-class syntax is almost always a mistake.''Remove usages of this outside classes'
'Irregular whitespace should be avoided'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/no-irregular-whitespace/''Irregular whitespace hurts readability''Use of whitespace sholud be consistent'
'Magic numbers should not be used'HIGHMANAGEABILITY'https://palantir.github.io/tslint/rules/no-magic-numbers/''Magic numbers should be avoided as they often lack documentation.''Use a named constant to provide implicint documentation via the variable name.'
'Mergeable namespaces should not be used in the same file.'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/no-mergeable-namespace/''Splitting the declaration of namespace members in a single file can cause confusion''Group all namespace members in a single declaration'
'The "new" keyword should not be used to define constructors for interfaces'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/no-misused-new/'Interfaces in TypeScript aren't meant to describe constructors on their implementations. The new descriptor is primarily for describing JavaScript libraries.'If you are trying to describe a function known to be a class, it is typically better to declare class.'
'Module and Namespace should not be used'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/no-namespace/''ES6-style external modules are the standard way to modularize code. Using module {} and namespace {} are outdated ways to organize TypeScript code.''Use the ES6 style for declaring external modules.'
'The non null assertion should not be used.'HIGHSCALABILITY'https://palantir.github.io/tslint/rules/no-non-null-assertion/''Using non-null assertion cancels the benefits of the strict null checking mode.''Ensure that the type system is aware that an instance is required to not be null.'
'The "null" keyword literal should not be used'MEDIUMMANAGEABILITY'https://palantir.github.io/tslint/rules/no-null-keyword/'JavaScript originally intended undefined to refer to a value that doesn't yet exist, while null was meant to refer to a value that does exist but points to nothing. That's confusing.'Use "undefined". "undefined" is the default value when object members don't exist, and is the return value for newer native collection APIs such as Map.get when collection values don't exist.'
'Object literals should not appear in type assertion expressions'HIGHMANAGEABILITY'https://palantir.github.io/tslint/rules/no-object-literal-type-assertion/'Always prefer const x: T = { ... }; to const x = { ... } as T; . The type assertion in the latter case is either unnecessary or hides an error.''Use const x: T = { ... }'
'Parameter properties should not be used in class constructors'HIGHMANAGEABILITY'https://palantir.github.io/tslint/rules/no-parameter-properties/''Parameter properties can be confusing to those new to TS as they are less explicit than other ways of declaring and initialising class members.''Keep member variable declarations in one list directly above the class constructor (instead of mixed between direct class members and constructor parameter properties).'
'Function parameters should not be reassinged inside the function'HIGHMANAGEABILITY'https://palantir.github.io/tslint/rules/no-parameter-reassignment/''Changing the value of incoming parameters to a function is confusing and can cause hard to debug issues.''Avoid reassigning parameters.'
'JSDoc which duplicates TypeScript functionality should not be used'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/no-redundant-jsdoc/''It is redundant to add JSDoc which describes the intent of functionality provided by TypeScript''Remove the redundant JSDoc'
'<reference> should not be used to load other files'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/no-reference/''Using /// <reference path=> comments to load other files is outdated.''Use ES6-style imports to reference other files.'
'References to imported types should not be used'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/no-reference-import/''It is redundant to use <reference types="foo" /> if you already "import foo"''Remove the redundant reference'
'The `require()` function should be avoided.'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/no-require-imports/''Prefer the newer ES6-style imports over require().''Refactor to use imports'
'"Event", "name" and "length" should not be used as global variables'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/no-restricted-globals/''Disallowing usage of specific global variables can be useful if you want to allow a set of global variables by enabling an environment, but still want to disallow some of those.''Use different global variable names'
'Unnecessary "return await" calls should not be used'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/no-return-await/''An async function always wraps the return value in a Promise. Using return awaitjust adds extra time before the overreaching promise is resolved without changing the semantics.''Remove these unnecessary calls'
'Shadowin variable declarations should not be used'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/no-shadowed-variable/''When a variable in a local scope and a variable in the containing scope have the same name, shadowing occurs. Shadowing makes it impossible to access the variable in the containing scope and obscures to what value an identifier actually refers.''Rename the shadowing variables'
'Arrays should not be defined with empty elements'LOWSCALABILITY'https://palantir.github.io/tslint/rules/no-sparse-arrays/''Missing elements are probably an accidentally duplicated comma.''Ensure duplicated commas in array definitions are removed'
'Unnecessary string literal property access should not be used'LOWSCALABILITY'https://palantir.github.io/tslint/rules/no-string-literal/'If --noImplicitAny is turned off, property access via a string literal will be "any" if the property does not exist.'Use obj.property instead of obj["property"] .'
'Throwing plain strings should be avoided'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/no-string-throw/''Only Error objects contain a .stack member equivalent to the current stack trace. Primitives such as strings do not.''Throw an Error with the String message.'
'Submodule imports should not be used'HIGHSCALABILITY'https://palantir.github.io/tslint/rules/no-submodule-imports/'Submodules of some packages are treated as private APIs and the import paths may change without deprecation periods. It's best to stick with top-level package exports.''Remove submodule imports'
'Falling through case statements should be avoided'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/no-switch-case-fall-through/''Fall though in switch statements is often unintentional and a bug.''Remove falling through case statements'
'Unnecessary references to "this" should be avoided'HIGHSCALABILITY'https://palantir.github.io/tslint/rules/no-this-assignment/''Assigning a variable to this instead of properly using arrow lambdas may be a symptom of pre-ES6 practices or not managing scope well.''Instead of storing a reference to this and using it inside a function, Use () => arrow lambdas, as they preserve this scope'
'Whitespace should be removed from the end of lines'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/no-trailing-whitespace/''Keeps version control diffs clean as it prevents accidental whitespace from being committed.''Remove trailing whitespace at the end of lines'
'Methods should not be used outside method calls'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/no-unbound-method/'Class functions don't preserve the class scope when passed as standalone variables.''Either use an arrow lambda (() => {...}) or call the function with the correct scope.'
'Using a callback wrapper on a directly called function should be avoided'LOWPERFORMANCE'https://palantir.github.io/tslint/rules/no-unnecessary-callback-wrapper/'There's generally no reason to wrap a function with a callback wrapper if it's directly called anyway. Doing so creates extra inline lambdas that slow the runtime down.''Replace x => f(x) with just f'
'Unnecessary classes should not be defined'MEDIUMMANAGEABILITY'https://palantir.github.io/tslint/rules/no-unnecessary-class/''Users who come from a Java-style OO language may wrap their utility functions in an extra class, instead of putting them at the top level.''Remove unnecessary classes'
'Var / let statements should not be explicitly initializaed to "undefined"'LOWSCALABILITY'https://palantir.github.io/tslint/rules/no-unnecessary-initializer/'Values in JavaScript default to undefined. There's no need to do so manually.''Remove the unneeded initialization'
'Unnecessary namespace qualifiers should be avoided'LOWSCALABILITY'https://palantir.github.io/tslint/rules/no-unnecessary-qualifier/''Unnecessary namespace qualifiers are redundant''Remove the unnecessary namespace qualifiers'
'Unnecessary type assertion should not be used'LOWSCALABILITY'https://palantir.github.io/tslint/rules/no-unnecessary-type-assertion/''Type assertions which do not change the type of the expression are unnecessary''Do not use type assertions when the do not modify the inferred type'
Expressions of type 'òany' should not be used in a dynamic way'HIGHSCALABILITY'https://palantir.github.io/tslint/rules/no-unsafe-any/'If you're dealing with data of unknown or 'úany'ù types, you shouldn't be accessing members of it''Either add type annotations for properties that may exist or change the data type to the empty object type {}'
'Control flow statements should not be used in finally blocks'LOWSCALABILITY'https://palantir.github.io/tslint/rules/no-unsafe-finally/''When used inside finally blocks, control flow statements, such as return, continue, break and throws override any other control flow statements in the same try/catch scope. This is confusing and unexpected behavior.''Remove control flow statements from finally blocks'
'Unused expression statements should not be used'LOWSCALABILITY'https://palantir.github.io/tslint/rules/no-unused-expression/''Unused expressions are expression statements which are not assignments or function calls (and thus usually no-ops).''Removed any unused expressions'
'Unused variables should be avoided'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/no-unused-variable/''Variables that are declared and not used anywhere in code are likely an error due to incomplete refactoring. Such variables take up space in the code, are mild performance pains, and can lead to confusion by readers.''Remove any unused variables'
'Variables should not be used before their declaration'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/no-use-before-declare/''This rule is primarily useful when using the var keyword since the compiler will automatically detect if a block-scoped let and const variable is used before declaration.''Do not use variables before declaring them. In fact, do not use "var" at all.'
'The "var" keyword should not be used'MEDIUMMANAGEABILITY'https://palantir.github.io/tslint/rules/no-var-keyword/'Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration 'hoisting' (similar to functions) and can appear to be used before declaration.''Use "const" and "let" to define variables instead'
'The var keyword should not be used to specify imports'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/no-var-requires/''AMD-style require([]) and CommonJS-style require("") statements are environment-specific and more difficult to statically analyse.''Use ES2015-style imports instead. They are part of the JavaScript language specification and recommended as the path going forward. TypeScript will compile them to environment-specific forms as needed.'
'Expressions of type void should appear in statement position.'MEDIUMMANAGEABILITY'https://palantir.github.io/tslint/rules/no-void-expression/'It's misleading returning the results of an expression whose type is void. Attempting to do so is likely a symptom of expecting a different return type from a function.''Do not return expressions of type void'
'Decimal literals shold be consistently formatted'MEDIUMMANAGEABILITY'https://palantir.github.io/tslint/rules/number-literal-format/''Helps keep a consistent style with numeric literals. Non-standard literals are more difficult to scan through and can be a symptom of typos.''Ensure that all decimal literals have digits to the left of the decimal separator, and do not end in 0'
'A consistent convention for quoting object literal properties should be used'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/object-literal-key-quotes/''Object literal property names can be defined in two ways: using literals or using strings. It is a good idea to enforce a consistent style in your code.''Use a standard convention to name object literal property names.'
'ES6 object literal shorthand should be used'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/object-literal-shorthand/''Shorthand object literal syntax is more compact and should be preferred''Use ES6 object literal shorthand.'
'Object literal keys should be sorted'LOWSCALABILITY'https://palantir.github.io/tslint/rules/object-literal-sort-keys/''Useful in preventing merge conflicts''Reorder object literal keys alphabetically'
'Certain tokens should appear on the same line'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/one-line/''For clarity, certain tokens should be on the same line as the expression preceding them.''Format the code to comply with this rule'
'Only one variable should be declared on a single line'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/one-variable-per-declaration/''For clarity, it is better to declare one variable per line.''Declare one variable per line.'
'Non-arrow functions should not be used.'HIGHSCALABILITY'https://palantir.github.io/tslint/rules/only-arrow-functions/'Traditional functions don't bind lexical scope, which can lead to unexpected behavior when accessing 'òthis'.''Use arrow functions instead.'
'Import statements should be organized'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/ordered-imports/''For clarity, import statements be alphabetized and grouped.''Organize your imports'
'Conditional expressions should be used to avoid multiple equivalent variable assignments'LOWSCALABILITY'https://palantir.github.io/tslint/rules/prefer-conditional-expression/''This reduces duplication and can eliminate an unnecessary variable declaration.''Use a conditional expression instead of assigning to the same thing in each branch of an if statement.'
'The "const" keyword should be used for constants'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/prefer-const/'If a variable is only assigned to once when it is declared, it should be declared using 'òconst'''Refactor to use const'
'for-of' loops should be used in preference to for loops with index'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/prefer-for-of/'A for-of loop is easier to implement and read when the index is not needed.''Use the for(... of ...) loop syntax'
'Functions should be preferred over class methods'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/prefer-function-over-method/''Class methods that do not use "this" should be refactored to functions''Refactor methods into functions'
'The method signature syntax should be used to declare the type of a function'MEDIUMMANAGEABILITY'https://palantir.github.io/tslint/rules/prefer-method-signature/''"foo(): void" should be used instead of "foo: () => void" in interfaces and types.''Refactor method signatures'
'"Object.assign()" should not be used'LOWSCALABILITY'https://palantir.github.io/tslint/rules/prefer-object-spread/''Object spread allows for better type checking and inference.''Ese the ES2018 object spread operator instead of Object.assign()'
'Private variables should be marked as `readonly` if they\'re never modified outside of the constructor.'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/prefer-readonly/'Marking never-modified variables as readonly helps enforce the code's intent of keeping them as never-modified. It can also help prevent accidental changes of members not meant to be changed.'Mark private variables as readonly if they're never modified outside of the constructor.'
'Switch statements should be used instead of three or more if - === comparsions'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/prefer-switch/''Switch statements are easier to understand than nested if statements''Refactor to use a swtich statement'
'Template expressions should be used instead of string concatenation'LOWPERFORMANCE'https://palantir.github.io/tslint/rules/prefer-template/''Concatenating more than two strings should be done using template expressions''Refactor string concatenations to use template expressions'
'Loops without initializer or incrementor should use "while" instead of "for"'MEDIUMMANAGEABILITY'https://palantir.github.io/tslint/rules/prefer-while/''Simplifies the readability of the loop statement, while maintaining the same functionality.''Refactor loops to use while instead of for'
'Functions that return promises should be async'HIGHSCALABILITY'https://palantir.github.io/tslint/rules/promise-function-async/''Non-async Promise-returning functions are technically capable of returning a rejected Promise or throwing an error. This means that consuming code has to handle both cases.''Ensure that Promise-returning functions are always async'
'String literals shold be quoted'MEDIUMMANAGEABILITY'https://palantir.github.io/tslint/rules/quotemark/''String literals should be quoted''Ensure that all string literals are quoted'
'"parseInt" should not be called without a radix parameter'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/radix/''Different implementations produce different results when a radix is not specified, usually defaulting the value to 10.''Specify the radix parameter when calling parseInt.'
'The "+" operator should only be used when both sides are numbers or strings'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/restrict-plus-operands/''When adding two variables, operands must both be of type number or of type string.''Ensure that both sides of the operation are of the same type, number or string'
'Undefined should be returned instead of null in value-returning functions'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/return-undefined/'Prefer return;  in void functions and return undefined;  in value-returning functions.''Refactor to return undefined'
'End of statement semicolons should be used consistently'MEDIUMMANAGEABILITY'https://palantir.github.io/tslint/rules/semicolon/''A consistent use of semicolons aids code readability''Ensure that ever statement is terminated with a semicolon'
'A whitespace should be included before function parenthesis'LOWSCALABILITY'https://palantir.github.io/tslint/rules/space-before-function-paren/''A space before function parenthesis aids readability''Insert a space between the function name and the parenthesis'
'A whitespace should be included after a parenthesis'LOWSCALABILITY'https://palantir.github.io/tslint/rules/space-within-parens/''A space after a parenthesis aids readability''Add spaces as needed'
'Only booleans should be used in boolean expressions'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/strict-boolean-expressions/''Using non-boolean types inside boolean expressions can have unintened effects''Ensure that only boolean types are used in boolean expressions'
'Predicates which are always true or false should not be used'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/strict-type-predicates/''An expression which always evaluates to true or false is useless in a predicate''Ensure that expressions in predicates are not always true or false'
'Switch statements should have a default'LOWSCALABILITY'https://palantir.github.io/tslint/rules/switch-default/''Omitting the default case can cause unexpected behaviour at runtime''Ensure that all switch statements have a default case'
'The final clause of a switch statement should end in "break"'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/switch-final-break/'The final clause of a switch statement should end in break;''Add the break statement'
'Trailing commas should be used whenever possible'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/trailing-comma/''Trailing commas (sometimes called "final commas") can be useful when adding new elements, parameters, or properties to JavaScript code. If you want to add a new property, you can simply add a new line without modifying the previously last line if that line already uses a trailing comma. This makes version-control diffs cleaner and editing code might be less troublesome.''Use trailing commas in array and object literals, destructuring assignments, function typings, named imports and exports and function parameters.'
'The triple equality operator should be used'LOWSCALABILITY'https://palantir.github.io/tslint/rules/triple-equals/''The behaviour of the double equals operator can be unexpected in some cases''Use "===" and "!==" instead of "==" and "!="'
'Type member literals should be separated by semicolon'LOWSCALABILITY'https://palantir.github.io/tslint/rules/type-literal-delimiter/''The semicolon separator aids readability''Use the semicolon separator'
'Types should be explicitly defined'HIGHSCALABILITY'https://palantir.github.io/tslint/rules/typedef/''Not including explicit types in the code can cause hard to debug issues''Ensure that types are explicitly defined'
'Whitespace should be used for type definition'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/typedef-whitespace/''Adding a whitespace before the colon in a type specifier aids readability.''Ensure that a single whitespace precedes the colon in a type specifier.'
'The "typeof" operator should always compare String types'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/typeof-compare/''Using undefined types for typeof comparsions may fail at runtime''Ensure that both sides of the typeof comparison are String'
'Imports should be unified whenever possible'LOWSCALABILITY'https://palantir.github.io/tslint/rules/unified-signatures/''Individual imports add unnecessary verbosity''Unify imports by using a union or an optional/rest parameter.'
'Unnecessary scope binings on functions should be avoided'HIGHSCALABILITY'https://palantir.github.io/tslint/rules/unnecessary-bind/'function expressions that are immediately bound to this are equivalent to () =>arrow lambdas. Additionally, there's no use in binding a scope to an arrow lambda, as it already has one.''Remove the unnecessary scope bindings'
'Blank constructors should not be used'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/unnecessary-constructor/'JavaScript implicitly adds a blank constructor when there isn't one. It's not necessary to manually add one in.''Remove any blank constructors'
'Explicit type declarations on arguments should be avoided if there is a default type'LOWSCALABILITY'https://palantir.github.io/tslint/rules/use-default-type-parameter/''Explicitly specifying the type argument if it is the the default for that type parameter is redundant.''Remove the explicit type declaration for these parameters'
'The isNaN() function should be used to check for NaN references.'HIGHSCALABILITY'https://palantir.github.io/tslint/rules/use-isnan/''Since NaN !== NaN, comparisons with regular operators will produce unexpected results.''Instead of if (myVar === NaN), do if (isNaN(myVar))'
'Variable naming conventions should be followed'MEDIUMSCALABILITY'https://palantir.github.io/tslint/rules/variable-name/''lowerCamelCase should be used for variables, and UPPER_CASE for constants. Typescript keywords should not be used as variable names.''Rename any variables which do not comply with the naming conventions.'
'Whitespace should be used consistently'LOWMANAGEABILITY'https://palantir.github.io/tslint/rules/whitespace/''A consistent use of whitespace aids readablitiy.''Ensure that whitespace is used consistently.'