Skip to content

Commit

Permalink
Merge pull request #105 from mediamonks/bugfix/plop-template-stories-…
Browse files Browse the repository at this point in the history
…file

Bugfix/plop template
  • Loading branch information
AlenaAlyona authored Mar 24, 2023
2 parents 0f1f9ba + 3fcbf83 commit 0485017
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion plop-templates/hook/{{camelCase hookName}}.stories.tsx.hbs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import type { StoryObj } from '@storybook/react';
import type { ReactElement } from 'react';
import { {{camelCase hookName}} } from './{{camelCase hookName}}.js';

export default {
title: 'hooks/{{camelCase hookName}}',
};

function DemoComponent() {
function DemoComponent(): ReactElement {
{{camelCase hookName}}();

return (
Expand Down
2 changes: 1 addition & 1 deletion plop-templates/hook/{{camelCase hookName}}.test.tsx.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { renderHook } from '@testing-library/react';
import { {{camelCase hookName}} } from './{{camelCase hookName}.js';
import { {{camelCase hookName}} } from './{{camelCase hookName}}.js';

describe('{{camelCase hookName}}', () => {
it('should not crash', async () => {
Expand Down
4 changes: 2 additions & 2 deletions plopfile.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ module.exports = function (plop) {
type: 'addMany',
base: 'plop-templates/hook',
templateFiles: 'plop-templates/hook/*.*',
destination: `src/{{camelCase hookName}}/`,
destination: `src/hooks/{{camelCase hookName}}/`,
},
{
type: 'append',
path: 'src/index.ts',
pattern: /(\/\* PLOP_ADD_EXPORT \*\/)/gi,
template: `export * from './{{camelCase hookName}}/{{camelCase hookName}}';`,
template: `export * from './hooks/{{camelCase hookName}}/{{camelCase hookName}}.js';`,
},
];
},
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useHasFocus/useHasFocus.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable react/jsx-no-literals */
/* eslint-disable react/no-multi-comp */
import { act, render, waitFor } from '@testing-library/react';
import { act, render } from '@testing-library/react';
import { useRef, type ReactElement } from 'react';
import { useHasFocus } from './useHasFocus.js';

Expand Down

0 comments on commit 0485017

Please sign in to comment.