refactor: привести проект к стайлгайду

- Убран FC из всех шаблонов и компонентов
- Заменён interface на type, .interface.ts на .type.ts
- Добавлен паттерн Params/Props/RootAttrs в типы
- Деструктуризация пропсов перенесена в тело компонента
- Добавлены styles/ и types/ для feature, entity, widget, screen
- Добавлен расширенный JSDoc-шаблон с назначением и сценариями
- Исправлен баг в index.ts шаблона component
- Добавлены .editorconfig, .env.example
- Добавлен organizeImports.biome в .vscode/settings.json
- Исправлен .gitignore для .env.example
- Переписан README под проект-шаблон
- Удалён CLAUDE.md
This commit is contained in:
2026-04-02 17:01:22 +03:00
parent 9e2167b34d
commit 7382499886
24 changed files with 212 additions and 71 deletions

View File

@@ -1 +1 @@
export { {name.pascalCase} } from './{{name.kebabCase}}'
export { {{name.pascalCase}} } from './{{name.kebabCase}}'

View File

@@ -1,6 +0,0 @@
import type { HTMLAttributes } from 'react'
/**
* Параметры {{name.pascalCase}}.
*/
export interface {{name.pascalCase}}Props extends HTMLAttributes<HTMLDivElement> {}

View File

@@ -0,0 +1,11 @@
import type { HTMLAttributes } from 'react'
/**
* Параметры {{name.pascalCase}}.
*/
export type {{name.pascalCase}}Params = {}
/** HTML-атрибуты корневого элемента. */
type RootAttrs = HTMLAttributes<HTMLDivElement>
export type {{name.pascalCase}}Props = RootAttrs & {{name.pascalCase}}Params

View File

@@ -1,15 +1,20 @@
import type { FC } from 'react'
import cl from 'clsx'
import type { {{name.pascalCase}}Props } from './types/{{name.kebabCase}}.interface'
import type { {{name.pascalCase}}Props } from './types/{{name.kebabCase}}.type'
import styles from './styles/{{name.kebabCase}}.module.css'
/**
* {{name.pascalCase}}.
* <Назначение компонента {{name.pascalCase}} в 1 строке>.
*
* Используется для:
* - <сценарий 1>
* - <сценарий 2>
*/
export const {{name.pascalCase}}: FC<{{name.pascalCase}}Props> = ({ className, ...htmlAttr }) => {
export const {{name.pascalCase}} = (props: {{name.pascalCase}}Props) => {
const { children, className, ...htmlAttr } = props
return (
<div {...htmlAttr} className={cl(styles.root, className)}>
{{name.kebabCase}}
{children}
</div>
)
}

View File

@@ -0,0 +1,2 @@
.root {
}

View File

@@ -0,0 +1,11 @@
import type { HTMLAttributes } from 'react'
/**
* Параметры сущности {{name.pascalCase}}.
*/
export type {{name.pascalCase}}EntityParams = {}
/** HTML-атрибуты корневого элемента. */
type RootAttrs = HTMLAttributes<HTMLDivElement>
export type {{name.pascalCase}}EntityProps = RootAttrs & {{name.pascalCase}}EntityParams

View File

@@ -1,12 +1,20 @@
import type { FC } from 'react'
import cl from 'clsx'
import type { {{name.pascalCase}}EntityProps } from './types/{{name.kebabCase}}.type'
import styles from './styles/{{name.kebabCase}}.module.css'
/**
* Сущность {{name.pascalCase}}.
* <Назначение сущности {{name.pascalCase}} в 1 строке>.
*
* Используется для:
* - <сценарий 1>
* - <сценарий 2>
*/
export const {{name.pascalCase}}Entity: FC = () => {
export const {{name.pascalCase}}Entity = (props: {{name.pascalCase}}EntityProps) => {
const { children, className, ...htmlAttr } = props
return (
<div>
{{name.kebabCase}}
<div {...htmlAttr} className={cl(styles.root, className)}>
{children}
</div>
)
}

View File

@@ -0,0 +1,2 @@
.root {
}

View File

@@ -0,0 +1,11 @@
import type { HTMLAttributes } from 'react'
/**
* Параметры фичи {{name.pascalCase}}.
*/
export type {{name.pascalCase}}FeatureParams = {}
/** HTML-атрибуты корневого элемента. */
type RootAttrs = HTMLAttributes<HTMLDivElement>
export type {{name.pascalCase}}FeatureProps = RootAttrs & {{name.pascalCase}}FeatureParams

View File

@@ -1,12 +1,20 @@
import type { FC } from 'react'
import cl from 'clsx'
import type { {{name.pascalCase}}FeatureProps } from './types/{{name.kebabCase}}.type'
import styles from './styles/{{name.kebabCase}}.module.css'
/**
* Фича {{name.pascalCase}}.
* <Назначение фичи {{name.pascalCase}} в 1 строке>.
*
* Используется для:
* - <сценарий 1>
* - <сценарий 2>
*/
export const {{name.pascalCase}}Feature: FC = () => {
export const {{name.pascalCase}}Feature = (props: {{name.pascalCase}}FeatureProps) => {
const { children, className, ...htmlAttr } = props
return (
<div>
{{name.kebabCase}}
<div {...htmlAttr} className={cl(styles.root, className)}>
{children}
</div>
)
}

View File

@@ -1,6 +0,0 @@
/**
* Параметры {{name.pascalCase}}Layout.
*/
export interface {{name.pascalCase}}LayoutProps {
children: React.ReactNode
}

View File

@@ -0,0 +1,11 @@
import type { HTMLAttributes } from 'react'
/**
* Параметры {{name.pascalCase}}Layout.
*/
export type {{name.pascalCase}}LayoutParams = {}
/** HTML-атрибуты корневого элемента. */
type RootAttrs = HTMLAttributes<HTMLDivElement>
export type {{name.pascalCase}}LayoutProps = RootAttrs & {{name.pascalCase}}LayoutParams

View File

@@ -1,13 +1,19 @@
import type { FC } from 'react'
import type { {{name.pascalCase}}LayoutProps } from './types/{{name.kebabCase}}.interface'
import cl from 'clsx'
import type { {{name.pascalCase}}LayoutProps } from './types/{{name.kebabCase}}.type'
import styles from './styles/{{name.kebabCase}}.module.css'
/**
* Layout {{name.pascalCase}}.
* <Назначение layout {{name.pascalCase}} в 1 строке>.
*
* Используется для:
* - <сценарий 1>
* - <сценарий 2>
*/
export const {{name.pascalCase}}Layout: FC<{{name.pascalCase}}LayoutProps> = ({ children }) => {
export const {{name.pascalCase}}Layout = (props: {{name.pascalCase}}LayoutProps) => {
const { children, className, ...htmlAttr } = props
return (
<div className={styles.root}>
<div {...htmlAttr} className={cl(styles.root, className)}>
{children}
</div>
)

View File

@@ -0,0 +1,11 @@
import type { HTMLAttributes } from 'react'
/**
* Параметры экрана {{name.pascalCase}}.
*/
export type {{name.pascalCase}}ScreenParams = {}
/** HTML-атрибуты корневого элемента. */
type RootAttrs = HTMLAttributes<HTMLDivElement>
export type {{name.pascalCase}}ScreenProps = RootAttrs & {{name.pascalCase}}ScreenParams

View File

@@ -1,13 +1,20 @@
import type { FC } from 'react'
import cl from 'clsx'
import type { {{name.pascalCase}}ScreenProps } from './types/{{name.kebabCase}}.type'
import styles from './styles/{{name.kebabCase}}.module.css'
/**
* Экран {{name.pascalCase}}.
* <Назначение экрана {{name.pascalCase}} в 1 строке>.
*
* Используется для:
* - <сценарий 1>
* - <сценарий 2>
*/
export const {{name.pascalCase}}Screen: FC = () => {
export const {{name.pascalCase}}Screen = (props: {{name.pascalCase}}ScreenProps) => {
const { children, className, ...htmlAttr } = props
return (
<div className={styles.root}>
{{name.kebabCase}}
<div {...htmlAttr} className={cl(styles.root, className)}>
{children}
</div>
)
}

View File

@@ -0,0 +1,11 @@
import type { HTMLAttributes } from 'react'
/**
* Параметры виджета {{name.pascalCase}}.
*/
export type {{name.pascalCase}}WidgetParams = {}
/** HTML-атрибуты корневого элемента. */
type RootAttrs = HTMLAttributes<HTMLDivElement>
export type {{name.pascalCase}}WidgetProps = RootAttrs & {{name.pascalCase}}WidgetParams

View File

@@ -1,13 +1,20 @@
import type { FC } from 'react'
import cl from 'clsx'
import type { {{name.pascalCase}}WidgetProps } from './types/{{name.kebabCase}}.type'
import styles from './styles/{{name.kebabCase}}.module.css'
/**
* Виджет {{name.pascalCase}}.
* <Назначение виджета {{name.pascalCase}} в 1 строке>.
*
* Используется для:
* - <сценарий 1>
* - <сценарий 2>
*/
export const {{name.pascalCase}}Widget: FC = () => {
export const {{name.pascalCase}}Widget = (props: {{name.pascalCase}}WidgetProps) => {
const { children, className, ...htmlAttr } = props
return (
<div className={styles.root}>
{{name.kebabCase}}
<div {...htmlAttr} className={cl(styles.root, className)}>
{children}
</div>
)
}