🎉 This release contains two major features: caching and code fixes in the LanguageService plugin.
The changes in the LanguageService plugin require that you update the @fimbul/mithotyn
dependency and the fimbullinter.vscode-plugin
VSCode plugin if you were using one of them.
Features:
- new rule:
no-object-spread-of-iterable
warns about spreading an array into an object - new rule:
no-implicit-tostring
warns about implicit string coercion of certain types - new CLI option:
--cache
enables caching for fast incremental linting. Read more about caching - the LanguageService plugin uses caching to speed up linting in your editor
- the LanguageService plugin now provides fixes for fixable findings
prefer-dot-notation
now requires type information
Features:
prefer-dot-notation
no longer reports findings which would cause a compile error when fixed- new rule:
no-writeonly-property-read
- Added support for new language features in all rules:
- optional chaining
- nullish coalescing
- private identifiers
- control-flow effects of
never
-returning functionsno-fallthrough
andno-unreachable-code
report better findings if type inforamtion is availablereturn-never-call
only reports calls that TypeScript's control-flow-analysis cannot detect
- template literal types
no-restricted-property-access
- allow accessing all members via static
super
- allow accessing accessors via
super
- allow accessing abstract accessors via
this
in constructor - disallow read access to uninitialized properties in another property's initializer
- allow accessing all members via static
Bugfixes:
- Exclude JSON files and declartions emitted from
.js(x)
files in composite projects async-function-assignability
fixed false-positive on static class membersno-restricted-property-access
- treat MethodSignature like MethodDeclaration
- fixed lookup of
this
container for decorators and computed property names - fixed crash on parameter properties and special JS property assignments
- most rules can now handle excessively deep AST structures, e.g. concatenating 5000 strings
- TypeScript <3.9 is no longer supported
- Node.js v8, v11 and v13 are no longer supported
Features:
- Added support for typescript v3.9, v4.0 and v4.1
- Fixes compile errors and crashes in existing code and tests
- This does not contain full support for all language features added in those versions
//@ts-nocheck
in .ts files now disables rules with type information for that file, as it was already the case in .js files
Bugfixes:
wotan
: properly handle backslashes in Windows paths to not report "is not included in any of the projects"
- TypeScript v3.1 and v3.2 is no longer officially supported
- Node.js v6 is no longer supported
Rule.supports
can now return a string respresenting the reason for not supporting the fileLinter#lintAndFix
now requires aProgramFactory
instead ofProgram
Linter#lintAndFix
UpdateFileCallback
is now expected to only return aSourceFile
no-inferred-empty-object
was renamed tono-uninferred-type-parameter
Features:
- rules now debuglog the reason for not supporting a certain file
- performance improvements
- when linting with
--project --references
- parsed
tsconfig.json
files are cached for all project references
- parsed
- when linting with
--project --fix
- the project's dependency graph is recalculated lazily the next time a typed rule reuqests type information after fixing a file
- module resolutions are cached between fixes
- when linting with
no-uninferred-type-parameter
properly handles new default constraintunknown
no-uninferred-type-parameter
now detects uninferred type parameters in JS code falling back toany
no-uninferred-type-parameter
correctly handles higher order function typesno-useless-initializer
checks array destructuring- better handling of computed property names
- better handling of object and array destructuring assignments
Bugfixes:
- comments are now included in the transpiled code and declaration files, this makes JSDoc and deprecations visible to API consumers
🎉 Since the last release we published an official extension for VSCode.
- TypeScript v3.0 is no longer officially supported
Features:
bifrost
: pass names of all linted files to TSLint formatters- new rule:
no-useless-destructuring
no-useless-assertion
: detect redundantas const
assertionsno-useless-assertion
: stricter checks of literal type assertions in const context ({ prop: 1 as 1 } as const
)no-inferred-empty-object
: correctly handle higher order function type inference (type parameter propagation) and unions of call signatures
Bugfixes:
wotan
: fixed a crash caused by changes to TypeScript's internal APIno-useless-predicate
: fixes false positive withtypeof {} === 'object'
no-useless-assertion
: don't treatas const
likeas any
Features:
- new rule:
no-useless-try-catch
no-useless-predicate
: detect comparing a literal type with itselfno-useless-predicate
: detect redundant uses ofkey in obj
wherekey
is known to always be present inobj
Bugfixes:
no-useless-predicate
: treat property access on index signatures as potentiallyundefined
no-useless-predicate
: don't report expressions as "always truthy" withoutstrictNullChecks
no-useless-predicate
: avoid nested finding by reporting only the innermost finding
- configuration: patterns (
exclude
andoverrides[].files
) match dotfiles, e.g.*.spec.ts
now matches.foo.spec.ts
. - disable comments: handling of nested ranges changed.
//wotan-enable-line
in a line disabled by//wotan-disable-next-line
is ignored - API: completely refactored
FileFilterFactory
,FileFilter
,LineSwitchFilterFactory
,LineSwitchParser
andDefaultLineSwitchParser
Features:
- unchecked JS files (
//@ts-nocheck
orcheckJs: false
) are never linted with type information - added
report-useless-directives
CLI option to report unused and redundant enable and disable comments
Bugfixes:
wotan
: added missing exports to the public API- patterns in configuration files match dotfiles (see breaking changes)
🎉 This release introduces a plugin for TypeScript's LanguageService. This enables in-editor linting while you type. See the docs for more details.
- TypeScript 2.8 and 2.9 is no longer supported
- API:
Failure
was renamed toFinding
throughout the codebaseResolver
adds a new required methodgetDefaultExtensions
Resolver#resolve
makes parametersbasedir
andextensions
optionalRunner
requires a new serviceFileFilterFactory
- added severity
suggestion
Features:
- new package
@fimbul/mithotyn
provides in-editor linting through a TypeScript LanguageService Plugin - new severity:
suggestion
--fix
can no longer introduce syntax errorsasync-function-assignability
: checks methods and properties with computed namesasync-function-assignability
: checks method overloads individually- new service abstraction
FileFilterFactory
andFileFilter
allow customizing which files are linted @fimbul/ve
no longer includes the line break after the opening tag in the linted code@fimbul/ve
correctly adjusts the column of findings in the first line if there is no line break after the opening tagprefer-number-methods
: fixed finding location
Bugfixes:
- declaration files no longer contain
const enum
- core services no longer rely on the existence of
require
- YAML configuration can now contain YAML-specific types
Features:
- new rule:
async-function-assignability
- handle
BigInt
types and literals no-duplicate-case
: correctly handles BigInt and (bitwise) negation thereofno-invalid-assertion
: adds an additional check for asserting BigIntsno-useless-predicage
: allows comparingtypeof v === "bigint"
no-duplicate-spread-property
: handle spreading of type variables introduced in [email protected]
Bugfixes:
no-duplicate-case
: only use type information ifstrictNullChecks
is enabled to avoid false positives- CLI normalizes
..
and.
in glob patterns and file names no-duplicate-spread-property
: works with intersection types
Features:
wotan test
now validates test configurations- Performance improvements using recently added Node.js file system features
- Improved caching of directory entries
- Work around breaking changes in TypeScript API regarding project references
--fix
now merges replacements of a single fix instead of throwing an errorno-useless-spread
: added check for JSX spread attributes
Bugfixes:
no-useless-initializer
: removed unreliable fix for object destructuringno-useless-initializer
: fixed false positive in destructuring when property is a type parameter or conditional type
Features:
- Added support for Project References added in TypeScript 3.0.0
- Correctly process
tsconfig.json
containingreferences
- Log no warning on empty
files
array if there arereferences
- Added
-r
or--references
CLI option to recursively lint allreferences
. This works similar totsc --build
but doesn't build a dependency graph. Instead it processes the projects depth-first in their specified order.
- Correctly process
- Allow linting multiple projects in one run by specifiying
-p
or--project
multiple times - If a file was not found, report the projects it was searched in
Bugfixes:
typecheck
: correctly report declaration errors with"composite": true
- Node.js v9 is no longer officially supported
- TypeScript v2.7 is no longer officially supported
Features:
- new rule:
no-restricted-property-access
- new rule:
no-useless-strict
no-useless-declare
:declare
keyword is useless onexport
ed declarations in declaration files
Bugfixes:
no-duplicate-spread-property
: correctly handles computed namesno-duplicate-spread-property
: exclude class getters and setters like it's already done for class methodsno-duplicate-spread-property
: no error on getter and setter pairno-invalid-assertion
: handle intersection typesprefer-for-of
: don't suggestfor-of
if implementation of iteration protocol containsprivate
orprotected
members- CLI: fixed handling of
--version
- CLI: correctly handle absolute paths
- fixed corrupted internal state during autofixing with
--project
without typed rules
Features:
no-inferred-empty-object
: handle multiple JSDoc@template
tags starting from [email protected]no-unstable-api-use
: better error message for signaturesno-useless-initializer
: check computed names in destructuring
Bugfixes:
no-return-await
,await-only-promise
,no-useless-assertion
: fixer looks into tagged templates when parenthesizingprefer-dot-notation
: fixer adds parens around numeric literalstype-assertion
: no longer emit invalid code when fixing to classic style
- Dropped support for TypeScript@<2.7.0. The new backwards compatibility policy ensures support for the last 3 stable minor releases of TypeScript.
prefer-number-isnan
->prefer-number-methods
which checksisFinite
in addition
Features:
- new rule:
no-octal-escape
- new rule:
type-assertion
- new rule:
delete-only-optional-property
- Added support for
resolveJsonModule
compilerOption - handle
unknown
type introduced in [email protected] --fix
no longer autofixes files with syntax errors to prevent further destroying your code
Bugfixes:
- fixed crash in
no-inferred-empty-object
with [email protected] and multiple JSDoc@template
tags no-useless-assertion
: better handling of contextual typesno-useless-predicate
: handle intersection typesprefer-for-of
: ensure iterated object implements iteration protocolprefer-for-of
: ensure iterator yields the same type as index signatureno-unstable-api-use
: check element access with well-known symbols
This release fixes a few bugs related to the release process:
- packages are released in dependency order: a new version of a package will not be published before it's dependency
- fixed SemVer version mismatch by publishing packages that depend on other published packages
Bugfixes:
no-nan-compare
: also detects comparing withNumber.NaN
Features:
- new rule:
parameter-properties
(contributed by @aervin) - new rule:
no-duplicate-spread-property
- new rule:
prefer-namespace-keyword
- new rule:
no-useless-declare
- new rule:
ban-dom-globals
bifrost
added a function to wrap Fimbullinter rules for the use in TSLint- many rules now have a detailed documentation page
- Node.js v10 is now officially supported
Bugfixes:
await-only-promise
now allowsfor-await-of
withIterable<PromiseLike<any>>
, previously it only allowedAsyncIterable<any>
no-duplicate-case
added check for unions of literal typesno-inferred-empty-object
handles generic functions declared in JSDocno-useless-assertion
fixed detection if variable may be used before being assigned and thus the non-null assertion is actually necessary
Features:
- new rule:
no-invalid-assertion
no-inferred-empty-object
checks JSX elements and tagged templates starting from [email protected]no-useless-initializer
checks destructuring defaults
Bugfixes:
no-inferred-empty-object
correctly checks classes with constructorno-inferred-empty-object
correctly checks classes from JavaScript files that have type parameters in JSDocno-useless-assertion
forbids definite assignment assertions on properties with computed nameno-return-await
wraps object literals returned from shorthand arrow functions in parentheses to avoid syntax errorsno-useless-spread
no longer autofixes object spread to avoid introducing duplicate key errors--project
flag no longer causes a crash when referencing non-existent filesvaltyr
correctly loads custom formatters
Thanks to @aervin for contributing.
Features:
- new rule:
no-unassigned-variable
- new rule:
no-useless-spread
(contributed by @aervin) - new rule:
return-never-call
Bugfixes:
no-inferred-empty-object
: check generic JSX elements (starting from [email protected])no-useless-assertion
: correctly handle conditional typesno-useless-predicate
: checks comparingtypeof
with a variable that has a literal type:const str = 'string'; typeof 1 === str;
Features:
- new rule:
new-parens
- new rule:
no-case-declaration
- new rule:
no-duplicate-case
- new rule:
no-misused-generics
- new rule:
no-useless-jump-label
- new rule:
prefer-for-of
- optimized some of the existing rules for performance
- added decorators to
ymir
for commonly used rule predicates:@excludeDeclarationFiles
and@typescriptOnly
Bugfixes:
- Errors in
tsconfig.json
are now reported as warnings instead of errors. That allows the use of older versions of TypeScript while using compiler options introduced in a later version. no-useless-predicate
now also checkscase
clauses ofswitch
statements
Features:
- new rule
prefer-const
- new rule
no-useless-predicate
Bugfixes:
- fixed dependency versions of nightly releases for packages that were published in a previous nightly release
- changes to tests and project setup no longer cause a package to be released
This release contains a lot of refactoring and structural changes:
- renamed
await-promise
toawait-only-promise
- renamed
deprecation
tono-unstable-api-use
Two new packages were split from the wotan
package:
ymir
contains all base types and classes. This package can be used by extension and rule authors to not depend on the fullwotan
runtime.mimir
contains all rules, formatters and configuration presets. Together withymir
this package allows rules to be executed in a different runtime without depending on the wholewotan
package
Features:
- Added recipes to Readme
- new rule
await-async-result
- new rule
generator-require-yield
- new rule
no-nan-compare
- new rule
no-unreachable-code
- new rule
prefer-dot-notation
- new rule
prefer-number-isnan
- new rule
prefer-object-spread
no-unstable-api-use
(previouslydeprecation
) also checks@experimental
tag
Bugfixes:
no-unused-label
no longer forbids labels on statements other than loops and switch
Features:
valtyr
added support for processors via .fimbullinter.yaml
Features:
- Added some documentation on how to use the API
wotan
:- new rule
no-useless-initializer
- Renamed
--format
CLI argument to--formatter
- Added support for a configuration file with CLI defaults called
.fimbullinter.yaml
- Added
wotan save
subcommand to write or update.fimbullinter.yaml
- Some internal refactoring and breaking API changes for plugin modules
wotan show
subcommand added optional-c
option- Refactored failure filtering to allow custom services to filter by different criteria than line base comments with rule names.
- new rule
valtyr
:- Added new package
@fimbul/valtyr
to enable TSLint-like behavior - Uses
tslint.json
files for configuration - Uses TSLint rules and formatters
- Filters by
//tslint:disable
comments - Cannot be used together with
.wotanrc.yaml
or Wotan rules and formatters - The next release will include support for processors by using the new
.fimbullinter.yaml
file
- Added new package
bifrost
:- Enforce that rules add failures for the current SourceFile only
wrapTslintRule
:name
parameter is now optional
Bugfixes:
wotan
:- Really "Include missing declarations in bundled declaration files" which was documented as part of v0.1.0
- Fixed logic to find and report unmatched files in processed projects
- Fixed crash during directory scanning when using
--project
if a directory contains an invalid.wotanrc.yaml
file
Features:
- Enabled nightly builds for all packages. These can be installed with
yarn add @fimbul/wotan@next @fimbul/ve@next ...
(ornpm install
if you prefer). ve
: use SAX parser for performance and avoid false positive matches of<script>
tagswotan
:- New rule
typecheck
: type errors as lint rule failures (similar totslint --type-check
, but is correctly formatted and can be ignored like any other rule) - New rule
syntaxcheck
: syntax errors as lint rule failures - New rule
no-inferred-empty-object
: warns about uninferred type parameters that might cause unintended behavior - Introduced
LineSwitchParser
to allow overriding the default line switch handling - Introduced
ConfigurationProvider
to allow overriding the default config lookup and parsing - Removed implicit configuration lookup in home directory
- Improved error reporting for errors in configuration files
- Fail early for circular aliases or missing rulesDirectories in configuration files
- Allow alias shorthands:
overrides: prefix: name: some-rule-name # same as `name: { rule: some-rule-name }`
- New rule
- Added documentation for rule and package authors
Bugfixes:
- Include missing declarations in bundled declaration files
wotan
:- Rule
no-useless-type-assertion
now correctly handles class expressions and qualified type names - Detect MPEG TS files and show a warning. Such files are treated as if they were empty.
stylish
formatter correctly displaysline:col
information for files with BOM
- Rule
Packages:
@fimbul/wotan
: The main linter runtime with a set of core rules and formatters- Available formatters:
json
andstylish
(default) - Available rules:
await-promise
warns about unnecessary await on non-Promise valuesdeprecation
detects the use of deprecated APIsno-debugger
bansdebugger;
statementsno-fallthrough
warns about unintentional fallthrough in switch casesno-return-await
warns about unnecessaryreturn await foo;
where you can justreturn foo;
no-unsafe-finally
warns about control flow statements within thefinally
blockno-unused-expression
warns about expressions without side-effects whose result is not usedno-unused-label
does what the name suggests, reallyno-useless-assertion
detects assertions that don't change the type of the expressiontrailing-newline
enforces a line break on the last line of a filetry-catch-return-await
enforces the use ofreturn await foo;
inside try-catch blocks
- Available formatters:
@fimbul/ve
: The official processor plugin for Vue Single File Components@fimbul/heimdall
: Plugin to enable the use of TSLint rules and formatters within Wotan@fimbul/bifrost
: Allows authors of TSLint rules and formatters to make them available for Wotan without refactoring.