Changelog
v5.4.0
--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!
Changelog
v5.2.0
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!
Changelog
v5.1.0
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!
Changelog
v5.0.0
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)Removed method 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!
Changelog
v4.5.1
ban-types
and no-duplicate-super
(#2271)object-literal-key-quotes
handle negative number property name (#2273)Changelog
v4.5.0
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!