Skip to content

Commit

Permalink
docs: Update v9.0.0-alpha.1 highlights (#508)
Browse files Browse the repository at this point in the history
  • Loading branch information
nzakas authored Jan 12, 2024
1 parent fb130c3 commit c0820ef
Showing 1 changed file with 35 additions and 5 deletions.
40 changes: 35 additions & 5 deletions src/content/blog/2024-01-12-eslint-v9.0.0-alpha.1-released.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ layout: post
title: ESLint v9.0.0-alpha.1 released
teaser: "We just pushed ESLint v9.0.0-alpha.1, which is a major release upgrade of ESLint. This release adds some new features and fixes several bugs found in the previous release. This release also has some breaking changes, so please read the following closely."
image: release-notes-major.png
draft: true
authors:
- eslintbot
- nzakas
categories:
- Release Notes
tags:
Expand Down Expand Up @@ -35,10 +34,43 @@ npm i [email protected] --save-dev

### Migration Guide

As there are a lot of changes, we've created a [migration guide](/docs/9.0.0/use/migrating-to-9.0.0) describing the changes in great detail along with the steps you should take to address them. We expect that most users should be able to upgrade without any build changes, but the migration guide should be a useful resource if you encounter problems.
As there are a lot of changes, we've created a [migration guide](/docs/next/use/migrating-to-9.0.0) describing the changes in great detail along with the steps you should take to address them. We expect that most users should be able to upgrade without any build changes, but the migration guide should be a useful resource if you encounter problems.

### `no-inner-declarations` new default behavior

In v8.x, [`no-inner-declarations`](https://eslint.org/docs/next/rules/no-inner-declarations) would flag any functions defined inside of blocks as errors because this behavior was undefined in early versions of JavaScript. As of ES 2015, block-scoped function declarations are well-defined and so we changed the default behavior to not warn on block-scoped functions.

### `no-misleading-character-class` now highlights the offending characters

In v8.x, the [`no-misleading-character-class`](https://eslint.org/docs/next/rules/no-misleading-character-class) rule would highlight an entire regular expression if it contained a misleading character class. In v9.0.0, this rule now highlights just the offending characters to help you more easily find errors.

### `no-unused-vars` `varsIgnorePattern` option change

The `varsIgnorePattern` option of [`no-unused-vars`](https://eslint.org/docs/next/rules/no-unused-vars) was incorrectly applied to caught error variables in `catch` conditions. In v9.0.0, `varsIgnorePattern` no longer applies to caught error variables.

### New rule: `no-useless-assignment`

ESLint v9.0.0 introduces a new rule, [`no-useless-assignment`](https://eslint.org/docs/next/rules/no-useless-assignment), that is designed to catch situations where you've assigned a value to a variable and that value is never used. For example:

```js
let id = 1234; // 1234 is never used
id = calculateId();
```

### The `--output-file` flag now guarantees a file is output

The `--output-file` CLI flag is designed to output the results of the ESLint run to specified file. Prior to this release, no file would be output if linting passed with no errors or warnings. In v9.0.0, an empty file will be output when linting passes without any errors or warnings.

### Better scope analysis

In v9.0.0, we updated the behavior of `eslint-scope` to fix a couple of longstanding bugs:

1. Previously, ESLint would treat `("use strict")` as a strict mode directive even though it is not. We fixed the behavior so only valid strict mode directives are honored.
1. The containing scope of a class `extends` clause was incorrectly set to be the scope containing the class when it should have been the class scope itself. This has been fixed.

## `CodePath#currentSegments` removed

As announced in our [previous post](https://eslint.org/blog/2023/09/preparing-custom-rules-eslint-v9/#codepath%23currentsegments), `CodePath#currentSegments` has been removed from the rules API. Please refer to the post for more details.

## Breaking Changes

Expand Down Expand Up @@ -112,5 +144,3 @@ As there are a lot of changes, we've created a [migration guide](/docs/9.0.0/use
* [`74794f5`](https://github.com/eslint/eslint/commit/74794f53a6bc88b67653c737f858cfdf35b1c73d) chore: removed unused eslintrc modules ([#17938](https://github.com/eslint/eslint/issues/17938)) (Milos Djermanovic)
* [`10ed29c`](https://github.com/eslint/eslint/commit/10ed29c0c4505dbac3bb05b0e3d61f329b99f747) chore: remove unused dependency rimraf ([#17934](https://github.com/eslint/eslint/issues/17934)) (Francesco Trotta)
* [`903ee60`](https://github.com/eslint/eslint/commit/903ee60ea910aee344df7edb66874f80e4b6ed31) ci: use `--force` flag when installing eslint ([#17921](https://github.com/eslint/eslint/issues/17921)) (Milos Djermanovic)


0 comments on commit c0820ef

Please sign in to comment.