prefer-while
(#3750)comment-format
(#3845)"allow-empty-functions"
for no-empty
rule (#3624)promise-function-async
specifying what kinds of functions to check (#3807)file-header
rule plays nice with no-trailing-whitespace
rule (#3802)no-unbound-method
rule allows square bracket property access (#3610)no-unsafe-any
no longer marks native JSX elements as unsafe (#3699)file-header
auto-fixes use '!' character to ensure header stays above imports (#3741)no-unused-variable
rule (#3831)Thanks to our contributors!
tslint:recommended
or tslint:latest
by disabling typeof-compare
in these rulesets. (#3639)rulesDirectory
paths, which fixes usage with tslint-loader. (#3640)src/language/utils.ts
have been deprecated (#3476)Significant changes have been made to configuration inheritance to address a long-standing UX issue around defaultSeverity
: #2569.
defaultSeverity
defined in a tslint.json
file will now override the defaultSeverity
value defined in any configurations you are extending.
This means that any rules specified in the base configurations can now take on a new defaultSeverity
if you so choose. If you extend multiple
configuration files, the defaultSeverity
defined in the last one wins.
In practice, this allows users to, for example, more easily use the built-in TSLint configurations (tslint:recommended
, tslint:latest
, tslint:all
)
and treat all errors as warnings instead of errors.
For more details, see the relevant PRs:
defaultSeverity
defined in extended configs (#3449)file-header
(#3475)no-dynamic-delete
(#3573)prefer-readonly
(#2896)newline-per-chained-call
(#3278)"temporalDeadZone"
for no-shadowed-variable
to ignore shadowing in the temporal dead zone of classes, parameters, enums and variables declared with let
or const
(#3389)"shorthand-first"
for object-literal-sort-keys
(#3607)max-line-length
(#3099)--project
excludes all files of external dependencies (#3320)tsconfig.json
is invalid (#3410)no-implicit-dependencies
don't crash on malformed package.json (#3373)strict-type-predicates
allows comparing typeof result with non-literals (#3542)no-redundant-jsdoc
fixed crash on unhandled tag (#3414)object-literal-sort-keys
fixed regression that effectively disabled the rule with \r\n
line breaks (#3427)curly
fixer now correctly handles comments (#3473)no-unsafe-any
fixed false-positive with namespaced types (#3487)no-any
(#3486)no-unnecessary-type-assertion
fixed false negatives for types with numeric keys (#3468)callable-types
adds parentheses when fixing a type literal inside an array type (#3440)no-unsafe-any
allows spreading an any
value into an object (#3439)arrow-parens
fixer (#3618)prefer-const
false negative with index signature named like a variable (#3385)whitespace
rule checks property declarations if "check-decl"
is enabled (#3546)no-duplicate-super
rule. (#3544)no-shadowed-variable
now excludes declaration files and ambient modules (#3387)no-duplicate-imports
Allow duplicate imports from separate ambient module declarations (#3398)await-promise
correctly recognises classes extending Promise (#3383)prefer-conditional-expression
: don't repeat error on nested if statements (#3528)completed-docs
: don't require documentation on methods in object literals (#3532)one-line
fixed crash on syntax error in class or interface (#3538)no-redundant-jsdoc
allow @template
tag if it has a description (#3415)typeof-compare
(#3429)"properties"
option for completed-docs
rule now checks getter and setter accessors. (#3497)no-magic-numbers
ignores parseInt radix parameter (#3536)--project
option (#3313)stylish
-formatter's output jumps to the first failure in that file. (#3491)ban-comma-operator
ignores comma operator inside for-loop incrementor (#3485)space-within-parens
updated to always allow empty parentheses ()
. (#3513)completed-docs
modifier lists (#3379)ban-comma-operator
(#3384)completed-docs
rule to use a function instead of a walker (#3466)ban-comma-operator
: fix metadata, list as "functionality" rule (#3612)no-use-before-declare
documentation to clarify the rule's status (#3520)await-promise
options documentation (#3519)hasFix
metadata for the indent
rule (#3529)no-irregular-whitespace
(#3627)Thanks to our contributors!
typeof-compare
is deprecated because typescript already does that check (#3286)--type-check
is no longer necessary and will be removed in the next major version (#3322)tslint:latest
configuration+ "ban-comma-operator": true,
+ "jsdoc-format": {
+ options: "check-multiline-start",
+ },
+ "no-duplicate-switch-case": true,
+ "no-implicit-dependencies": true,
+ "no-return-await": true,
linterOptions
configuration field to tslint.json
, which supports a list of exclude
globs to disable linting for a subset of files (#2409)no-return-await
(#3233)no-redundant-jsdoc
(#2754)no-duplicate-switch-case
(#2937)no-implicit-dependencies
(#3343)no-unnecessary-class
(#3119)ban-comma-operator
(#3250)one-line
(#3200)curly
(#3262)jsdoc-format
adds option "check-multiline-start"
to enforce the first line of a multiline JSDoc comment to be empty. (#3181)trailing-comma
adds option "esSpecCompliant"
to make it compatible with the ES spec regarding trailing commas after object/array rest and rest parameters. (#3176)"check-parameter-property"
option for member-access
rule (#3325)"strict-bound-class-methods"
option for semicolon
rule (#3294)"grouped-imports"
option for ordered-imports
rule (#3138)"ignore-blank-lines"
option for no-trailing-whitespace
rule (#3346)"never"
option for object-literal-shorthand
disallows shorthand notation (#3268)"exclude-class-expressions"
option for max-classes-per-file
rule (#3281)no-unnecessary-type-assertion
supports a whitelist of types to ignore (#3257)"module-source-path"
for ordered-imports
allows sorting imports by trailing end of path (#3178)no-empty-interface
allows providing type arguments for extended type (#3260)return-undefined
handles union return types in async functions (#3298)deprecation
checks correct constructor overload (#3203)return-undefined
declared return type takes precedence over contextual type (#3298)inputFilePath
as an optional parameter in Configuration.findConfiguration()
(#3195)return-undefined
fixed regressions: once again allows anything if return type is any
(#3298)only-arrow-functions
allow function if this
is used in parameter initializer (#3315)no-conditional-assignment
: exclude intentional assignments, e.g. inside functions (#2629)no-angle-bracket-type-assertion
fixer adds parentheses when necessary (#3301)no-angle-bracket-type-assertion
fixed order when autofixing consecutive assertions (#3301)vso
formatter no longer duplicates output for fixed failures (#3348)no-unbound-method
: Allow negation of method (#3349)arrow-parens
with option "ban-single-arg-parens"
no longer produces invalid code when fixed (#3247)tslint.json
stopped at the current directory. (#3309)--test
works correctly with any compilerOptions.target
(#3296)whitepace
handles files with BOM and other irregular whitespace (#3305)callable-types
auto fix produces invalid results (#3342)no-string-literal
correctly fix property names with leading underscores (#3184)variable-name
fixed crash on empty variable name (#3292)trailing-comma
fixed crash on arrow function without parens (#3246)space-before-function-paren
for anonymous/arrow generic functions (#3085)no-unused-variable
along with the noUnusedLocals
and noUnusedParameters
compiler options (#3227)no-invalid-this
ignores functions with a this
param (#3267)import-blacklist
also checks exports and dynamic imports (#3258)no-conditional-assignment
added check for conditional (ternary) expressions (#2629)completed-docs
to list doc tags that mark a node as not requiring a documentation body. Tags can also provide a regexp matcher to validate that their contents are docs-valid. (#2415)await-promise
enforces that for-await-of
is only used with AsyncIterable
(#3297)one-line
checks type alias declarations (#3200)deprecation
checks object destructuring (#3318)no-submodule-imports
also checks exports (#3258)restrict-plus-operands
: More specific error message when arguments include strings (#3220)no-unsafe-any
checks more expressions, for example destructuring, yield
, property initializer (#3196)object-literal-sort-keys
: allow grouping of object properties via additional blank lines when using alphabetical ordering. (#3191)colors
module to chalk
module (#3171)no-unused-variable
applies the ignorePattern to imports (#3187)Thanks to our contributors!
no-parameter-reassignment
(#3045)object-literal-sort-keys
: Add match-declaration-order
option (#2829)check-type-operator
for whitespace
rule (#3083)whitespace
: Add check-rest-spread
option (#3089)AbstractRule#applyWithFunction
allows additional parameter that is passed through to walkFn
(#3140)AbstractRule#applyWithFunction
has better type checking for its type parameter (#2660)member-access
autofix now correcly inserts public
keyword after decorators (#3162)prefer-const
correctly handle catch
without binding parameter introduced in typescript@2.5.1
(#3151)no-invalid-template-strings
allows backslash-prefixed template expressions (#3116)deprecation
no longer shows errors on imports and exports (#3141)deprecation
: fix false positive when calling a function or method where another overload is deprecated (#2883)whitespace
: fixed "check-separator"
for trivial for
cases. (#3132)prefer-object-spread
prevent spreading this
as it is not allowed by the compiler (#3126)msbuild
formatter uses backslashes in paths on Windows (#3145)no-namespace
ignores global augmentation (#3161)no-submodule-imports
allows whitelisting of submodules like @angular/core/testing
(#3129)ts-node
(#3108)quotemark
no longer requires "single"
or "double"
to be the first option. The rule defaults to "double"
if none is specified. (#3114)no-unused-variable
autofix removes trailing comments of imports (#3156)no-unnecessary-type-assertion
allows certain necessary assertions to prevent type widening (#3120)Thanks to our contributors!
no-duplicate-imports
(#3075)no-submodule-imports
(#3091)space-within-parens
(#2959)member-access
(#2969)no-null-keyword
: fix x == null
to x == undefined
(#2802)no-shadowed-variable
let's you optionally ignore certain kinds of declarations (#3030)prefer-conditional-expression
adds check-else-if
(#2963)array-type
: consider this
to be simple type (#2982)await-promise
accepts not only union types but also intersection types with Promise-like types (#2987)callable-types
: don't remove export modifier of interfaces (#2962)completed-docs
: Only checks variables at the file-level. (#2950)completed-docs
: Uses correct visibility of variables. (#2950)no-floating-promises
: recognize rejection handler passed as second argument to promise.then()
(#3048)no-shadowed-variable
don't warn for shadowed type parameter on static class members (#3030)no-shadowed-variable
fixed false positive with key name in index signature (#3030)no-shadowed-variable
fixed false positive with parameter inside function decorator (#3030)no-unsafe-any
: allow truthyness and falsyness checks (#3008)no-unused-variable
fixed crash when using destructuring (#3058)one-line
correctly handles multiline type parameters (#3004)prefer-for-of
fixed false positives when array is modified, e.g. arr[i]++
(#3044)prefer-object-spread
adds parens when fixing arrow function return (#3026)prefer-object-spread
permit functions as first argument to Object.assign (#3098)space-before-function-paren
Handle default exports of functions without names like anonymous functions (fixes #3040) (#3053)./test/parse
could not be located due after consumers had run yarn clean
(#3072)no-null-keyword
allows strict comparison (#2802)no-switch-case-fall-through
matches // falls through
comments case insensitive and allows trailing text (#2983)ordered-imports
: support importEqualsDeclaration (#3102)no-inferrable-types
(#2885)prefer-conditional-expression
: ignore if-else-if
by default. Use the new "check-else-if"
option to check nested if statements (#2963)Thanks to our contributors!
Editor's note: This release features an important bugfix for overlapping fixes when using --project
and --fix
(#2864).
completed-docs
: Add enum-members
option (#2911)no-this-assignment
(#2931)encoding
closes files correctly (#2958)whitespace
fix whitespace "check-module"
to properly lint and fix errors (#2401) (#2825)whitespace
: now correctly handles dynamic imports introduced in typescript@2.4.0 (#2924)switch-final-break
: don't fail if break jumps to a label outside of the switch (#2914)no-shadowed-variable
: exempt this
parameter (#2598)prefer-for-of
correctly handles variable scopes and other unrelated identifiers (#2984)no-unused-variable
autofix removes whole import (#2901)-v
option (#2926)no-empty
(#2886)prefer-const
: handle destructuring in for-of loop initializer as if {"destructuring": "all"}
was specified (#2904)no-shadowed-variable
: added checks for other shadowing declarations, e.g. interfaces, classes, type parameters, imports, etc. (#2598)no-shadowed-variable
no longer fails for declarations in the same scope, e.g. var foo; var foo;
. Use the rule no-duplicate-variable
to find such errors. (#2598)Thanks to our contributors!
--out
file (#2867)unified-signatures
: Don't suggest to unify rest parameters. (#2874)binary-expression-operand-order
: Allow if both sides of the binary expression are literals. (#2873)whitespace
, space-before-function-paren
and deprecation
(#2893)no-string-literal
: Fix documentation (#2875)--exclude
options in the CLI (#2855)--version
CLI option (#2857)--exclude
CLI option when using --project
(#2852)--type-check
only checks for errors before linting is no longer required to enable rules that use the type checker. You only need to supply --project
now.switch-final-break
(#2804)use-default-type-parameter
(#2253)binary-expression-operand-order
(#2805)ban
new options format: allows to specify an optional explanation message for function bans, banning nested methods and using a wildcard for object of a method ban (#2547)no-duplicate-variable
adds check-parameters
option to check if variable has the same name as a parameter (#2597)curly
: "as-needed" option (#2842)no-unbound-method
add option "ignore-static"
(#2751)strict-boolean-expressions
adds allow-boolean-or-undefined
(#2820)object-literal-shorthand
can fix longhand methods (#2558)prefer-object-spread
allows constructor, function and method calls and more as first argument to Object.assign
(#2828)no-unbound-method
walker skips past the parent if it is a cast or parenthesized expression (#2838)object-literal-shorthand
: fixed suggestion for generator functions (#2558)no-unused-variable
rule on Windows (#2819)tslint --project
if allowJs
is set in tsconfig.json (#2823)align
with option "members"
: check members of class expressions; don't check semicolons in classes (#2668)no-inferred-empty-object-type
: fix stack overflow (#2762)semicolon
: don't warn about unnecesary semicolon when it is actually needed, e.g. when followed by type assertion or template string (#2655)space-before-function-paren
: Ignore async arrow function with no parentheses (#2833)no-unsafe-any
: Don't fail on continue label;
(#2830)no-unbound-method
: Allow unbound method to be used as a condition (#2834)no-unsafe-any
: Allow to switch on a value of type any
(#2836)no-unsafe-any
: Don't mark declare global {}
as an unsafe any. (#2839)indent
now checks indentation of expressions inside template strings (#2826)--project
(or -p
) enables rules that require the type checker. --type-check
only checks for errors before linting is no longer required (#2773)deprecation
: error message includes deprecation text if available (#2748)cyclomatic-complexity
: Don't count empty switch case(#2743)strict-boolean-expressions
: Allow any
, and true
and false
literal types (#2758)no-floating-promises
: Allow 'promise.catch()' (#2774)comment-format
no longer excludes comments with triple slash from linting except /// <reference path="..."/>
(#2616)prefer-object-spread
: lint more locations where return value is used. (#2828)semicolon
: option "never"
is now spec compliant (#2655)object-literal-shorthand
handles async functions correctly (#2558)--test
CLI option: allow passing path to tslint.json (#2784)strict-type-predicates
: warn if strictNullChecks is not enabled (#2786)Thanks to our contributors!
not a directory
error (#2813)prefer-switch
: Change default min-cases
to 3. (#2669)outputAbsolutePaths
option (#2667)prefer-object-spread
(#2624)encoding
(#2368)prefer-conditional-expression
(#2363)indent
support indent size (#2723)object-literal-sort-keys
adds ignore-case
(#2592)quotemark
: Add avoid-template
option (#2766)await-promise
: What's considered a "Promise" is now configurable. (#2661)indent
(#2723)typedef-whitespace
(#2718)variable-name
(#2672)typedef
: Use name or parameters for error location (#2460)object-literal-sort-keys
: check shorthand properties (#2592)space-before-function-paren
: Handle get
/set
accessor (#2700)typedef-whitespace
added checks for arrow function, call and construct signature (#2718)no-object-literal-type-assertion
: Allow cast to any
(#2671)-p
option handles directories (#2756)tsconfig.json
is found next to tslint.json
(#2769)return-undefined
: Treat a return type void | undefined
same as void
(#2731)no-unnecessary-initializer
: Handle BindingElement
anywhere, not just in a VariableDeclaration
. (#2707)jsdoc-format
: correctly handle alignment in files with BOM (#2619)jsdoc-format
: don't treat empty comments (/**/
) as jsdoc (#2619)typedef-whitespace
don't warn for leading whitespace if token is preceded by line break (#2718)jsdoc-format
: fixed error position if line ends with \r\n
(#2619)prefer-switch
: add missing checks for some expressions (#2686)prefer-template
: Allow "a" + "b" + "c"
. (#2741)prefer-const
: fix false positive with variable declared outside of for-of or for-in (#2760)--project
: fix file matching with relative path to tsconfig.json
(#2688)no-default-export
: correctly handle export default abstract class {...}
(#2630)no-mergeable-namespace
: display correct line in error message (#2656)object-literal-sort-keys
: handle object spread correctly (#2592)await-promise
: Consider types derived from a Promise in union types too. (#2661)no-unsafe-any
: Fix bug where number literal in type position was flagged as an unsafe any
. (#2712)Lint.Utils.objectify
(#2764)Thanks to our contributors!
no-console
bans all console methods when no methods are specified (#2610)no-object-literal-type-assertion
(#2580)no-irregular-whitespace
(#2487)prefer-switch
(#2331)number-literal-format
(#2526)deprecation
(#2395)no-unnecessary-type-assertion
(#2519)interface-over-type-literal
(#2617)callable-types
(#2552)no-string-literal
(#2495)no-internal-module
(#2517)align
rule added members
option, which checks alignment of methods and properties of classes, objects, interfaces, type literals and object destructuring (#2387)align
rule added elements
option, which checks alignment of elements in array literals, array destructuring and tuple types (#2387)trailing-comma
adds more granular options to specify trailing commas for arrays, objects, functions, type literals, imports, and exports (#2538)ScopeAwareRuleWalker
and BlockScopeAwareRuleWalker
. (#2561)no-unused-expression
: allow void(0)
in addition to void 0
and void
in expression and statement position (#2645)align
: fix false positive for files with BOM (#2642)return-undefined
: Handle contextual types with ambiguous signatures; allow any
; and handle async functions. (#2576)semicolon
: don't mark semicolon as unnecessary when the next statement is on the same line (#2591)no-internal-module
: no more false positives for global augmentation (#2517)no-unnecessary-qualifier
: no longer breaks when walking a function that references arguments
(#2555)prefer-const
no longer shows warnings on ambient declarations (#2391)callable-types
: suggest correct fix for interfaces with type arguments (#2552)quotemark
: fix regression with jsx attributes (#2605)adjacent-overload-signatures
handles functions ending in semicolon (#2412)object-literal-key-quotes
: correctly stringify numbers when fixing (#2515)object-literal-key-quotes
: does no longer require quotes for property names containing digits (#2515)align
: Don't report 'statements are not aligned' for empty statements (#2653)class-name
now also checks class expressions (#2553)optionExamples
: Allow to use an options array directly instead of a string representation. (#2527)rulesDirectory
can now be resolved with Nodes resolve logic, if the directory contains an index.js
(#2163) (#2358)no-unused-expression
: narrow error location for comma separated expressions and conditional expressions (#2645)no-string-literal
now handles escaped strings (#2495)no-unnecessary-callback-wrapper
: Allow x => x(x)
(#2524)no-var-keyword
: Allow global var declarations (#2513)Thanks to our contributors!
no-invalid-template-strings
(#2332)no-sparse-arrays
(#2407)no-void-expression
: adds ignore-arrow-function-shorthand
(#2445)tslint:all
configuration (#2417)no-reference-import
from jsRules
to rules
(#2441)no-unnecessary-callback-wrapper
: only check if callback is identifier, allow all other expressions (#2510)member-access
: Skip index signature, it can not have an access modifier (#2437)restrict-plus-operands
fixes regression where every assignment and comparison was checked (#2454)no-unnecessary-callback-wrapper
: allow async wrapper function (#2510)prefer-for-of
: No error if delete
is used (#2458)radix
: don't warn for missing radix on method calls (#2352)no-use-before-declare
: Handle symbol with empty declarations list. (#2436)strict-type-predicates
: Check for construct signatures in isFunction
. (#2479)strict-boolean-expressions
: When --strictNullChecks
is turned off, allow-null-union
and allow-undefined-union
turn off "always truthy" errors. (#2373)radix
: added check for global.parseInt and window.parseInt (#2352)arrow-return-shorthand
: Improve failure message when return expression is an object literal (#2466)Thanks to our contributors!
msbuild
was outputting all failures as "warning".pmd
was outputting all failures as priority 1. Now, it uses priority 3 for "error" (default) and priority 4 for "warning"json
changed the fix
property to now contain either one replacement or an array of replacements (#2403)tslint:recommended
configuration updated with tslint:latest
rules & options (#2424)no-unused-new
rule, with logic moved into no-unused-expression
(#2269)no-trailing-whitespace
now checks template strings by default. Use the new options ignore-template-strings
to restore the old behavior. (#2359)skip
from RuleWalker
(#2313)Removed all use of the TypeScript Language Service, use only Program APIs instead (#2235)
This means that some rules that previously worked without the type checker now require it. This includes:
no-unused-variable
no-use-before-declare
This breaks custom rule compilation. If your rule was not using the ts.LanguageService
APIs, the migration is quite simple:
- public applyWithProgram(srcFile: ts.SourceFile, langSvc: ts.LanguageService): Lint.RuleFailure[] {
- return this.applyWithWalker(new Walker(srcFile, this.getOptions(), langSvc.getProgram()));
+ public applyWithProgram(srcFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[] {
+ return this.applyWithWalker(new Walker(srcFile, this.getOptions(), program));
Removed createFix
. Replacements should be passed directly into addFailure. (#2403)
Removed deprecated scanAllTokens
and skippableTokenAwareRuleWalker
(#2370)
[feature] The severity level of rules are now individually configurable. Default severity can also be configured. (#629, #345)
severity
: default
| error | warn | warning | none | off
defaultSeverity
: error | warn | warning | none | off
{
"extends": "tslint:latest",
"rules": {
"callable-types": true,
"max-line-length": [true, 140]
}
}
callable-types
outputs errors and max-line-length
outputs warnings):{
"extends": "tslint:latest",
"defaultSeverity": "error",
"rules": {
"callable-types": true,
"max-line-length": {
"options": 140,
"severity": "warning"
}
}
}
[new-rule] prefer-template
(#2243)
[new-rule] return-undefined
(#2251)
[new-rule] no-reference-import
(#2273)
[new-rule] no-unnecessary-callback-wrapper
(#2249)
[new-fixer] linebreak-style
(#2394)
[new-fixer] eofline
(#2393)
OptionallyTypedRule
, which allows rule authors to write a rule that applies when typing is either enabled or disabled (#2300)prefer-function-over-method
now ignores abstract methods (#2307)arrow-parens
with option ban-single-arg-parens
now correctly handles functions with return type annotation (#2265)prefer-function-over-method
exclude overload signatures (#2315)use-isnan
now applies only to comparison operators (#2317)file-header-rule
now handles single-line comments correctly (#2320)newline-before-return
: fix handling of blank lines between comments (#2321)trailing-comma
No longer enforce trailing commas in type parameters and tuple types (#2236)align
don't fix if it would remove code (#2379)unified-signatures
now recognizes rest parameters (#2342)no-inferrable-types
don't warn for inferrable type on readonly property (#2312)trailing-comma
no longer crashes on new without parentheses (e.g. new Foo
) (#2389)semicolon
Ignore comments when checking for unnecessary semicolon (#2240)semicolon
Don't report unnecessary semicolon when followed by regex literal (#2240)--force
is specified (#2322)--test
now correctly strips single quotes from patterns on windows (#2322)prefer-const
only fix initialized variables (#2219)prefer-const
correctly handle variables shadowed by parameters and catched exceptions (#2219)prefer-const
don't warn if one variable in a for loop initializer can not be const (#2219)prefer-const
handle more cases in destructuring (#2219)no-unused-expression
allow comma separated assignments (#2269)ignore-properties
option of no-inferrable-types
now also ignores parameter properties (#2312)unified-signatures
now displays line number of the overload to unify if there are more than 2 overloads (#2270)trailing-comma
New checks for CallSignature and NamedExports (#2236)semicolon
New check for export statements, function overloads and shorthand module declaration (#2240)semicolon
Report unnecessary semicolons in classes and in statement position (for option "always" too) (#2240)semicolon
check for semicolon after method overload (#2240)array-type
now consider object
, undefined
and never
as simple types, allowing object
, undefined[]
and never[]
(#1843)(#2353)align
check statement alignment for all blocks (#2379)align
check parameter alignment for all signatures (#2379)--test
can handle multiple paths at once (#2322)only-arrow-functions
allow functions that use this
in the body (#2229)--type-check
is used without --project
(#2322)-p
as shorthand for --project
to be consistent with tsc
(#2322)prefer-const
show warnings for var
(#2219)quotemark
fixer unescapes original quotemark (e.g. '\''
-> "'"
) (#2359)no-unused-expression
allow indirect eval (0, eval)("");
(#2269)no-unused-expression
checking for unused new can now use option allow-fast-null-checks
(#2269)no-unused-expression
find unused comma separated expressions in all locations of the code (#2269)no-unused-expression
find unused expressions inside void expression (#2269)defaultSeverity
with options error
, warning
, and off
. (#2416)no-unused-expression
adds option allow-tagged-template
to allow tagged templates for side effects (#2269)no-unused-expression
adds option allow-new
to allow new
without using the new object (#2269)member-access
adds no-public
option (#2247)curly
added option ignore-same-line
(#2334){destructuring: "all"}
to only warn if all variables in a destructuring can be const (#2219)ignore-template-strings
to no-trailing-whitespace
(#2359)array-type
now consider undefined
and never
as simple types, allowing undefined[]
and never[]
(#1843)Thanks to our contributors!
ban-types
and no-duplicate-super
(#2271)object-literal-key-quotes
handle negative number property name (#2273)no-import-side-effect
(#2155)match-default-export-name
(#2117)no-non-null-assertion
(#2221)ban-types
(#2175)no-duplicate-super
(#2038)newline-before-return
(#2173)completed-docs
adds options for location, type, and privacy. Also adds interfaces, enums, types (#2095)no-inferrable-types
adds option ignore-properties
(#2178)typedef
adds options object-destructuring
and array-destructuring
options (#2146)member-ordering
adds option alphabetize
(#2101)no-trailing-whitespace
adds option ignore-jsdoc
(#2177)no-trailing-whitespace
adds option ignore-comments
option (#2153)no-inferrable-types
automatically remove inferrable type annotations (#2178)no-any
(#2165)noConsecutiveBlankLines
(#2201)object-literal-shorthand
(#2165)no-switch-case-fallthrough
handle break, throw, continue and return nested in block, if-else and switch (#2218)no-switch-case-fallthrough
allow empty case clauses before default clause (#2218)no-mergeable-namespace
ignore property types that can't be merged (#2105)object-literal-key-quotes
no need to quote a float if its .toString() is the same. (#2144)no-consecutive-blank-lines
Correctly apply fixes at EOF (#2239)quotemark
now handles escaped chars (#2224)no-switch-case-fallthrough
allow single line comment // falls through
(#2218)no-unbound-method
allows property access and binary expressions (#2143)AbstractWalker
for performance (#2093)
Thanks to our contributors!
whitespace
rule caused false positive on EOF (#2131)json
formatter parameter has extra space (#2132)no-misused-new
)arrow-return-shorthand
(#1972)no-unbound-method
(#2089)no-boolean-literal-compare
(#2013)no-unsafe-any
(#2047)no-unnecessary-qualifier
(#2008)no-unnecessary-initializer
(#2106)await-promise
(#2102)no-floating-promises
(#1632)strict-type-predicates
(#2046)no-misused-new
(#1963)prefer-method-signature
(#2028)prefer-function-over-method
(#2037)allow-fast-null-checks
added to no-unused-expression
(#1638)comment-format-rule
adds ignore-words
and ignore-pattern
options (#1757)whitespace
adds check-preblock
option (#2002)strict-boolean-expressions
adds allow-null-union
, allow-undefined-union
, allow-string
, and allow-number
and (#2033)align
(#2097)no-trailing-whitespace
(#2060)no-magic-numbers
false positive on default parameter values (#2004)no-empty-interface
allow empty interface with 2 or more parents (#2070)no-trailing-whitespace
fixed for comments and EOF (#2060)no-empty
no longer fails for private or protected constructor (#1976)tslint:disable
/tslint-enable
now handles multiple rules and fixes what code is enabled/disabled (#2061)no-inferrable-types
now validates property declarations (#2081)unified-signatures
false positive (#2016)whitespace
finds all whitespace errors in JsxExpressions and TemplateExpressions (#2036)comment-format
no more false positives in JsxText (#2036)--test
option now accepts glob (#2079)Thanks to our contributors!
tslint:latest
configuration (#1981)space-before-function-paren
(#1897)typeof-compare
(#1927)import-spacing
(#1935)unified-signatures
(#1944)object-literal-key-quotes
(#1953)no-angle-bracket-type-assertion
(#1979)adjacent-overload-signature
now handles static/computed function names (#1831)file-header
now handles files with only comments (#1913)no-consecutive-blank-lines
now allows blank lines in template strings (#1886)object-literal-key-quotes
no longer throws exception when using rest operator (#1916)restrict-plus-operands
no longer shows false positive in ternary operation (#1925)prefer-for-of
now handles nested for
loops with reused iterator (#1926)tsconfig.json
passed as --project
argument doens't have files (#1933)object-literal-key-quotes
now handles shorthand and spread properties (#1945)arrow-parens
Allow binding patterns ([x, y]) => ...
and ({x, y}) => ...
to have parens (#1958)semicolon
fixer now handles comma separator in interfaces and indicates failure when commas are using in interfaces (#1856)only-arrow-functions
option allow-named-functions
now allows function declarations (#1961)prefer-for-of
no longer shows false positive when array is in parentheses (#1986)prefer-const
now works for TypeScript versions < 2.1.0 (#1989)member-access
narrow location of error (#1964)Thanks to our contributors!
no-string-throw
(#1878)no-empty-interface
(#1889)interface-over-type-literal
(#1890)callable-types
(#1891)no-void-expression
(#1903)ban-single-arg-parens
added to arrow-parens
(#1893)prefer-const
handles destructuring arrays (#1894), destructuring objects (#1906), and forward references (#1908)one-line
rule (#1866)no-shadowed-variable
now identifies shadowed for
iterator (#1816)object-literal-key-quotes
now includes function names (#1874)disable-next-line
comment (#1902)Thanks to our contributors!
typedef
rule was showing false positive for catch
clause (#1887)prefer-const
(#1801)strict-boolean-expressions
(#1820)no-magic-numbers
(#1799)import-blacklist
(#1841)promise-functions-async
(#1779)no-inferred-empty-object-type
: a type must be specified when using a generic class/function/etc (#1821)allow-named-functions
added to only-arrow-functions
(#1857)prefer-const
(#1801)quotemark
(#1790)code-frame
formatter shows you the error in context (#1819)no-internal-module
failures highlight less text (#1781)only-arrow-functions
will allow functions with a this
parameter (#1597)no-use-before-declare
false positive on named import (#1620)prefer-for-of
was showing false positive when the element is assigned (#1813)type-check
was swallowing the next argument (#1783)tslint:disable-line
was re-enabling tslint:disable
(#1634)adjacent-overload-signatures
did not work for constructors (#1800)checkstyle
formatter was reporting errors under one file (#1811)trailing-comma
was applied to parameter lists (#1775)Thanks to our contributors!
prefer-for-of
(#1758)adjacent-overload-signatures
false positive when a static function has the same name (#1772)Thanks to our contributors!
no-unused-variable
rule from recommended config, as it was causing spurious deprecation warnings.no-unreachable
rule; covered by compiler (#661)extends
array to make it more intuitive. (#1503)completed-docs
rule added (#1644)ordered-imports
auto fixed (#1640)arrow-parens
auto fixed (#1731)indent
rule now ignores template strings (#1611)object-literal-key-quotes
adds the options consistent
and consistent-as-needed
(#1733)--fix
option added to automatically fix selected rules (#1697)adjacent-overload-signatures
now works with classes, source files, modules, and namespaces (#1707).jsx
files if jsRules
are configured (#1714)Thanks to our contributors!
semicolon
rule now disallows semicolons in multi-line bound class methods
(to get the v3 behavior, use the ignore-bound-class-methods
option) (#1643)use-strict
rule (#678)label-undefined
rule; covered by compiler (#1614)no-constructor-vars
to no-parameter-properties
(#1296)orderedImports
rule now sorts relative modules below non-relative modules (#1640)no-unused-variable
rule. This is checked by the TypeScript v2 compiler using the flags --noUnusedParameters
and --noUnusedLocals
. (#1481)no-var-keyword
replaces var
with let
(#1547)trailing-comma
auto fixed (#1546)no-unused-variable
auto fixed for imports (#1568)semicolon
auto fixed (#1423)max-classes-per-file
rule added (#1666)no-consecutive-blank-lines
rule now accepts a number value indicating max blank lines (#1650)ordered-imports
rule option import-sources-order
accepts value any
(#1602)no-empty
rule fixed when parameter has readonly modifierno-namespace
rule: do not flag nested or .d.ts namespaces (#1571)Thanks to our contributors!
no-duplicate-key
rule; covered by compiler (#1109)trailing-comma
supports function declarations, expressions, and types (#1486)object-literal-sort-keys
now sorts quoted keys (#1529)semicolon
now processes type aliases (#1475)no-var-keyword
now rejects export var
statements (#1256)semicolon
now requires semicolon for function declaration with no body (#1447)fileslist
formatter writes a list of files with errors without position or error type specifics (#1558)cyclomaticComplexity
, enforces a threshold of cyclomatic complexity.] (#1464)prefer-for-of
, which errors when for(var x of y)
can be used instead of for(var i = 0; i < y.length; i++)
(#1335)array-type
, which can require using either `T[]' or 'Array' for arrays (#1498)
object-literal-sort-keys
checks multiline objects only (#1642)ban
rule now can ban global functions (#327)jsdoc
rule should not match arbitrary comments (#1543)one-line
rule errors when declaring wildcard ambient modules (#1425)Thanks to our contributors!
tslint:latest
configuration (#1506)adjacent-overload-signatures
rule (#1426)file-header
rule (#1441)object-literal-shorthand
rule (#1488)allow-declarations
option for only-arrow-functions
rule (#1452)import-sources-order
option for ordered-imports
rule (#1466)arrow-parens
rule handles async and generics (#1446, #1479)comment-format
rule ignores tslint control comments (#1473)no-shadowed-variable
rule false positives (#1482)Thanks to our contributors!
arrow-parens
rule (#777)max-file-line-count
rule (#1360)no-unsafe-finally
rule (#1349)no-for-in-array
rule (#1380)object-literal-key-quotes
rule (#1364)ban
rule failure messages (#1385)Thanks to our contributors!
Thanks to our contributors!
ordered-imports
rule (#1325)Thanks to our contributors!
only-arrow-functions
rule (#1318)no-unused-new
rule (#1316)arrow-call-signature
option for typedef
rule (#1284)typedef
rule is more flexible about the location of typedefs for arrow functions (#1176)no-consecutive-blank-lines
now handles lines with only whitespace correctly (#1249).json
config files that have a BOM (#1338)Thanks to our contributors!
linebreak-style
rule (#123)no-mergeable-namespace
rule (#843)ignore-interfaces
option for semicolon
rule (#1233)no-default-export
rule handles more default export cases (#1241)Thanks to our contributors!
member-ordering
rule doesn't crash on methods in class expressions (#1252)ban
rule handles chained methods appropriately (#1234)Thanks to our contributors!
member-ordering
rule doesn't crash on methods in object literals (#1243)new-parens
rule (#1177)no-default-export
rule (#1182)order: ...
option for member-ordering
rule (#1208)one-variable-per-declaration
rule (#1204)semicolon
rule checks export statements (#1155)Thanks to our contributors!
no-namespace
rule (#1133)one-variable-per-declaration
rule (#525)no-inferrable-types
rule (#1190)no-invalid-this
rule (#1179)extends
packages relative to location of configuration file (#1171)Linter
class will throw an error if configuration is of an invalid type (#1167)use-isnan
allows assaignments to NaN
(#1054)no-unreachable
handles allows hoisted type aliases (#564)member-ordering
rule now checks constructors (#1158)--test
CLI command works correctly with specifiying custom rules (#1195)Thanks to our contributors!
no-invalid-this
rule (#1105)use-isnan
rule (#1054)no-reference
rule (#1139)variable-name
rule (#1079)tslint.json
files (#1129)trailing-comma
behavior (#1122)semicolon
rule more lenient with arrow-function class members (#1076)//
comments (#1134)no-var-keyword
rule (#1124)Thanks to our contributors!
findup-sync
dependency (#1108)findConfigurationPath
always returns an absolute path (#1093)findup-sync
dependency (#1080)declare global
no longer triggers no-internal-module
rule (#1069)no-unused-expression
rule (#1050)extends
field for tslint.json
files (#997)--force
CLI option (#1059)Linter
class handles configurations with a rulesDirectory
field (#1035)no-angle-bracket-type-assertion
rule (#639)triple-equals
rule (#602)interface-name
rule (#512)Thanks to our contributors!
--exclude
CLI option (#915)no-shadowed-variable
rule handling of standalone blocks (#1021)package.json
files (#1020)Thanks to our contributors!
no-unused-variable
rule (#314)no-string-literal
rule (#906)member-ordering
rule with regards to arrow function types in interfaces (#226)Thanks to our contributors!
typedef
rule (#333)semicolon
rule (#363)typedef-whitespace
rule (#888)typedef-whitespace
rule can now check spacing on right side of typdef colon (#888)member-ordering
rule treats arrow functions as methods (#226)typedef-whitespace
rule (#955)label-position
rule now allows labels on for-of
loops (#959)Thanks to our contributors!
test/rules/**/*.ts.lint
for examples.trailing-comma
rule (#856)one-line
rule correctly checks space between catch
and opening brace (#925)one-line
rule correctly checks multiline variable declarations (#935)check-finally
for one-line
rule (#925)Thanks to our contributors!
quotemark
rule (#673)no-unused-expression
rule handles await
statements correctly (#887)tslint.json
file with new --init
CLI command (#717)no-var-keyword
rule detects the use of var
in all types of for
loops (#855)no-null-keyword
rule (#722)>= 1.7.3
due to const enum
incompatibility (#832)no-require-imports
rule (#816)no-shadowed-variable
false positives when handling destructuring in function params (#727)rulesDirectory
in tslint.json
now supports multiple file paths (#795)member-access
rule now handles object literals and get/set accessors properly (#801)
check-accessor
and check-constructor
3.0.0-dev.3
3.0.0-dev.2
3.0.0-dev.1
2.6.0-dev.2
2.6.0-dev.1
no-unused-variable
rule with react
option works with self-closing JSX tags (#776)use-strict
bugfix (#544)no-unused-variable
rule (#698, #725)Linter
is exported from "tslint" module (#760)no-use-before-declare
rule doesn't crash on uncompilable code (#763)no-trailing-comma
rule removed, it is replaced by the trailing-comma
rule (#687)sort-object-literal-keys
rule to object-literal-sort-keys
(#304, #537)Lint.abstract()
has been removed (#700)trailing-comma
rule (#557, #687)variable-name
rule (#735, #748)typedef
rule now handles for-of
loops correctly (#743)v1.7.0-dev.20151003
no-unused-expression
rule now handles yield expressions properly (#706)v1.7.0-dev.20150924
AbstractRule
and AbstractFormatter
are now abstract classes (#631)
Lint.abstract()
is now deprecatedv1.6.2
no-unused-variable
rule (#570, #613, #663)v1.6.0-beta
no-internal-module
false positives on nested namespaces (#600)sort-object-literal-keys
rulev1.7.0-dev.20150828
v1.6.0-dev.20150825
v1.6.0-dev.20150821
v1.6.0-dev.20150811
whitespace
false positive in JSX elements (#559)v1.6.0-dev.20150805
.tsx
syntax (#490)no-shadowed-variable
rule (#500)allow-trailing-underscore
option to variable-name
ruleno-conditional-assignment
(#507)member-access
(#552)no-internal-module
(#513)sample.tslint.json
(#545)findup-sync
and underscore.string
dependencies"typescript"
field to package.json
(#560)no-var-keyword
rule-f
option removed from CLIno-require-imports
disallows require()
style importsno-shadowed-variable
moves over shadowed variable checking from no-duplicate-variable
into its own ruleno-duplicate-variable
now only checks for duplicates within the same block scope; enable no-shadowed-variable
to get duplicate-variable checking across block scopesno-duplicate-variable
, no-shadowed-variable
, and no-use-before-declare
now support ES6 destructuringno-var-keyword
disallows var
in favor of let
and const
sort-object-literal-keys
forces object-literal keys to be sorted alphabeticallyvariable-name
, no-use-before-declare
, whitespace
and no-unused-variable
)align
rule now enforces vertical alignment on parameters, arguments, and statementsswitch-default
enforces a default
case in switch
statementsno-duplicate-variable
rule now additionally checks if function parameters have been shadowedtypedef
and typedef-whitespace
rules now take in hyphenated optionsunused-variables
rule cannot find unused private variables defined in the constructor due to a bug in 1.3 compilerindent
rule has changed to only check for tabs or spaces and not enforce indentation levelsno-any
disallows all uses of any
/* tslint:disable */
now disables semicolon rule as wellno-unused-expression
no-var-requires
disallows require statements not part of an import statementtypedef
rule also checks for member variablesno-unused-variable
no longer triggers false positives for class members labeled only static
no-unused-expression
no longer triggers false positives for "use strict";
expressionsuse-strict
works correctly on function declarationsno-unused-expression
rule which disallows unused expression statementscheck-operator
option for the whitespace
rule now checks whitespace around the => tokenno-use-before-declare-rule
no longer triggers false positives for member variables of classes used before the class is declaredwhitespace
ruleno-unreachable
ruleexport import
statements no longer false positives for no-unused-variable-rule
tslint.json
file, under docs/sample.tslint.json
grunt-ts
instead of grunt-typescript
package.json
now contains a tslintConfig
paramater to allow users to specify the location of the configuration file thereno-unreachable
ruleno-unused-variable
no longer checks parameters by default. Parameters are now only checked if the check-parameters
option is set.no-unused-variable
parameter check no longer fails on variable argument parameters (like ...args) and on cases where the parameters are broken up by newlines.no-unused-variable
validates function parameters and constructor methodsno-empty
and no-trailing-comma
rules handle empty objectsno-unused-variable
no-trailing-comma
no-use-before-declare
--version
in CLIverbose
formatterno-empty
allows constructors with member declaration parameters--help
max-line-length
allows CRLF endings