Skip to content

Commit

Permalink
feat: storybook
Browse files Browse the repository at this point in the history
  • Loading branch information
lixiaowei11111 committed Nov 15, 2023
1 parent 38235d5 commit 02f7219
Show file tree
Hide file tree
Showing 39 changed files with 26,156 additions and 19,099 deletions.
18 changes: 10 additions & 8 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ module.exports = {
node: true,
},
extends: [
"eslint:recommended", //使用 ESLint 推荐的规则。
"plugin:@typescript-eslint/recommended", //使用 TypeScript ESLint 推荐的规则。
"plugin:react/recommended", // 使用 React ESLint 推荐的规则。
"plugin:react-hooks/recommended",
"prettier",
"plugin:prettier/recommended", //使用 Prettier 推荐的规则。
// 'prettier/@typescript-eslint',// 解决 Prettier 和 TypeScript ESLint 规则之间的冲突。其本身被融合到 'prettier'中
],
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"prettier",
"plugin:prettier/recommended",
"plugin:storybook/recommended"
],
plugins: ["@typescript-eslint", "react", "prettier", "babel"],
rules: {
// ESLint Rules
Expand All @@ -42,11 +42,13 @@ module.exports = {
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/no-unused-vars": [0, { argsIgnorePattern: "^_" }],
"@typescript-eslint/no-non-null-assertion": 0, // 非空断言
"@typescript-eslint/consistent-type-definitions": "error",
// 启用 TypeScript 下的未使用变量规则,忽略以 _ 开头的变量。

// React Rules
"react/prop-types": 0, // 关闭对 PropTypes 的检查。
"react/react-in-jsx-scope": 0, // react18 中 jsx语法不再需要引入react
"react/self-closing-comp": "error", // 自闭合标签

// Prettier Rules
"prettier/prettier": 2, // 将 Prettier 错误视为 ESLint 错误。
Expand Down
19 changes: 19 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { StorybookConfig } from "@storybook/react-webpack5";

const config: StorybookConfig = {
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-onboarding",
"@storybook/addon-interactions",
],
framework: {
name: "@storybook/react-webpack5",
options: {},
},
docs: {
autodocs: "tag",
},
};
export default config;
15 changes: 15 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { Preview } from "@storybook/react";

const preview: Preview = {
parameters: {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
};

export default preview;
15 changes: 15 additions & 0 deletions ErrorLog/005_20231109.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
+ `TypeScript` 重写三方库中的某个属性
```TypeScript
// 三方库interface
interface abb {
children: string;
}

type ybb = Omit<abb, 'children'> & {
children: number[];
};
const a: ybb = {
children: [131313],
};

```
Loading

0 comments on commit 02f7219

Please sign in to comment.