From 3758eb01c0a5db1c33f41b0654da317d024fba0a Mon Sep 17 00:00:00 2001
From: Toshihisa Tomatsu
Date: Wed, 25 Mar 2020 01:26:06 +0900
Subject: [PATCH] feat: enables airbnb/hooks (#33)
BREAKING CHANGE: enables airbnb/hooks
---
index.js | 1 +
test/sample.tsx | 16 +++++++++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/index.js b/index.js
index 77ea06c..3c7a83a 100644
--- a/index.js
+++ b/index.js
@@ -13,6 +13,7 @@ module.exports = {
},
extends: [
"airbnb",
+ "airbnb/hooks",
"plugin:@typescript-eslint/recommended",
"prettier",
"prettier/react",
diff --git a/test/sample.tsx b/test/sample.tsx
index 35db0ba..80e47b2 100644
--- a/test/sample.tsx
+++ b/test/sample.tsx
@@ -13,7 +13,21 @@ const ComponentWithProps: FC = ({ name, age }) => (
);
+const ComponentWithHooks = () => {
+ const [count, setCount] = React.useState(0);
+ React.useEffect(() => {
+ const n = count + 1;
+ setCount(n);
+ }, [count]);
+ return (
+
+ );
+};
+
export default {
Component,
- ComponentWithProps
+ ComponentWithProps,
+ ComponentWithHooks
};