dnhyxc-ui-vue 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/.prettierrc.json +22 -0
  2. package/docs/.vitepress/config.mts +55 -0
  3. package/docs/.vitepress/theme/index.ts +30 -0
  4. package/docs/.vitepress/theme/style.css +130 -0
  5. package/docs/api-examples.md +49 -0
  6. package/docs/auto-imports.d.ts +10 -0
  7. package/docs/components/icon.md +75 -0
  8. package/docs/components.d.ts +13 -0
  9. package/docs/guide/installation.md +1 -0
  10. package/docs/guide/quick-start.md +1 -0
  11. package/docs/index.md +24 -0
  12. package/docs/markdown-examples.md +85 -0
  13. package/docs/package.json +30 -0
  14. package/docs/vite.config.ts +20 -0
  15. package/eslint.config.mjs +90 -0
  16. package/package.json +78 -0
  17. package/packages/components/button/index.ts +13 -0
  18. package/packages/components/button/src/button.ts +20 -0
  19. package/packages/components/button/src/button.vue +39 -0
  20. package/packages/components/button/src/index.scss +3 -0
  21. package/packages/components/icon/index.ts +14 -0
  22. package/packages/components/icon/src/icon.ts +16 -0
  23. package/packages/components/icon/src/icon.vue +35 -0
  24. package/packages/components/icon2/index.ts +14 -0
  25. package/packages/components/icon2/src/icon2.ts +16 -0
  26. package/packages/components/icon2/src/icon2.vue +35 -0
  27. package/packages/components/index.ts +5 -0
  28. package/packages/components/input/index.ts +13 -0
  29. package/packages/components/input/src/index.scss +3 -0
  30. package/packages/components/input/src/input.ts +22 -0
  31. package/packages/components/input/src/input.vue +50 -0
  32. package/packages/components/monaco/index.ts +8 -0
  33. package/packages/components/monaco/src/custom.ts +124 -0
  34. package/packages/components/monaco/src/index.scss +235 -0
  35. package/packages/components/monaco/src/monaco.ts +46 -0
  36. package/packages/components/monaco/src/monaco.vue +472 -0
  37. package/packages/components/package.json +29 -0
  38. package/packages/components/tsconfig.json +34 -0
  39. package/packages/components/tsconfig.tsbuildinfo +1 -0
  40. package/packages/script/build/build.ts +90 -0
  41. package/packages/script/build/buildfull.ts +77 -0
  42. package/packages/script/build/external.ts +21 -0
  43. package/packages/script/build/index.ts +22 -0
  44. package/packages/script/utils/delPath.ts +30 -0
  45. package/packages/script/utils/paths.ts +7 -0
  46. package/packages/theme/gulpfile.js +41 -0
  47. package/packages/theme/package.json +16 -0
  48. package/packages/theme/src/icon.scss +8 -0
  49. package/packages/theme/src/icon2.scss +8 -0
  50. package/packages/theme/src/index.scss +2 -0
  51. package/packages/theme/src/mixins/config.scss +4 -0
  52. package/packages/theme/src/mixins/mixins.scss +80 -0
  53. package/packages/utils/bem.ts +60 -0
  54. package/packages/utils/index.ts +2 -0
  55. package/packages/utils/package.json +16 -0
  56. package/packages/utils/vite.config.ts +61 -0
  57. package/packages/utils/with-install.ts +12 -0
  58. package/play/.vscode/extensions.json +3 -0
  59. package/play/README.md +5 -0
  60. package/play/auto-imports.d.ts +10 -0
  61. package/play/components.d.ts +14 -0
  62. package/play/index.html +13 -0
  63. package/play/package.json +30 -0
  64. package/play/public/vite.svg +1 -0
  65. package/play/src/App.vue +32 -0
  66. package/play/src/assets/vue.svg +1 -0
  67. package/play/src/components/MyInput.vue +25 -0
  68. package/play/src/main.ts +12 -0
  69. package/play/src/vite-env.d.ts +7 -0
  70. package/play/tsconfig.app.json +14 -0
  71. package/play/tsconfig.json +7 -0
  72. package/play/tsconfig.node.json +24 -0
  73. package/play/vite.config.ts +20 -0
  74. package/pnpm-workspace.yaml +5 -0
  75. package/tsconfig.json +35 -0
@@ -0,0 +1,22 @@
1
+ {
2
+ "printWidth": 120,
3
+ "tabWidth": 2,
4
+ "useTabs": false,
5
+ "semi": true,
6
+ "singleQuote": true,
7
+ "quoteProps": "as-needed",
8
+ "trailingComma": "none",
9
+ "jsxSingleQuote": false,
10
+ "bracketSpacing": true,
11
+ "jsxBracketSameLine": false,
12
+ "arrowParens": "always",
13
+ "rangeStart": 0,
14
+ "requirePragma": false,
15
+ "insertPragma": false,
16
+ "proseWrap": "preserve",
17
+ "htmlWhitespaceSensitivity": "css",
18
+ "vueIndentScriptAndStyle": false,
19
+ "endOfLine": "lf",
20
+ "embeddedLanguageFormatting": "auto",
21
+ "singleAttributePerLine": false
22
+ }
@@ -0,0 +1,55 @@
1
+ // import { demoBlockPlugin } from 'vitepress-theme-demoblock';
2
+ import { defineConfig } from 'vitepress';
3
+ // import { fileURLToPath, URL } from 'node:url';
4
+ import { demoPreviewPlugin } from '@vitepress-code-preview/plugin';
5
+
6
+ export default defineConfig({
7
+ title: 'dnhyxc-ui',
8
+ description: 'Vue3 UI Component',
9
+ themeConfig: {
10
+ outline: {
11
+ label: '页面导航'
12
+ },
13
+ docFooter: {
14
+ prev: '上一页',
15
+ next: '下一页'
16
+ },
17
+ footer: {
18
+ message: 'Released under the MIT License.',
19
+ copyright: 'Copyright © 2023-present dnhyxc'
20
+ },
21
+ sidebar: {
22
+ '/guide/': [
23
+ {
24
+ text: '指南',
25
+ items: [
26
+ { text: '安装', link: '/guide/installation' },
27
+ { text: '快速上手', link: '/guide/quick-start' }
28
+ ]
29
+ }
30
+ ],
31
+ '/components/': [
32
+ {
33
+ text: '组件',
34
+ items: [{ text: 'Icon 图标', link: '/components/icon' }]
35
+ }
36
+ ]
37
+ },
38
+ nav: [
39
+ { text: '指南', link: '/guide/installation' },
40
+ { text: '组件', link: '/components/icon' }
41
+ ],
42
+ socialLinks: [
43
+ {
44
+ icon: 'github',
45
+ link: 'https://github.com/dnhyxc/dnhyxc-ui-vue'
46
+ }
47
+ ]
48
+ },
49
+ markdown: {
50
+ config(md) {
51
+ // const docRoot = fileURLToPath(new URL('../', import.meta.url));
52
+ md.use(demoPreviewPlugin);
53
+ }
54
+ }
55
+ });
@@ -0,0 +1,30 @@
1
+ // https://vitepress.dev/guide/custom-theme
2
+ import { h } from 'vue';
3
+ import type { Theme } from 'vitepress';
4
+ import DefaultTheme from 'vitepress/theme';
5
+ import { NIcon, NButton, NInput } from 'dnhyxc-ui';
6
+ import ElementPlus from 'element-plus';
7
+ import 'dnhyxc-ui-plus/dist/index.css';
8
+ import DemoPreview, { useComponents } from '@vitepress-code-preview/container';
9
+ // import { demoBlockPlugin } from 'vitepress-theme-demoblock';
10
+ // import 'vitepress-theme-demoblock/dist/theme/styles/index.css';
11
+ import '@vitepress-code-preview/container/dist/style.css';
12
+
13
+ import './style.css';
14
+
15
+ export default {
16
+ extends: DefaultTheme,
17
+ Layout: () => {
18
+ return h(DefaultTheme.Layout, null, {
19
+ // https://vitepress.dev/guide/extending-default-theme#layout-slots
20
+ });
21
+ },
22
+ enhanceApp({ app, router, siteData }) {
23
+ useComponents(app, DemoPreview);
24
+ DefaultTheme.enhanceApp({ app, router, siteData });
25
+ app.component('NIcon', NIcon);
26
+ app.component('NButton', NButton);
27
+ app.component('NInput', NInput);
28
+ app.use(ElementPlus);
29
+ }
30
+ } satisfies Theme;
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Customize default theme styling by overriding CSS variables:
3
+ * https://github.com/vuejs/vitepress/blob/main/src/client/theme-default/styles/vars.css
4
+ */
5
+
6
+ /**
7
+ * Colors
8
+ *
9
+ * Each colors have exact same color scale system with 3 levels of solid
10
+ * colors with different brightness, and 1 soft color.
11
+ *
12
+ * - `XXX-1`: The most solid color used mainly for colored text. It must
13
+ * satisfy the contrast ratio against when used on top of `XXX-soft`.
14
+ *
15
+ * - `XXX-2`: The color used mainly for hover state of the button.
16
+ *
17
+ * - `XXX-3`: The color for solid background, such as bg color of the button.
18
+ * It must satisfy the contrast ratio with pure white (#ffffff) text on
19
+ * top of it.
20
+ *
21
+ * - `XXX-soft`: The color used for subtle background such as custom container
22
+ * or badges. It must satisfy the contrast ratio when putting `XXX-1` colors
23
+ * on top of it.
24
+ *
25
+ * The soft color must be semi transparent alpha channel. This is crucial
26
+ * because it allows adding multiple "soft" colors on top of each other
27
+ * to create a accent, such as when having inline code block inside
28
+ * custom containers.
29
+ *
30
+ * - `default`: The color used purely for subtle indication without any
31
+ * special meanings attached to it such as bg color for menu hover state.
32
+ *
33
+ * - `brand`: Used for primary brand colors, such as link text, button with
34
+ * brand theme, etc.
35
+ *
36
+ * - `tip`: Used to indicate useful information. The default theme uses the
37
+ * brand color for this by default.
38
+ *
39
+ * - `warning`: Used to indicate warning to the users. Used in custom
40
+ * container, badges, etc.
41
+ *
42
+ * - `danger`: Used to show error, or dangerous message to the users. Used
43
+ * in custom container, badges, etc.
44
+ * -------------------------------------------------------------------------- */
45
+
46
+ :root {
47
+ --vp-c-default-1: var(--vp-c-gray-1);
48
+ --vp-c-default-2: var(--vp-c-gray-2);
49
+ --vp-c-default-3: var(--vp-c-gray-3);
50
+ --vp-c-default-soft: var(--vp-c-gray-soft);
51
+
52
+ --vp-c-brand-1: var(--vp-c-indigo-1);
53
+ --vp-c-brand-2: var(--vp-c-indigo-2);
54
+ --vp-c-brand-3: var(--vp-c-indigo-3);
55
+ --vp-c-brand-soft: var(--vp-c-indigo-soft);
56
+
57
+ --vp-c-tip-1: var(--vp-c-brand-1);
58
+ --vp-c-tip-2: var(--vp-c-brand-2);
59
+ --vp-c-tip-3: var(--vp-c-brand-3);
60
+ --vp-c-tip-soft: var(--vp-c-brand-soft);
61
+
62
+ --vp-c-warning-1: var(--vp-c-yellow-1);
63
+ --vp-c-warning-2: var(--vp-c-yellow-2);
64
+ --vp-c-warning-3: var(--vp-c-yellow-3);
65
+ --vp-c-warning-soft: var(--vp-c-yellow-soft);
66
+
67
+ --vp-c-danger-1: var(--vp-c-red-1);
68
+ --vp-c-danger-2: var(--vp-c-red-2);
69
+ --vp-c-danger-3: var(--vp-c-red-3);
70
+ --vp-c-danger-soft: var(--vp-c-red-soft);
71
+ }
72
+
73
+ /**
74
+ * Component: Button
75
+ * -------------------------------------------------------------------------- */
76
+
77
+ :root {
78
+ --vp-button-brand-border: transparent;
79
+ --vp-button-brand-text: var(--vp-c-white);
80
+ --vp-button-brand-bg: var(--vp-c-brand-3);
81
+ --vp-button-brand-hover-border: transparent;
82
+ --vp-button-brand-hover-text: var(--vp-c-white);
83
+ --vp-button-brand-hover-bg: var(--vp-c-brand-2);
84
+ --vp-button-brand-active-border: transparent;
85
+ --vp-button-brand-active-text: var(--vp-c-white);
86
+ --vp-button-brand-active-bg: var(--vp-c-brand-1);
87
+ }
88
+
89
+ /**
90
+ * Component: Home
91
+ * -------------------------------------------------------------------------- */
92
+
93
+ :root {
94
+ --vp-home-hero-name-color: transparent;
95
+ --vp-home-hero-name-background: -webkit-linear-gradient(120deg, #bd34fe 30%, #41d1ff);
96
+
97
+ --vp-home-hero-image-background-image: linear-gradient(-45deg, #bd34fe 50%, #47caff 50%);
98
+ --vp-home-hero-image-filter: blur(44px);
99
+ }
100
+
101
+ @media (min-width: 640px) {
102
+ :root {
103
+ --vp-home-hero-image-filter: blur(56px);
104
+ }
105
+ }
106
+
107
+ @media (min-width: 960px) {
108
+ :root {
109
+ --vp-home-hero-image-filter: blur(68px);
110
+ }
111
+ }
112
+
113
+ /**
114
+ * Component: Custom Block
115
+ * -------------------------------------------------------------------------- */
116
+
117
+ :root {
118
+ --vp-custom-block-tip-border: transparent;
119
+ --vp-custom-block-tip-text: var(--vp-c-text-1);
120
+ --vp-custom-block-tip-bg: var(--vp-c-brand-soft);
121
+ --vp-custom-block-tip-code-bg: var(--vp-c-brand-soft);
122
+ }
123
+
124
+ /**
125
+ * Component: Algolia
126
+ * -------------------------------------------------------------------------- */
127
+
128
+ .DocSearch {
129
+ --docsearch-primary-color: var(--vp-c-brand-1) !important;
130
+ }
@@ -0,0 +1,49 @@
1
+ ---
2
+ outline: deep
3
+ ---
4
+
5
+ # Runtime API Examples
6
+
7
+ This page demonstrates usage of some of the runtime APIs provided by VitePress.
8
+
9
+ The main `useData()` API can be used to access site, theme, and page data for the current page. It works in both `.md` and `.vue` files:
10
+
11
+ ```md
12
+ <script setup>
13
+ import { useData } from 'vitepress'
14
+
15
+ const { theme, page, frontmatter } = useData()
16
+ </script>
17
+
18
+ ## Results
19
+
20
+ ### Theme Data
21
+ <pre>{{ theme }}</pre>
22
+
23
+ ### Page Data
24
+ <pre>{{ page }}</pre>
25
+
26
+ ### Page Frontmatter
27
+ <pre>{{ frontmatter }}</pre>
28
+ ```
29
+
30
+ <script setup>
31
+ import { useData } from 'vitepress'
32
+
33
+ const { site, theme, page, frontmatter } = useData()
34
+ </script>
35
+
36
+ ## Results
37
+
38
+ ### Theme Data
39
+ <pre>{{ theme }}</pre>
40
+
41
+ ### Page Data
42
+ <pre>{{ page }}</pre>
43
+
44
+ ### Page Frontmatter
45
+ <pre>{{ frontmatter }}</pre>
46
+
47
+ ## More
48
+
49
+ Check out the documentation for the [full list of runtime APIs](https://vitepress.dev/reference/runtime-api#usedata).
@@ -0,0 +1,10 @@
1
+ /* eslint-disable */
2
+ /* prettier-ignore */
3
+ // @ts-nocheck
4
+ // noinspection JSUnusedGlobalSymbols
5
+ // Generated by unplugin-auto-import
6
+ // biome-ignore lint: disable
7
+ export {}
8
+ declare global {
9
+
10
+ }
@@ -0,0 +1,75 @@
1
+ # Icon 图标
2
+
3
+ dnhyxc-ui 推荐使用 [xicons](https://www.xicons.org/#/) 作为图标库。
4
+
5
+ ```
6
+ $ pnpm install @vicons/ionicons5
7
+ ```
8
+
9
+ ## 使用图标
10
+
11
+ 全局注册
12
+
13
+ :::demo
14
+
15
+ ```vue
16
+ <script setup lang="ts">
17
+ import { Earth } from '@vicons/ionicons5';
18
+ </script>
19
+
20
+ <template>
21
+ <el-button>element-plus button</el-button>
22
+ <br />
23
+ <n-button>dnhyxc-ui-plus button</n-button>
24
+ </template>
25
+ ```
26
+
27
+ :::
28
+
29
+ ## API
30
+
31
+ ### Icon Props
32
+
33
+ <script>
34
+ const iconProps = [
35
+ {
36
+ name: 'size',
37
+ type: 'number | string',
38
+ default: '16',
39
+ description: '图标大小',
40
+ version: '-'
41
+ },
42
+ {
43
+ name: 'color',
44
+ type: 'string',
45
+ default: '#000',
46
+ description: '图标颜色',
47
+ version: '-'
48
+ }
49
+ ];
50
+ </script>
51
+
52
+ <table>
53
+ <thead>
54
+ <tr>
55
+ <th style="width: 1000px">名称</th>
56
+ <th style="width: 1000px">类型</th>
57
+ <th style="width: 1000px">默认值</th>
58
+ <th style="width: 1000px">说明</th>
59
+ <th style="width: 1000px">版本</th>
60
+ </tr>
61
+ </thead>
62
+ <tbody>
63
+ <tr v-for="prop in iconProps" :key="prop.name">
64
+ <td>{{ prop.name }}</td>
65
+ <td>
66
+ <code>{{ prop.type }}</code>
67
+ </td>
68
+ <td>
69
+ <code>{{ prop.default }}</code>
70
+ </td>
71
+ <td>{{ prop.description }}</td>
72
+ <td>{{ prop.version }}</td>
73
+ </tr>
74
+ </tbody>
75
+ </table>
@@ -0,0 +1,13 @@
1
+ /* eslint-disable */
2
+ // @ts-nocheck
3
+ // Generated by unplugin-vue-components
4
+ // Read more: https://github.com/vuejs/core/pull/3399
5
+ // biome-ignore lint: disable
6
+ export {}
7
+
8
+ /* prettier-ignore */
9
+ declare module 'vue' {
10
+ export interface GlobalComponents {
11
+ ElButton: typeof import('element-plus/es')['ElButton']
12
+ }
13
+ }
@@ -0,0 +1 @@
1
+ # 下载安装
@@ -0,0 +1 @@
1
+ # 快速开始
package/docs/index.md ADDED
@@ -0,0 +1,24 @@
1
+ ---
2
+ # https://vitepress.dev/reference/default-theme-home-page
3
+ layout: home
4
+
5
+ hero:
6
+ name: 'dnhyxc-ui'
7
+ text: 'dnhyxc-ui 组件库'
8
+ tagline: My great project tagline
9
+ actions:
10
+ - theme: brand
11
+ text: 快速开始
12
+ link: /guide/installation
13
+ - theme: alt
14
+ text: 组件库
15
+ link: /components/icon
16
+
17
+ features:
18
+ - title: Feature A
19
+ details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
20
+ - title: Feature B
21
+ details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
22
+ - title: Feature C
23
+ details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
24
+ ---
@@ -0,0 +1,85 @@
1
+ # Markdown Extension Examples
2
+
3
+ This page demonstrates some of the built-in markdown extensions provided by VitePress.
4
+
5
+ ## Syntax Highlighting
6
+
7
+ VitePress provides Syntax Highlighting powered by [Shiki](https://github.com/shikijs/shiki), with additional features like line-highlighting:
8
+
9
+ **Input**
10
+
11
+ ````md
12
+ ```js{4}
13
+ export default {
14
+ data () {
15
+ return {
16
+ msg: 'Highlighted!'
17
+ }
18
+ }
19
+ }
20
+ ```
21
+ ````
22
+
23
+ **Output**
24
+
25
+ ```js{4}
26
+ export default {
27
+ data () {
28
+ return {
29
+ msg: 'Highlighted!'
30
+ }
31
+ }
32
+ }
33
+ ```
34
+
35
+ ## Custom Containers
36
+
37
+ **Input**
38
+
39
+ ```md
40
+ ::: info
41
+ This is an info box.
42
+ :::
43
+
44
+ ::: tip
45
+ This is a tip.
46
+ :::
47
+
48
+ ::: warning
49
+ This is a warning.
50
+ :::
51
+
52
+ ::: danger
53
+ This is a dangerous warning.
54
+ :::
55
+
56
+ ::: details
57
+ This is a details block.
58
+ :::
59
+ ```
60
+
61
+ **Output**
62
+
63
+ ::: info
64
+ This is an info box.
65
+ :::
66
+
67
+ ::: tip
68
+ This is a tip.
69
+ :::
70
+
71
+ ::: warning
72
+ This is a warning.
73
+ :::
74
+
75
+ ::: danger
76
+ This is a dangerous warning.
77
+ :::
78
+
79
+ ::: details
80
+ This is a details block.
81
+ :::
82
+
83
+ ## More
84
+
85
+ Check out the documentation for the [full list of markdown extensions](https://vitepress.dev/guide/markdown).
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@dnhyxc/docs",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "scripts": {
6
+ "dev": "vitepress dev",
7
+ "build": "vitepress build",
8
+ "preview": "vitepress preview"
9
+ },
10
+ "keywords": [],
11
+ "author": "",
12
+ "license": "ISC",
13
+ "description": "",
14
+ "devDependencies": {
15
+ "@vitejs/plugin-vue": "^5.2.1",
16
+ "@vitepress-code-preview/container": "^1.0.8",
17
+ "@vitepress-code-preview/plugin": "^1.0.6",
18
+ "unplugin-auto-import": "^19.3.0",
19
+ "unplugin-element-plus": "^0.10.0",
20
+ "unplugin-vue-components": "^28.8.0",
21
+ "vitepress": "^1.6.3",
22
+ "vitepress-theme-demoblock": "^3.1.3"
23
+ },
24
+ "dependencies": {
25
+ "@dnhyxc-ui/theme": "workspace:^",
26
+ "@vicons/ionicons5": "^0.13.0",
27
+ "dnhyxc-ui-plus": "workspace:^",
28
+ "element-plus": "^2.10.3"
29
+ }
30
+ }
@@ -0,0 +1,20 @@
1
+ import { defineConfig } from 'vite';
2
+ import { viteDemoPreviewPlugin } from '@vitepress-code-preview/plugin';
3
+ import AutoImport from 'unplugin-auto-import/vite';
4
+ import Components from 'unplugin-vue-components/vite';
5
+ import ElementPlus from 'unplugin-element-plus/vite';
6
+ import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';
7
+
8
+ export default defineConfig({
9
+ base: '/', // 线上打包路径改为绝对路径,防止打包后,资源文件路径出现上述错误
10
+ plugins: [
11
+ viteDemoPreviewPlugin(),
12
+ AutoImport({
13
+ resolvers: [ElementPlusResolver()]
14
+ }),
15
+ Components({
16
+ resolvers: [ElementPlusResolver()]
17
+ }),
18
+ ElementPlus({})
19
+ ]
20
+ });
@@ -0,0 +1,90 @@
1
+ import eslint from '@eslint/js';
2
+ import tsEslintPlugin from '@typescript-eslint/eslint-plugin';
3
+ import tsEslintParser from '@typescript-eslint/parser';
4
+ import vuePlugin from 'eslint-plugin-vue';
5
+ import vueParser from 'vue-eslint-parser';
6
+ import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
7
+ import globals from 'globals';
8
+
9
+ const baseConfig = [
10
+ // 全局配置
11
+ {
12
+ name: 'global config',
13
+ languageOptions: {
14
+ globals: {
15
+ ...globals.es2022,
16
+ ...globals.browser,
17
+ ...globals.node
18
+ },
19
+ sourceType: 'module' // 确保设置为 module
20
+ },
21
+ rules: {
22
+ 'no-dupe-class-members': 0,
23
+ 'no-redeclare': 0,
24
+ 'no-undef': 0,
25
+ 'no-unused-vars': 0
26
+ }
27
+ },
28
+
29
+ // Vue 文件配置
30
+ {
31
+ name: 'vue-eslint',
32
+ files: ['**/*.vue'],
33
+ languageOptions: {
34
+ parser: vueParser,
35
+ parserOptions: {
36
+ parser: tsEslintParser, // Vue 文件中使用 TS 解析器
37
+ ecmaVersion: 'latest',
38
+ sourceType: 'module',
39
+ extraFileExtensions: ['.vue'],
40
+ ecmaFeatures: { jsx: false }
41
+ }
42
+ },
43
+ plugins: {
44
+ vue: vuePlugin
45
+ },
46
+ rules: {
47
+ ...vuePlugin.configs['vue3-recommended'].rules,
48
+ 'vue/multi-word-component-names': 'off'
49
+ }
50
+ },
51
+
52
+ // JS/TS 文件配置
53
+ // {
54
+ // files: ['**/*.{js,ts}'],
55
+ // languageOptions: {
56
+ // parser: tsEslintParser, // 统一使用 TS 解析器
57
+ // parserOptions: {
58
+ // ecmaVersion: 'latest',
59
+ // sourceType: 'module',
60
+ // ecmaFeatures: { jsx: false }
61
+ // }
62
+ // }
63
+ // },
64
+ // JS/TS 文件配置
65
+ {
66
+ name: 'typescript-eslint/base',
67
+ // files: ['**/*.ts'],
68
+ files: ['**/*.{js,ts}'],
69
+ languageOptions: {
70
+ parser: tsEslintParser,
71
+ sourceType: 'module',
72
+ parserOptions: {
73
+ ecmaFeatures: { jsx: false }
74
+ }
75
+ },
76
+ rules: {
77
+ ...tsEslintPlugin.configs.recommended.rules,
78
+ '@typescript-eslint/no-confusing-non-null-assertion': 2
79
+ },
80
+ plugins: {
81
+ '@typescript-eslint': tsEslintPlugin
82
+ }
83
+ },
84
+ // 忽略文件
85
+ {
86
+ ignores: ['packages/*/dist/**', 'node_modules/**']
87
+ }
88
+ ];
89
+
90
+ export default [eslint.configs.recommended, eslintPluginPrettierRecommended, ...baseConfig];