BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News ESLint 7.0, 7.1, 7.2 Releases Improve Developer Experience and ES2020 Support

ESLint 7.0, 7.1, 7.2 Releases Improve Developer Experience and ES2020 Support

This item in japanese

The recent ESLint 7.0, 7.1, and 7.2 releases introduce numerous developer experience improvements, remove support for Node.js version 8, and add support for ES2020 features, including nullish coalescing, [import.meta], and export * as ns from 'module' syntax. typescript-eslint also has several recent releases, aligning with ESLint releases and updates to TypeScript.

In alignment with the Node.js 8.0 end-of-life in December 2019, ESLint 7.0 removes support for Node.js 8. To further refine the ESLint architecture, ESLint 7.0 moves ten Node.js specific rules from the core to the eslint-plugin-node plugin.

In ESLint 7.0, many rules received updates for ES2020 BigInt support. The eslint:recommended rule set that provides default rules all developers are encouraged to follow now includes additional rules related to duplication logic, missing import assignments, and not returning setters.

The ESLint 7.0 release took a comparatively long time to release. As explained by ESLint creator Nicholas Zakas:

ESLint v7.0.0 took a long time to release. We know the five-month lag between releases wasn’t good for the project or community. We are looking at what went wrong and how to not repeat this for future major releases. We try to limit major releases to once per year. We try to do regular updates every two weeks, though, and we haven’t done that in five months. That’s what we need to fix.

The community response to Zakas' complaint was supportive and appreciative of their commitment to releasing regularly.

The ESLint 7.0 release contains many improvements to development experience for default ignore patterns and linting files with extensions other than .js if specified via configuration.

To aid developers in providing more precise documentation, descriptions within directive comments allow developers to explain why a linting rule has been disabled for a block of code.

Other developer experience improvements in ESLint 7.0 include additional validation in the RuleTester class for testing custom rules in plugins, and better configuration and plugin resolution. Shared configuration files outside a project can now get colocated with the plugins they require, and users can utilize shared plugins without installing them directly in their project.

The other significant improvement in ESLint 7.0 is the change from CLIEngine, a synchronous API, to ESLint, an asynchronous API. This change allows the implementation of features such as parallel linting.

The ESLint 7.0 release introduces many breaking changes outlined in the ES 7.0 release notes. Developers upgrading from a 6.x version of ESLint are encouraged to review the migration guide from ESLint 6.7 to 7.0.

The ESLint 7.1 and 7.2 releases are minor in comparison to 7.0. ESLint 7.1 introduces a new rule to prevent the loss of numerical precision, improves many existing rules around padding, spacing, and linebreaks, and fixes several rules and edge cases. View the ESLint 7.1 release notes for a complete list of changes.

ESLint 7.2 adds support for some ES2020 syntax features, including the nullish coalescing operator, the export * as ns from 'module' syntax, and import.meta. ESLint support for optional chaining should arrive in the ESLint 7.3 release.

Similar to the ESLint 7.1 release, the ESLint 7.2 release enhances many existing ESLint rules, specifically around parentheses and spacing in various advanced scenarios. View the ESLint 7.2 release notes for a complete list of changes.

After the deprecation of TSLint, ESLint is also the foundation for typescript-eslint.

The ESLint 7.0 release is the foundation for the typescript-eslint 3.0 release. Beyond also dropping support for Node.js 8, typescript-eslint 3.0 removes TypeScript 3.2 support to reduce maintenance pain. The recommended and recommended-requiring-typechecking rule sets now inherit from the eslint-recommended rule set.

Numerous type checking rule changes were updated for typescript-eslint 3.0. Several rules were deprecated and replaced with new rules reflecting modern TypeScript best practices. Other changes were made to the abstract syntax tree to reflect the latest ESTree spec and changes in TypeScript 3.9.

The typescript-eslint 3.0 release also improves the handling of TypeScript 3.9's non-null assertion changes.

The typescript-eslint 3.1 and 3.2 releases make several key improvements to TypeScript linting, and the [3.3] release begins support for the forthcoming TypeScript 4.0 release and its changes to TupleType.

With frequent updates and constant refinement of their rules, ESLint and typescript-eslint provide a stable foundation for validating JavaScript and TypeScript code by reducing errors and maintaining consistency in code bases. Forthcoming releases should add complete linting support for ES2020 and TypeScript 4.0.

ESLint is an OpenJS Foundation project and is available as open-source software under the MIT license. Contributions are welcome via the ESLint GitHub repository. Contributors should follow the ESLint contribution guidelines.

typescript-eslint is a separate project from ESLint as it requires a different AST to parse TypeScript. typescript-eslint is available as open-source software under the BES 2-clause license. Contributions are welcome via the typescript-eslint GitHub repository. Contributors should follow the typescript-eslint contribution guidelines.

Rate this Article

Adoption
Style

BT