Skip to content

Latest commit

 

History

History
88 lines (57 loc) · 1.98 KB

CHANGELOG.md

File metadata and controls

88 lines (57 loc) · 1.98 KB

Changelog

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 not 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

    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:

    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:

    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