Skip to content

Commit e7d9f48

Browse files
author
Antoine Le Louet
committed
eslint fix
1 parent ff4a26b commit e7d9f48

File tree

3 files changed

+34
-25
lines changed

3 files changed

+34
-25
lines changed
Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
import type { Meta, StoryObj } from '@storybook/react';
2-
import LocaleSelector from "@components/theme/LocaleSelector";
3-
import { Locale } from "@lib/locale-resolver/LocaleResolver";
2+
import LocaleSelector from '@components/theme/LocaleSelector';
3+
import { Locale } from '@lib/locale-resolver/LocaleResolver';
44

55
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
6-
const meta = {
6+
const meta: Meta<typeof LocaleSelector> = {
77
title: 'Components/LocaleSelector',
88
component: LocaleSelector,
99
parameters: {
10-
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/react/configure/story-layout
10+
// Optional parameter to center the component in the Canvas.
11+
// More info: https://storybook.js.org/docs/react/configure/story-layout
1112
layout: 'centered',
1213
},
13-
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
14+
// This component will have an automatically generated Autodocs entry:
15+
// https://storybook.js.org/docs/react/writing-docs/autodocs
1416
tags: ['autodocs'],
1517
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
1618
argTypes: {
@@ -23,16 +25,18 @@ const meta = {
2325
export default meta;
2426
type Story = StoryObj<typeof meta>;
2527

26-
const local_FR = { code: 'fr', name: 'Français' } as Locale;
27-
const local_EN = { code: 'en', name: 'English' } as Locale;
28+
const LOCAL_FR: Locale = { code: 'fr', name: 'Français' } as Locale;
29+
const LOCAL_EN: Locale = { code: 'en', name: 'English' } as Locale;
2830

2931
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
3032
export const Test: Story = {
3133
args: {
32-
availableLocales: [local_FR, local_EN],
34+
availableLocales: [LOCAL_FR, LOCAL_EN],
3335
onLocaleSelected: () => {
36+
// We can't use action here because it's a sample component
37+
// eslint-disable-next-line no-console
3438
console.log('btn click');
3539
},
36-
currentLocale: local_FR,
40+
currentLocale: LOCAL_FR,
3741
},
3842
};

templates/front/src/stories/example/button/Button.stories.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@ import type { Meta, StoryObj } from '@storybook/react';
33
import { Button } from './Button';
44

55
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
6-
const meta = {
6+
const meta: Meta<typeof Button> = {
77
title: 'Example/Button',
88
component: Button,
99
parameters: {
10-
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/react/configure/story-layout
10+
// Optional parameter to center the component in the Canvas.
11+
// More info: https://storybook.js.org/docs/react/configure/story-layout
1112
layout: 'centered',
1213
},
13-
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
14+
// This component will have an automatically generated Autodocs entry:
15+
// https://storybook.js.org/docs/react/writing-docs/autodocs
1416
tags: ['autodocs'],
1517
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
1618
argTypes: {

templates/front/src/stories/example/button/Button.tsx

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,39 @@ interface ButtonProps {
55
/**
66
* Is this the principal call to action on the page?
77
*/
8-
primary?: boolean;
8+
primary?: boolean,
99
/**
1010
* What background color to use
1111
*/
12-
backgroundColor?: string;
12+
backgroundColor?: string,
1313
/**
1414
* How large should the button be?
1515
*/
16-
size?: 'small' | 'medium' | 'large';
16+
size?: 'small' | 'medium' | 'large',
1717
/**
1818
* Button contents
1919
*/
20-
label: string;
20+
label: string,
2121
/**
2222
* Optional click handler
2323
*/
24-
onClick?: () => void;
24+
onClick?: () => void,
2525
}
2626

2727
/**
2828
* Primary UI component for user interaction
2929
*/
30-
export const Button = ({
31-
primary = false,
32-
size = 'medium',
33-
backgroundColor,
34-
label,
35-
...props
36-
}: ButtonProps) => {
37-
const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
30+
// eslint-disable-next-line import/prefer-default-export
31+
export const Button = (
32+
{
33+
primary = false,
34+
size = 'medium',
35+
backgroundColor,
36+
label,
37+
...props
38+
}: ButtonProps,
39+
) => {
40+
const mode: string = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
3841
return (
3942
<button
4043
type="button"

0 commit comments

Comments
 (0)