From 4fb4d5fd697cfbcd325ac4945a5fd751e0a5c43f Mon Sep 17 00:00:00 2001 From: rex Date: Thu, 23 Oct 2025 19:39:58 +0800 Subject: [PATCH] lint --- .cursor/rules/general.mdc | 10 +++ .cursor/rules/project/general.mdc | 20 ------ .cursorignore | 7 ++ .trae/.ignore | 2 + .trae/rules/project_rules.md | 0 README.md | 72 ++----------------- .../.cursor/rules/assets_rules.mdc | 3 +- src/assets/.cursor/rules/assets_rules.mdc | 4 ++ .../.cursor/rules/components_rules.mdc | 14 ++++ src/components/Example/index.tsx | 3 + src/components/index.ts | 1 + src/components/react.svg | 1 + src/pages/.cursor/rules/pages_rules.mdc | 6 +- .../.cursor/rules/providers_rules.mdc | 5 ++ src/store/.cursor/rules/store_rules.mdc | 6 +- src/styles/.cursor/rules/style_rules.mdc | 5 ++ 16 files changed, 63 insertions(+), 96 deletions(-) create mode 100644 .cursor/rules/general.mdc delete mode 100644 .cursor/rules/project/general.mdc create mode 100644 .cursorignore create mode 100644 .trae/.ignore create mode 100644 .trae/rules/project_rules.md rename .cursor/rules/project/style.mdc => public/.cursor/rules/assets_rules.mdc (50%) create mode 100644 src/assets/.cursor/rules/assets_rules.mdc create mode 100644 src/components/.cursor/rules/components_rules.mdc create mode 100644 src/components/Example/index.tsx create mode 100644 src/components/index.ts create mode 100644 src/components/react.svg create mode 100644 src/providers/.cursor/rules/providers_rules.mdc create mode 100644 src/styles/.cursor/rules/style_rules.mdc diff --git a/.cursor/rules/general.mdc b/.cursor/rules/general.mdc new file mode 100644 index 0000000..e736d0d --- /dev/null +++ b/.cursor/rules/general.mdc @@ -0,0 +1,10 @@ +--- +description: +globs: +alwaysApply: true +--- + + +- Always respond in 中文 +- 只能新增、修改和删除 src 目录里的文件或者文件夹,严禁修改其他文件或者文件夹! +- \ No newline at end of file diff --git a/.cursor/rules/project/general.mdc b/.cursor/rules/project/general.mdc deleted file mode 100644 index ccbfa0f..0000000 --- a/.cursor/rules/project/general.mdc +++ /dev/null @@ -1,20 +0,0 @@ ---- -description: -globs: -alwaysApply: false ---- - - - -@tailwindcss -localforage -lodash-es -motion -react -react-dom -react-router -tailwindcss -zustand -dayjs -Axios -react-icons \ No newline at end of file diff --git a/.cursorignore b/.cursorignore new file mode 100644 index 0000000..4ed5891 --- /dev/null +++ b/.cursorignore @@ -0,0 +1,7 @@ +.npmrc +biome.json +index.html +pnpm-lock.yaml +.trae/ +!src/ +.cursor/ \ No newline at end of file diff --git a/.trae/.ignore b/.trae/.ignore new file mode 100644 index 0000000..7b89ef8 --- /dev/null +++ b/.trae/.ignore @@ -0,0 +1,2 @@ +!src/** +!public/** \ No newline at end of file diff --git a/.trae/rules/project_rules.md b/.trae/rules/project_rules.md new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md index 7959ce4..95dc19b 100644 --- a/README.md +++ b/README.md @@ -1,69 +1,5 @@ -# React + TypeScript + Vite +# Mujian 作品模版工程 -This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. - -Currently, two official plugins are available: - -- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh - -## Expanding the ESLint configuration - -If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules: - -```js -export default tseslint.config([ - globalIgnores(['dist']), - { - files: ['**/*.{ts,tsx}'], - extends: [ - // Other configs... - - // Remove tseslint.configs.recommended and replace with this - ...tseslint.configs.recommendedTypeChecked, - // Alternatively, use this for stricter rules - ...tseslint.configs.strictTypeChecked, - // Optionally, add this for stylistic rules - ...tseslint.configs.stylisticTypeChecked, - - // Other configs... - ], - languageOptions: { - parserOptions: { - project: ['./tsconfig.node.json', './tsconfig.app.json'], - tsconfigRootDir: import.meta.dirname, - }, - // other options... - }, - }, -]) -``` - -You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules: - -```js -// eslint.config.js -import reactX from 'eslint-plugin-react-x' -import reactDom from 'eslint-plugin-react-dom' - -export default tseslint.config([ - globalIgnores(['dist']), - { - files: ['**/*.{ts,tsx}'], - extends: [ - // Other configs... - // Enable lint rules for React - reactX.configs['recommended-typescript'], - // Enable lint rules for React DOM - reactDom.configs.recommended, - ], - languageOptions: { - parserOptions: { - project: ['./tsconfig.node.json', './tsconfig.app.json'], - tsconfigRootDir: import.meta.dirname, - }, - // other options... - }, - }, -]) -``` +[幕间官网](https://mujian.ai) +[幕间文档站](https://docs.mujian.ai) +[幕间SDK](https://docs.mujian.ai/creator/sdk/introduction.html) diff --git a/.cursor/rules/project/style.mdc b/public/.cursor/rules/assets_rules.mdc similarity index 50% rename from .cursor/rules/project/style.mdc rename to public/.cursor/rules/assets_rules.mdc index b93c988..366f035 100644 --- a/.cursor/rules/project/style.mdc +++ b/public/.cursor/rules/assets_rules.mdc @@ -1,5 +1,4 @@ --- -description: -globs: +description: Public 模版 alwaysApply: false --- diff --git a/src/assets/.cursor/rules/assets_rules.mdc b/src/assets/.cursor/rules/assets_rules.mdc new file mode 100644 index 0000000..c42af90 --- /dev/null +++ b/src/assets/.cursor/rules/assets_rules.mdc @@ -0,0 +1,4 @@ +--- +description: assets 模版 +alwaysApply: false +--- diff --git a/src/components/.cursor/rules/components_rules.mdc b/src/components/.cursor/rules/components_rules.mdc new file mode 100644 index 0000000..9e43cae --- /dev/null +++ b/src/components/.cursor/rules/components_rules.mdc @@ -0,0 +1,14 @@ +--- +description: Common Components 公共组件 +globs: ["**/*.ts", "**/*.tsx"] +alwaysApply: Auto Attached +--- + +本规则为前端组件制定规范: + +在 components 目录工作时: + +样式统一使用 Tailwind +动画使用 Framer Motion +遵循组件命名约定 +本规则同时对 API 端点实施校验: \ No newline at end of file diff --git a/src/components/Example/index.tsx b/src/components/Example/index.tsx new file mode 100644 index 0000000..c300aaf --- /dev/null +++ b/src/components/Example/index.tsx @@ -0,0 +1,3 @@ +export const Example = () => { + return
Example
; +}; \ No newline at end of file diff --git a/src/components/index.ts b/src/components/index.ts new file mode 100644 index 0000000..65c511b --- /dev/null +++ b/src/components/index.ts @@ -0,0 +1 @@ +export * from './Example'; \ No newline at end of file diff --git a/src/components/react.svg b/src/components/react.svg new file mode 100644 index 0000000..6c87de9 --- /dev/null +++ b/src/components/react.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/pages/.cursor/rules/pages_rules.mdc b/src/pages/.cursor/rules/pages_rules.mdc index b93c988..6376614 100644 --- a/src/pages/.cursor/rules/pages_rules.mdc +++ b/src/pages/.cursor/rules/pages_rules.mdc @@ -1,5 +1,5 @@ --- -description: -globs: -alwaysApply: false +description: 页面模版 +globs: ["**/*.ts", "**/*.tsx"] +alwaysApply: Auto Attached --- diff --git a/src/providers/.cursor/rules/providers_rules.mdc b/src/providers/.cursor/rules/providers_rules.mdc new file mode 100644 index 0000000..ca17b3f --- /dev/null +++ b/src/providers/.cursor/rules/providers_rules.mdc @@ -0,0 +1,5 @@ +--- +description: Provider 模版 +globs: ["**/*.ts", "**/*.tsx"] +alwaysApply: Auto Attached +--- diff --git a/src/store/.cursor/rules/store_rules.mdc b/src/store/.cursor/rules/store_rules.mdc index b93c988..58d241c 100644 --- a/src/store/.cursor/rules/store_rules.mdc +++ b/src/store/.cursor/rules/store_rules.mdc @@ -1,5 +1,5 @@ --- -description: -globs: -alwaysApply: false +description: Zustand store 模版 +globs: ["**/*.ts", "**/*.tsx"] +alwaysApply: Auto Attached --- diff --git a/src/styles/.cursor/rules/style_rules.mdc b/src/styles/.cursor/rules/style_rules.mdc new file mode 100644 index 0000000..b322abd --- /dev/null +++ b/src/styles/.cursor/rules/style_rules.mdc @@ -0,0 +1,5 @@ +--- +description: CSS 样式模版 +globs: ["**/*.css"] +alwaysApply: Auto Attached +---