ESLint v4.2.0 released

by Teddy Katz - 8 July 2017

We just pushed ESLint v4.2.0, which is a minor release upgrade of ESLint. This release adds some new features and fixes several bugs found in the previous release.

Highlights

  • linter.verifyAndFix can now accept a filter function for fixes

    When using the Node.js API to autofix code, it's sometimes undesirable to autofix every problem at once. For example, a user might want to avoid fixing problems reported by particular rule, or a tool might want to only fix one problem at a time. You can now pass an object like { fix: message => /* ... */ } to the third argument of linter.verifyAndFix, or to the CLIEngine constructor. If the fix function returns true, a fix is applied -- otherwise, a fix is not applied. eslint-nibble uses this feature to autofix individual rules, or only autofix errors rather than warnings.

    Also see: documentation

  • The getter-return rule has been added.

  • The no-sync rule now has a boolean allowAtRootLevel option to allow sync function calls at the top level of a file.

  • The multiline-ternary rule now has an always-multiline option.

Features

Enhancements

Bug Fixes

Documentation

Chores

  • 9f95a3e Chore: remove unused helper method from indent (#8901) (Teddy Katz)
  • 72f22eb Chore: replace is-my-json-valid with Ajv (#8852) (Gajus Kuizinas)
  • b678535 Chore: Add collapsible block for config in ISSUE_TEMPLATE (#8872) (Gyandeep Singh)
  • 330dd58 Chore: fix title of linter test suite (#8861) (Teddy Katz)
  • 60099ed Chore: enable for-direction rule on ESLint codebase (#8853) (薛定谔的猫)
  • e0d1a84 Chore: upgrade eslint-plugin-eslint-plugin & eslint-plugin-node (#8856) (薛定谔的猫)
  • 0780d86 Chore: remove identical tests (#8851) (Teddy Katz)