Releases: palantir/tslint
v5.10.0
v5.10.0
🎉 Features
- [new-rule]
prefer-while
(#3750) - [new-fixer]
comment-format
(#3845) - [new-rule-option]
"allow-empty-functions"
forno-empty
rule (#3624) - [new-rule-option] New options for
promise-function-async
specifying what kinds of functions to check (#3807)
🛠️ Bugfixes & enhancements
- [bugfix]
file-header
rule plays nice withno-trailing-whitespace
rule (#3802) - [bugfix]
no-unbound-method
rule allows square bracket property access (#3610) - [bugfix]
no-unsafe-any
no longer marks native JSX elements as unsafe (#3699) - [enhancement]
file-header
auto-fixes use '!' character to ensure header stays above imports (#3741) - [enhancement] Better error messages if a rule crashes (#3836)
- [enhancement] Better error messages when no valid rules are specified (#3729)
- [enhancement] Better lint messages for unused imports in
no-unused-variable
rule (#3831) - [docs] Improve documentation of cli flag --project (#3703)
- [docs] Added short rationales for about thirty rules (#3734)
- [docs] Added optional capability to provide code examples in rules' metadata (#3602)
- [docs] Many small docs fixes and tweaks from many great contributors!
Thanks to our contributors!
- Achim Weimert
- BB9z
- Blair Zajac
- Chia-Lun Wu (Leo)
- Ethan
- Janis Koehr
- Josh Goldberg
- Julian Verdurmen
- Lucas Sloan
- Mark Vincze
- Martin Möhwald
- Oliver Joseph Ash
- Pichest Wongsiripiphat
- Rafael Santana
- Ruben Bridgewater
- Ryan Waskiewicz
- Sehrope Sarkuni
- Suchan Lee
- Victor Belozyorov
- aervin_
- cwgorman
- felipeissa
- jishi9
v5.9.1
🛠️ Bugfixes
v5.9.0
⚠️ Deprecations
- [deprecation] Several utility functions from
src/language/utils.ts
have been deprecated (#3476) - [deprecation] Linting non-existent files now outputs a warning. This will be an error in TSLint 6. (#3313)
Configuration inheritance changes
Significant changes have been made to configuration inheritance to address a long-standing UX issue around defualtSeverity
: #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:
- Override
defaultSeverity
defined in extended configs (#3449) - Inherit defaultSeverity and apply it to preceding base configs (#3530)
🎉 Features
- [feature] Support yaml configuration files (#1598) (#3433)
- [new-fixer]
file-header
(#3475) - [new-rule]
no-dynamic-delete
(#3573) - [new-rule]
prefer-readonly
(#2896) - [new-rule]
newline-per-chained-call
(#3278) - [new-rule-option]
"temporalDeadZone"
forno-shadowed-variable
to ignore shadowing in the temporal dead zone of classes, parameters, enums and variables declared withlet
orconst
(#3389) - [new-rule-option]
"shorthand-first"
forobject-literal-sort-key
(#3607) - [new-rule-option] Add support for an ignore pattern for
max-line-length
(#3099)
🛠️ Bugfixes & enhancements
- [bugfix] Update commander.js dependency to prevent users from transitively installing a buggy 2.12.0 release (#3510)
- [bugfix]
--project
excludes all files of external dependencies (#3320) - [bugfix] Show errors when
tsconfig.json
is invalid (#3410) - [bugfix]
no-implicit-dependencies
don't crash on malformed package.json (#3373) - [bugfix]
strict-type-predicates
allows comparing typeof result with non-literals (#3542) - [bugfix]
no-redundant-jsdoc
fixed crash on unhandled tag (#3414) - [bugfix]
object-literal-sort-keys
fixed regression that effectively disabled the rule with\r\n
line breaks (#3427) - [bugfix]
curly
fixer now correctly handles comments (#3473) - [bugfix]
no-unsafe-any
fixed false-positive with namespaced types (#3487) - [bugfix] Removed potentailly dangerous fixer for
no-any
(#3486) - [bugfix]
no-unnecessary-type-assertion
fixed false negatives for types with numeric keys (#3468) - [bugfix]
callable-types
adds parentheses when fixing a type literal inside an array type (#3440) - [bugfix]
no-unsafe-any
allows spreading anany
value into an object (#3439) - [bugfix] no unnecessary whitespace before argument in callback functions fixed with
arrow-parens
fixer (#3618) - [bugfix]
prefer-const
false negative with index signature named like a variable (#3385) - [bugfix]
whitespace
rule checks property declarations if"check-decl"
is enabled (#3546) - [bugfix] Using ternary operator for calling super() now passes
no-duplicate-super
rule. (#3544) - [bugfix]
no-shadowed-variable
now excludes declaration files and ambient modules (#3387) - [bugfix]
no-duplicate-imports
Allow duplicate imports from separate ambient module declarations (#3398) - [bugfix]
await-promise
correctly recognises classes extending Promise (#3383) - [bugfix]
prefer-conditional-expression
: don't repeat error on nested if statements (#3528) - [bugfix]
completed-docs
: don't require documentation on methods in object literals (#3532) - [bugfix]
one-line
fixed crash on syntax error in class or interface (#3538) - [bugfix]
no-redundant-jsdoc
allow@template
tag if it has a description (#3415) - [bugfix] Fix condition for deprecation of
typeof-compare
(#3429) - [enhancement] Better error message for files not contained in the project (#3313)
- [enhancement]
"properties"
option forcompleted-docs
rule now checks getter and setter accessors. (#3497) - [enhancement]:
no-magic-numbers
ignores parseInt radix parameter (#3536) - [enhancement] Avoid duplicate I/O when using
--project
option (#3313) - [enhancement] clicking the filename in
stylish
-formatter's output jumps to the first failure in that file. (#3491) - [enhancement]
ban-comma-operator
ignores comma operator inside for-loop incrementor (#3485) - [enhancement]
space-within-parens
updated to always allow empty parentheses()
. (#3513) - [enhancement] Better error message syntax for
completed-docs
modifier lists (#3379) - [enhancement] Improve failure message & docs for
ban-comma-operator
(#3384) - [enhancement] Output code warnings in yellow instead of red for codeFrame formatter (#3402)
- [enhancement] Converted
completed-docs
rule to use a function instead of a walker (#3466) - [docs]
ban-comma-operator
: fix metadata, list as "functionality" rule (#3612) - [docs] Enhance
no-use-before-declare
documentation to clarify the rule's status (#3520) - [docs] Enhance
await-promise
options documentation (#3519) - [docs] Add
hasFix
metadata for theindent
rule (#3529) - [docs] Clearer rule description for
no-irregular-whitespace
(#3627)
Thanks to our contributors!
- Klaus Meinhardt
- Josh Goldberg
- Chris Barr
- Nathan Shively-Sanders
- Jeremy Morton
- Sergey Koshechkin
- Daniel Kucal
- Eric Smekens
- Johannes Choo
- Elena Vilchik
- Eugene Timokhov
- Carlo Bottiglieri
- reduckted
- Glavin Wiechert
- jbsingh
- Mateusz Witkowski
- HideDev
- Bruno Lemos
- aervin_
- Roman
- Ryan Waskiewicz
v5.8.0
⚠️ Deprecations
- [deprecation]
typeof-compare
is deprecated because typescript already does that check (#3286) - [deprecation] CLI argument
--type-check
is no longer necessary and will be removed in the next major version (#3322)
⚠️ Updates to 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,
🎉 Features
- [feature] Added
linterOptions
configuration field totslint.json
, which supports a list ofexclude
globs to disable linting for a subset of files (#2409) - [new-rule]
no-return-await
(#3233) - [new-rule]
no-redundant-jsdoc
(#2754) - [new-rule]
no-duplicate-switch-case
(#2937) - [new-rule]
no-implicit-dependencies
(#3343) - [new-rule]
no-unnecessary-class
(#3119) - [new-rule]
ban-comma-operator
(#3250) - [new-fixer]
one-line
(#3200) - [new-fixer]
curly
(#3262) - [new-rule-option]
jsdoc-format
adds option"check-multiline-start"
to enforce the first line of a multiline JSDoc comment to be empty. (#3181) - [new-rule-option]
trailing-comma
adds option"esSpecCompliant"
to make it compatible with the ES spec regarding trailing commas after object/array rest and rest parameters. (#3176) - [new-rule-option]
"check-parameter-property"
option formember-access
rule (#3325) - [new-rule-option]
"strict-bound-class-methods"
option forsemicolon
rule (#3294) - [new-rule-option]
"grouped-imports"
option forordered-imports
rule (#3138) - [new-rule-option]
"ignore-blank-lines"
option forno-trailing-whitespace
rule (#3346) - [new-rule-option]
"never"
option forobject-literal-shorthand
disallows shorthand notation (#3268) - [new-rule-option]
"exclude-class-expressions"
option formax-classes-per-file
rule (#3281) - [new-rule-option]
no-unnecessary-type-assertion
supports a whitelist of types to ignore (#3257) - [new-rule-option]
"module-source-path"
forordered-imports
allows sorting imports by trailing end of path (#3178) - [new-formatter] JUnit (#3194)
🛠️ Bugfixes & enhancements
- [bugfix]
no-empty-interface
allows providing type arguments for extended type (#3260) - [bugfix] Fixed line switches to not disable failures in the next line following the disabled line (#3177)
- [bugfix]
return-undefined
handles union return types in async functions (#3298) - [bugfix]
deprecation
checks correct constructor overload (#3203) - [bugfix]
return-undefined
declared return type takes precedence over contextual type (#3298) - [bugfix] Correctly mark
inputFilePath
as an optional parameter inConfiguration.findConfiguration()
(#3195) - [bugfix]
return-undefined
fixed regressions: once again allows anything if return type isany
(#3298) - [bugfix]
only-arrow-functions
allow function ifthis
is used in parameter initializer (#3315) - [bugfix]
no-conditional-assignment
: exclude intentional assignments, e.g. inside functions (#2629) - [bugfix]
no-angle-bracket-type-assertion
fixer adds parentheses when necessary (#3301) - [bugfix]
no-angle-bracket-type-assertion
fixed order when autofixing consecutive assertions (#3301) - [bugfix]
vso
formatter no longer duplicates output for fixed failures (#3348) - [bugfix]
no-unbound-method
: Allow negation of method (#3349) - [bugfix]
arrow-parens
with option"ban-single-arg-parens"
no longer produces invalid code when fixed (#3247) - [bugfix] Fixed regression where the lookup of
tslint.json
stopped at the current directory. (#3309) - [bugfix]
--test
works correctly with anycompilerOptions.target
(#3296) - [bugfix]
whitepace
handles files with BOM and other irregular whitespace (#3305) - [bugfix]
callable-types
auto fix produces invalid results (#3342) - [bugfix]
no-string-literal
correctly fix property names with leading underscores (#3184) - [bugfix]
variable-name
fixed crash on empty variable name (#3292) - [bugfix]
trailing-comma
fixed crash on arrow function without parens (#3246) - [bugfix] Fix
space-before-function-paren
for anonymous/arrow generic functions (#3085) - [bugfix] Removed warning printed to console when using the
no-unused-variable
along with thenoUnusedLocals
andnoUnusedParameters
compiler options (#3227) - [bugfix]
no-invalid-this
ignores functions with athis
param (#3267) - [enhancement] Sort failures by line and character for formatters (#3345)
- [enhancement]
import-blacklist
also checks exports and dynamic imports (#3258) - [enhancement]
no-conditional-assignment
added check for conditional (ternary) expressions (#2629) - [enhancement] Allow
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) - [enhancement]
await-promise
enforces thatfor-await-of
is only used withAsyncIterable
(#3297) - [enhancement]
one-line
checks type alias declarations (#3200) - [enhancement]
deprecation
checks object destructuring (#3318) - [enhancement]
no-submodule-imports
also checks exports (#3258) - [enhancement]
restrict-plus-operands
: More specific error message when arguments include strings (#3220) - [enhancement]
no-unsafe-any
checks more expressions, for example destructuring,yield
, property initializer (#3196) - [enhancement]
object-literal-sort-keys
: allow grouping of object properties via additional blank lines when using alphabetical ordering. (#3191) - [enhancement] Migrated CLI from using
colors
module tochalk
module (#3171) - [enhancement]
no-unused-variable
applies the ignorePattern to imports (#3187)
Thanks to our contributors!
- Klaus Meinhardt
- Charles Samborski
- Donald Pipowitch
- Josh Goldberg
- mmkal
- Erik
- Csaba Miklos
- Dominik Moritz
- Khalid Saifullah
- Lukas Spieß
- Merott Movahedi
- Bowen Ni
- ksvitkovsky
- Hutson Betts
- Caleb Eggensperger
- Brent Erickson
- Trivikram
- Brandon Furtwangler
- Pavel Zet
- aervin_
- Holger Jeromin
- Danny Guo
- Jeremy Morton
- Cyril Gandon
- Andy Hanson
- yadan
v5.7.0
🎉 New rules, options, and fixers
- [new-rule]
no-parameter-reassignment
(#3045) - [new-rule-option]:
object-literal-sort-keys
: Addmatch-declaration-order
option (#2829) - [new-rule-option]
check-type-operator
forwhitespace
rule (#3083) - [new-rule-option]
whitespace
: Addcheck-rest-spread
option (#3089)
🛠️ Bugfixes & enhancements
- [api]
AbstractRule#applyWithFunction
allows additional parameter that is passed through towalkFn
(#3140) - [api]
AbstractRule#applyWithFunction
has better type checking for its type parameter (#2660) - [bugfix]
member-access
autofix now correcly insertspublic
keyword after decorators (#3162) - [bugfix]
prefer-const
correctly handlecatch
without binding parameter introduced in[email protected]
(#3151) - [bugfix]
no-invalid-template-strings
allows backslash-prefixed template expressions (#3116) - [bugfix]
deprecation
no longer shows errors on imports and exports (#3141) - [bugfix]
deprecation
: fix false positive when calling a function or method where another overload is deprecated (#2883) - [bugfix]
whitespace
: fixed"check-separator"
for trivialfor
cases. (#3132) - [bugfix]
prefer-object-spread
prevent spreadingthis
as it is not allowed by the compiler (#3126) - [bugfix]
msbuild
formatter uses backslashes in paths on Windows (#3145) - [bugfix]
no-namespace
ignores global augmentation (#3161) - [enhancement] remove superfluous empty lines on tslint output. (#3121)
- [enhancement]
no-submodule-imports
allows whitelisting of submodules like@angular/core/testing
(#3129) - [enhancement] custom lint rules will be resolved using node's path resolution to allow for loaders like
ts-node
(#3108) - [enhancement]
quotemark
no longer requires"single"
or"double"
to be the first option. The rule defaults to"double"
if none is specified. (#3114) - [enhancement]
no-unused-variable
autofix removes trailing comments of imports (#3156) - [enhancement]
no-unnecessary-type-assertion
allows certain necessary assertions to prevent type widening (#3120)
Thanks to our contributors!
- Paul Gschwendtner
- Andy Hanson
- ksvitkovsky
- Santi Albo
- aervin
- Junle Li
- Joscha Feth
- WiseBird
- Caleb Eggensperger
- WGroenestein
- Bowen Ni
v5.6.0
🎉 New rules, options, and fixers
- [new-rule]
no-duplicate-imports
(#3075) - [new-rule]
no-submodule-imports
(#3091) - [new-rule]
space-within-parens
(#2959) - [new-fixer]
member-access
(#2969) - [new-fixer]
no-null-keyword
: fixx == null
tox == undefined
(#2802) - [new-rule-option]
no-shadowed-variable
let's you optionally ignore certain kinds of declarations (#3030) - [new-rule-option]
prefer-conditional-expression
addscheck-else-if
(#2963)
🛠️ Bugfixes & enhancements
- [bugfix]
array-type
: considerthis
to be simple type (#2982) - [bugfix]
await-promise
accepts not only union types but also intersection types with Promise-like types (#2987) - [bugfix]
callable-types
: don't remove export modifier of interfaces (#2962) - [bugfix]
completed-docs
: Only checks variables at the file-level. (#2950) - [bugfix]
completed-docs
: Uses correct visibility of variables. (#2950) - [bugfix]
no-floating-promises
: recognize rejection handler passed as second argument topromise.then()
(#3048) - [bugfix]
no-shadowed-variable
don't warn for shadowed type parameter on static class members (#3030) - [bugfix]
no-shadowed-variable
fixed false positive with key name in index signature (#3030) - [bugfix]
no-shadowed-variable
fixed false positive with parameter inside function decorator (#3030) - [bugfix]
no-unsafe-any
: allow truthyness and falsyness checks (#3008) - [bugfix]
no-unused-variable
fixed crash when using destructuring (#3058) - [bugfix]
one-line
correctly handles multiline type parameters (#3004) - [bugfix]
prefer-for-of
fixed false positives when array is modified, e.g.arr[i]++
(#3044) - [bugfix]
prefer-object-spread
adds parens when fixing arrow function return (#3026) - [bugfix]
prefer-object-spread
permit functions as first argument to Object.assign (#3098) - [bugfix]
space-before-function-paren
Handle default exports of functions without names like anonymous functions (fixes #3040) (#3053) - [bugfix] Fixed an issue where, at runtime, the module
./test/parse
could not be located due after consumers had runyarn clean
(#3072) - [enhancement]
no-null-keyword
allows strict comparison (#2802) - [enhancement]
no-switch-case-fall-through
matches// falls through
comments case insensitive and allows trailing text (#2983) - [enhancement]
ordered-imports
: support importEqualsDeclaration (#3102) - [enhancement] Added NaN and (+/-)Infinity as numbers to
no-inferrable-types
(#2885) - [enhancement] Improved CLI error message when no filenames are specified (#3066)
- [rule-change]
prefer-conditional-expression
: ignoreif-else-if
by default. Use the new"check-else-if"
option to check nested if statements (#2963)
Thanks to our contributors!
- Klaus Meinhardt
- Julian Verdurmen
- Alexandre Alonso
- Josh Goldberg
- ksvitkovsky
- Daisuke Yokomoto
- Andrii Dieiev
- Florent Suc
- Jason Killian
- Amin Pakseresht
- reduckted
- vilicvane
- Russell Briggs
- Andy Hanson
- Leo Liang
- Dan Homola
- BehindTheMath
- David Golightly
- aervin
- Daniel Kucal
- Ika
- Chris Barr
v5.5.0
Editor's note: This release features an important bugfix for overlapping fixes when using --project
and --fix
(#2864).
🎉 New rules and options
- [new-rule-option]
completed-docs
: Addenum-members
option (#2911) - [new-rule]
no-this-assignment
(#2931)
🛠️ Bugfixes & enhancements
- [bugfix]
encoding
closes files correctly (#2958) - [bugfix]
whitespace
fix whitespace"check-module"
to properly lint and fix errors (#2401) (#2825) - [bugfix]:
whitespace
: now correctly handles dynamic imports introduced in [email protected] (#2924) - [bugfix]
switch-final-break
: don't fail if break jumps to a label outside of the switch (#2914) - [bugfix]
no-shadowed-variable
: exemptthis
parameter (#2598) - [bugfix]
prefer-for-of
correctly handles variable scopes and other unrelated identifiers (#2984) - [bugfix] Don't leave blank lines when
no-unused-variable
autofix removes whole import (#2901) - [cli] restore
-v
option (#2926) - [enhancement] Print stack trace of exceptions (#2890)
- [enhancement] Added allow-empty-catch option to
no-empty
(#2886) - [enhancement]
prefer-const
: handle destructuring in for-of loop initializer as if{"destructuring": "all"}
was specified (#2904) - [enhancement]
no-shadowed-variable
: added checks for other shadowing declarations, e.g. interfaces, classes, type parameters, imports, etc. (#2598) - [rule-change]
no-shadowed-variable
no longer fails for declarations in the same scope, e.g.var foo; var foo;
. Use the ruleno-duplicate-variable
to find such errors. (#2598)
Thanks to our contributors!
- Klaus Meinhardt
- Josh Goldberg
- Petr Kosikhin
- Pablo Núñez
- Benny Neugebauer
- Radon Rosborough
- reduckted
- Chris Barr
- Julian Verdurmen
v5.4.3
🛠️ Bugfixes
- [bugfix] Fixed regression with empty
--out
file (#2867) - [bugfix]
unified-signatures
: Don't suggest to unify rest parameters. (#2874) - [bugfix]
binary-expression-operand-order
: Allow if both sides of the binary expression are literals. (#2873) - [bugfix] Restore compatibility with [email protected] and 2.2 for
whitespace
,space-before-function-paren
anddeprecation
(#2893) - [docs]
no-string-literal
: Fix documentation (#2875)