# Changelog

## v2.3.0 (2026-10-22)

- Final release. `tslint-react-hooks` is no longer maintained because TSLint is deprecated.

  Migrate to `eslint-plugin-react-hooks` with typescript-eslint. The README describes how.

- Change the `typescript` `peerDependency` to `>=2.4.0 <7.0.0-0`

  TypeScript 2.1 through 2.3 never worked with this rule. TypeScript 7 is not supported, because
  TSLint itself crashes on it.

- Verify that React 19's `use` API is not reported when called conditionally

- Maintenance

  - Move CI from Azure Pipelines to GitHub Actions
  - Test TypeScript 2.4, 3.9, 4.9, 5 and 6 with TSLint 5 and 6 in CI
  - Smoke-test the packed tarball in CI
  - Upgrade TypeScript to 5.x for building the rule, and TSLint to 6.1.3
  - Publish from a `files` allowlist instead of `.npmignore`, and build in `prepack` instead of
    `prepublishOnly`. The published files are unchanged.
  - Point the rule's documentation link to react.dev

## v2.2.2 (2020-03-21)

- Maintenance

  - Upgrade TypeScript to 3.8.3
  - Upgrade TSLint to 6.x

- Allow TSLint 6.x as a `peerDependency`

  This rule can now be used with TSLint 6.x.

## v2.2.1 (2019-07-14)

- Fix the description of rule options in README

## v2.2.0 (2019-07-14)

- Add support for optionally detecting hook calls from sources other than the `React` namespace
  (e.g. `MyHooks.useHook`).

  Usage is described in the README.

## v2.1.1 (2019-06-09)

- Update dependencies due to security vulnerabilities

## v2.1.0 (2019-04-19)

- Describe a workaround for ambiguous function expressions in the README
- Detect and allow using hooks inside named function expressions

  ```tsx
  const withHoc = <TProps extends object>(Component: ComponentType<TProps>) =>
    function WrappedComponent(props: TProps) {
      // Naming the function expression allows using hooks
      const [state] = useState();
      return <Component {...props} />;
    };
  ```

## v2.0.0 (2019-03-12)

- Report violations whenever a React hook is used after an early return.

  For example, the following code sample now violates the rule:

  ```tsx
  function MyComponent({ counter }) {
    if (counter > 5) {
      return <div>Counter is over 5</div>;
    }

    useEffect(() => {
      console.log('Counter is', counter);
    });

    return <div>{counter}</div>;
  }
  ```

## v1.1.0 (2019-02-09)

- Allow using hooks inside React component decorators, such as `React.memo` or `React.forwardRef`.

  For example, the following code sample now **does not** violate the rule:

  ```tsx
  const MyComponent = React.memo(props => {
    useEffect(() => {
      console.log('Counter changed');
    }, [props.value]);

    return <div>Counter: {props.value}</div>;
  });
  ```

## v1.0.1 (2019-02-03)

- Updated README

  The source code of the rule did not change. The rule has been released again so that the README on
  npmjs.com matches the one on GitHub.

## v1.0.0 (2019-02-03)

- The initial implementation of the rule
