Skip to content

v5.0.0

Compare
Choose a tag to compare
@github-actions github-actions released this 29 Jan 06:37
· 440 commits to main since this release

5.0.0 (2023-01-29)

Overview

It's finally here. With this release, I am happy to announce that we are finally adding the long-awaited support for the Readonly<T> type (#51).
With this change, we are deprecating the rule prefer-readonly-type in favor of two new rules prefer-immutable-types and type-declaration-immutability.

These new rules split the responsibility of enforcing immutability. prefer-immutable-types is all about enforcing that immutable types are used in your runtime code (type annotations), while type-declaration-immutability is all about enforcing the immutability of type declarations (type aliases and interfaces). These rules take a different approach to enforcing immutability than the old prefer-readonly-type rule, so be sure to check each of their documentation files.

prefer-immutable-types is also designed to be a replacement for @typescript-eslint's prefer-readonly-parameter-types as it offers the same functionality plus more.

Dependancies

When updating, be sure to have add these two new dependencies to your project: @typescript-eslint/type-utils @typescript-eslint/utils

Ruleset Changes

We have introduced a new ruleset called strict. This ruleset will enforce the strictest configuration of our rules.
Note: Each rules' default configuration is in its strictest mode.

The recommended ruleset has in turn been made a little less strict.

New Rules

Deprecated Rules

Breaking Changes

Rule and Option

  • prefer-tacit now provides suggestions instead of a fixer. In turn allowFixer has been removed from the assumeTypes option.

Name Changes

  • no-method-signature => prefer-property-signatures.
    • ignoreIfReadonly => ignoreIfReadonlyWrapped (now false by default).
  • no-let (unchanged)
    • allowLocalMutation => allowInFunctions
  • no-return-void (unchanged)
    • ignoreImplicit => ignoreInferredTypes

The name of all the rules and options are now plural where appropriate.

  • no-class => no-classes.
  • no-conditional-statement => no-conditional-statements.
  • no-expression-statement => no-expression-statements.
  • no-loop-statement => no-loop-statements.
  • no-mixed-type => no-mixed-types.
  • no-this-expression => no-this-expressions.
  • no-throw-statement => no-throw-statements.
  • no-try-statement => no-try-statements.
  • immutable-data (unchanged)
    • ignoreClass => ignoreClasses

Rulesets

Name Changes

  • no-object-orientation => no-other-paradigms.
  • external-recommended split into external-vanilla-recommended and external-typescript-recommended.

Rule Changes

  • The deprecated rule prefer-readonly-type has been removed from all rulesets (except off).
  • prefer-property-signatures (formally no-method-signature) has been moved to the stylistic ruleset.
  • no-this-expressions has been removed from the recommended and lite rulesets.
  • @typescript-eslint/prefer-readonly-parameter-types has been removed from list of recommended external rules.

Dependencies

  • minimum supported TypeScript version is now v4.0.2.
  • minimum supported Node version is now v16.10.0.

Additional Features and Bug Fixes

  • functional-parameters now has an option to ignore lambda function expressions (#468).
  • no-mixed-types now supports Type Literals directly inside the Readonly type (#500).