From 8c770f8d853783c2abcfe40ca59e356641b5ab08 Mon Sep 17 00:00:00 2001 From: Dima Vyshniakov Date: Mon, 18 Dec 2023 13:32:47 +0100 Subject: [PATCH] improve template --- .eslintrc.cjs | 10 ++++++++ templates/Component/TemplateName.stories.tsx | 25 ++++++++++++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index fab5b3c..e459c01 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -160,5 +160,15 @@ module.exports = { ], }, }, + /** + * Disable rules of hooks for story files in order to have better story code display. + * @see TemplateName.stories.tsx + */ + { + files: ['**/*.stories.*'], + rules: { + 'react-hooks/rules-of-hooks': 'off', + }, + }, ], }; diff --git a/templates/Component/TemplateName.stories.tsx b/templates/Component/TemplateName.stories.tsx index 5148993..97dccce 100644 --- a/templates/Component/TemplateName.stories.tsx +++ b/templates/Component/TemplateName.stories.tsx @@ -15,7 +15,28 @@ export default meta; type Story = StoryObj; export const Primary: Story = { - args: { - initialValue: 0, + render: args => { + return ; + }, + args: {}, +}; + +export const WithCode: Story = { + render: args => { + // here comes the code + return ; + }, +}; + +WithCode.args = {}; + +WithCode.argTypes = {}; + +WithCode.parameters = { + docs: { + source: { + language: 'tsx', + type: 'code', + }, }, };