Skip to content

Releases: tatethurston/eslint-plugin-react-prefer-function-component

v3.3.0

30 Aug 18:24
48caca6
Compare
Choose a tag to compare

v3.3.0

Adds ESLint's new configuration system, flat config. If you're using the new flat config:

eslint.config.js:

import eslint from "@eslint/js";
import reactRecommended from "eslint-plugin-react/configs/recommended.js";
import preferFC from "eslint-plugin-react-prefer-function-component/config";

export default [
  { files: ["**/*.{js,jsx}"] },
  eslint.configs.recommended,
  reactRecommended,
  preferFC.configs.recommended,
];

Full Changelog: v3.2.0...v3.3.0

v3.2.0

02 Aug 00:34
15c53ec
Compare
Choose a tag to compare

v3.2.0

  • The plugin's recommended configuration has been fixed, so plugins can be dropped from your .eslintrc when using the recommended settings:

    module.exports = {
    -  plugins: ["react-prefer-function-component"],
      extends: ["plugin:react-prefer-function-component/recommended"],
    };

    Thanks @alecmev!

New Contributors

Full Changelog: v3.1.0...v3.2.0

v3.1.0

13 Nov 00:16
c2b155e
Compare
Choose a tag to compare

v3.1.0

  • New option: allowJsxUtilityClass. This configuration option permits JSX utility classes: classes that have methods that return JSX but are not themselves components (they do not extend from a Component class or have a render method).

    The following is now permitted when enabling this configuration option:

    class Foo {
      getBar() {
        return <Bar />;
      }
    }

    Thanks noahm for the contribution!

New Contributors

  • @noahm made their first contribution in #10

Full Changelog: v3.0.0...v3.1.0

v3.0.0

23 Jun 17:39
3ea8a56
Compare
Choose a tag to compare

What's Changed

  • Detects class components that extend the Component class, even if they do not use any JSX. Now errors on manager, business logic, and other renderless class components that extend Component. Previously the below was not caught:
class TimerComponent extends React.Component {
  /// ...

  componentWillMount() {
    this.startTimer();
  }

  componentWillUnmount() {
    this.stopTimer();
  }

  render() {
    null;
  }
}

Thanks @wo1ph for the improvements!

New Contributors

  • @wo1ph made their first contribution in #7

Full Changelog: v2.0.0...v3.0.0

v2.0.0

02 May 20:00
be61928
Compare
Choose a tag to compare

What's Changed

  • Support for createClass from React has been dropped. Usage of createClass will no longer be detected.
  • Now errors on any JSX usage within a class. Previously the below was not caught:
import Document from "next/document";

class MyDocument extends Document {
  render() {
    <>...</>;
  }
}

Full Changelog: v1.0.0...v2.0.0

v2.0.0-rc1

29 Apr 23:46
38e5acb
Compare
Choose a tag to compare
v2.0.0-rc1 Pre-release
Pre-release

What's Changed

  • Support for createClass from React has been dropped. Usage of createClass will no longer be detected.
  • Now errors on any JSX usage within a class. Previously the below was not caught:
import Document from "next/document";

class MyDocument extends Document {
  render() {
    <>...</>;
  }
}

Full Changelog: v1.0.0...v2.0.0-rc1

v1.0.0

20 Jan 19:20
e4ae67f
Compare
Choose a tag to compare

What's Changed

No API changes. This library will now follow semantic versioning.

Full Changelog: v0.0.7...v1.0.0