Releases: tatethurston/eslint-plugin-react-prefer-function-component
v5.0.0
v5.0.0
allowComponentDidCatchhas been replaced withallowErrorBoundary. LikeallowComponentDidCatch,allowErrorBoundarydefaults to true, butallowErrorBoundaryallows class components that usecomponentDidCatchand/orgetDerivedStateFromError. No change is required if you're using the defaults for this lint rule. If you've disabledallowComponentDidCatch, you'll need to make the following change:
rules: {
"react-prefer-function-component/react-prefer-function-component": [
"error",
- { allowComponentDidCatch: false },
+ { allowErrorBoundary: false },
],
},See #29, thanks @henryqdineen!
New Contributors
- @henryqdineen made their first contribution in #29
Full Changelog: v4.0.1...v5.0.0
v4.0.1
v4.0.0
What's Changed
- Add
react-prefix to the flat configuration rule name. When using ESLint's flat configuration, the exported configuration from this package now "react-prefer-function-component". Previously it was "prefer-function-component". Practically speaking, no changes are expected from consumers of this package.
Action would only be necessary if there is an existing plugin in your ESLint configuration using the "react-prefer-function-component" name, or if you're programmatically processing your ESLint configuration and expecting to find "prefer-function-component".
See #20. Thanks @MariaSolOs!
New Contributors
- @MariaSolOs made their first contribution in #20
Full Changelog: v3.4.0...v4.0.0
v3.4.0
What's Changed
- Improved TypeScript type for the configuration object. See #17. Thanks @PrettyCoffee!
New Contributors
- @PrettyCoffee made their first contribution in #17
Full Changelog: v3.3.0...v3.3.1
v3.3.0
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
v3.2.0
-
The plugin's recommended configuration has been fixed, so
pluginscan be dropped from your.eslintrcwhen 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
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
Full Changelog: v3.0.0...v3.1.0
v3.0.0
What's Changed
- Detects
classcomponents that extend theComponentclass, even if they do not use any JSX. Now errors on manager, business logic, and other renderlessclasscomponents that extendComponent. 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
Full Changelog: v2.0.0...v3.0.0
v2.0.0
What's Changed
- Support for
createClassfrom React has been dropped. Usage ofcreateClasswill 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
What's Changed
- Support for
createClassfrom React has been dropped. Usage ofcreateClasswill 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