Skip to content

Commit

Permalink
Merge pull request #8 from yourssu/feat/component-definition
Browse files Browse the repository at this point in the history
함수 작성 방식 통일을 위한 eslint rule 추가
  • Loading branch information
nijuy authored Oct 1, 2023
2 parents 4e12178 + 546b655 commit 42c1f39
Show file tree
Hide file tree
Showing 8 changed files with 221 additions and 16 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ module.exports = {
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh', 'prettier'],
plugins: ['react-refresh', 'react', 'prettier'],
rules: {
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
'prettier/prettier': ['error', { endOfLine: 'auto' }],
'react/react-in-jsx-scope': 'off',
'react/function-component-definition': [2, { namedComponents: 'arrow-function' }],
'import/no-unresolved': 'off',
'import/order': [
'error',
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.3",
"eslint-plugin-storybook": "^0.6.13",
Expand Down
4 changes: 2 additions & 2 deletions src/components/Badge/Badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { IconContext } from '@/style';
import { StyledBadge } from './Badge.style';
import { BadgeProps } from './Badge.type';

function Badge({ color = 'monoItemBG', children = 'Badge', leftIcon }: BadgeProps) {
const Badge = ({ color = 'monoItemBG', children = 'Badge', leftIcon }: BadgeProps) => {
return (
<StyledBadge
style={{
Expand All @@ -24,6 +24,6 @@ function Badge({ color = 'monoItemBG', children = 'Badge', leftIcon }: BadgeProp
{children}
</StyledBadge>
);
}
};

export { Badge };
4 changes: 2 additions & 2 deletions src/components/YDSWrapper/YDSWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ export type YDSWrapperProps = {
* YDS에 사용되는 Context, Style을 위한 컴포넌트입니다.
* YDS를 사용하는 프로젝트의 최상위 컴포넌트로 사용해야 합니다.
*/
export function YDSWrapper({ children }: YDSWrapperProps) {
export const YDSWrapper = ({ children }: YDSWrapperProps) => {
return (
<>
<GlobalStyles />
<YDSProvider>{children}</YDSProvider>
</>
);
}
};
4 changes: 2 additions & 2 deletions src/contexts/YDSProvider/YDSProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ export type YDSProviderProps = {
* @param param0
* @returns
*/
export function YDSProvider({ children, fixedColorTheme }: YDSProviderProps) {
export const YDSProvider = ({ children, fixedColorTheme }: YDSProviderProps) => {
return (
<ColorThemeContextProvider fixedColorTheme={fixedColorTheme}>
<YDSThemeProvider>{children}</YDSThemeProvider>
</ColorThemeContextProvider>
);
}
};
6 changes: 3 additions & 3 deletions src/hooks/useColorTheme/ColorTheme.context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ export interface ColorThemeContextProviderProps {
fixedColorTheme?: CurrentTheme;
}

export function ColorThemeContextProvider({
export const ColorThemeContextProvider = ({
children,
fixedColorTheme: fixedTheme,
}: ColorThemeContextProviderProps) {
}: ColorThemeContextProviderProps) => {
const [SelectedTheme, setSelectedTheme] = useState<SelectedColorTheme>('system');

useEffect(() => {
Expand Down Expand Up @@ -86,4 +86,4 @@ export function ColorThemeContextProvider({
{children}
</ColorThemeContext.Provider>
);
}
};
4 changes: 2 additions & 2 deletions src/style/theme/YDSThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { YDSTheme } from './theme.type';
export interface YDSThemeProviderProps {
children?: React.ReactNode;
}
export function YDSThemeProvider({ children }: YDSThemeProviderProps) {
export const YDSThemeProvider = ({ children }: YDSThemeProviderProps) => {
const { currentColorTheme } = useColorTheme();

const theme: YDSTheme = useMemo(() => {
Expand All @@ -33,4 +33,4 @@ export function YDSThemeProvider({ children }: YDSThemeProviderProps) {
}, [currentColorTheme]);

return <ThemeProvider theme={theme}>{children}</ThemeProvider>;
}
};
Loading

0 comments on commit 42c1f39

Please sign in to comment.