From 762e5dee140f9643764bc84f35a365da93b798ba Mon Sep 17 00:00:00 2001 From: vben Date: Thu, 6 Apr 2023 23:16:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=BE=AA=E7=8E=AF?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/eslint-config/build.config.ts | 2 +- internal/eslint-config/package.json | 6 ++++- internal/eslint-config/src/index.ts | 22 +++------------- internal/eslint-config/src/strict.ts | 18 +++++++++++++ package.json | 1 + pnpm-lock.yaml | 26 +++---------------- .../Application/src/AppLocalePicker.vue | 2 +- .../src/search/AppSearchKeyItem.vue | 2 +- .../Application/src/search/AppSearchModal.vue | 2 +- src/components/Basic/src/BasicArrow.vue | 2 +- src/components/Button/src/BasicButton.vue | 2 +- .../ContextMenu/src/ContextMenu.vue | 2 +- src/components/Cropper/src/CropperAvatar.vue | 2 +- src/components/Dropdown/src/Dropdown.vue | 7 ++--- .../FlowChart/src/FlowChartToolbar.vue | 2 +- src/components/Icon/{src => }/Icon.vue | 4 +-- src/components/Icon/index.ts | 3 +-- src/components/Icon/src/IconPicker.vue | 4 +-- .../Menu/src/components/MenuItemContent.vue | 3 +-- .../SimpleMenu/src/SimpleSubMenu.vue | 2 +- .../SimpleMenu/src/components/SubMenuItem.vue | 2 +- .../Table/src/components/TableAction.vue | 2 +- .../src/components/settings/ColumnSetting.vue | 2 +- src/components/Tree/src/TreeIcon.ts | 2 +- .../Tree/src/components/TreeHeader.vue | 4 +-- src/components/Upload/src/BasicUpload.vue | 5 ++-- .../default/header/components/Breadcrumb.vue | 2 +- .../default/header/components/ErrorAction.vue | 3 +-- .../components/user-dropdown/DropMenuItem.vue | 2 +- src/layouts/default/setting/index.vue | 2 +- src/layouts/default/sider/MixSider.vue | 2 +- .../default/tabs/components/FoldButton.vue | 2 +- .../default/tabs/components/TabContent.vue | 2 +- .../analysis/components/GrowCard.vue | 2 +- .../workbench/components/DynamicInfo.vue | 2 +- .../workbench/components/ProjectCard.vue | 2 +- .../workbench/components/QuickNav.vue | 2 +- src/views/demo/feat/icon/index.vue | 3 ++- .../demo/page/account/center/Application.vue | 2 +- .../demo/page/account/center/Article.vue | 2 +- src/views/demo/page/account/center/index.vue | 2 +- .../demo/page/account/setting/AccountBind.vue | 2 +- src/views/demo/page/list/basic/index.vue | 2 +- src/views/demo/page/list/card/index.vue | 2 +- src/views/demo/page/list/search/index.vue | 2 +- src/views/demo/system/menu/menu.data.ts | 2 +- .../components/FormNodeOperate.vue | 2 +- .../VFormDesign/components/FormOptions.vue | 2 +- .../VFormDesign/components/RuleProps.vue | 2 +- .../VFormDesign/modules/CollapseItem.vue | 2 +- .../VFormDesign/modules/Toolbar.vue | 2 +- .../components/VFormItem/index.vue | 2 +- 52 files changed, 86 insertions(+), 99 deletions(-) create mode 100644 internal/eslint-config/src/strict.ts rename src/components/Icon/{src => }/Icon.vue (97%) diff --git a/internal/eslint-config/build.config.ts b/internal/eslint-config/build.config.ts index 20c8b54a1..08301e5e1 100644 --- a/internal/eslint-config/build.config.ts +++ b/internal/eslint-config/build.config.ts @@ -2,7 +2,7 @@ import { defineBuildConfig } from 'unbuild'; export default defineBuildConfig({ clean: true, - entries: ['src/index'], + entries: ['src/index', 'src/strict'], declaration: true, rollup: { emitCJS: true, diff --git a/internal/eslint-config/package.json b/internal/eslint-config/package.json index 95230ecc5..8341b1fce 100644 --- a/internal/eslint-config/package.json +++ b/internal/eslint-config/package.json @@ -17,6 +17,11 @@ "types": "./dist/index.d.ts", "import": "./dist/index.mjs", "require": "./dist/index.cjs" + }, + "./strict": { + "types": "./dist/strict.d.ts", + "import": "./dist/strict.mjs", + "require": "./dist/strict.cjs" } }, "main": "./dist/index.cjs", @@ -38,7 +43,6 @@ "eslint-plugin-import": "^2.27.5", "eslint-plugin-prettier": "^4.2.1", "eslint-plugin-simple-import-sort": "^10.0.0", - "eslint-plugin-unused-imports": "^2.0.0", "eslint-plugin-vue": "^9.10.0", "vue-eslint-parser": "^9.1.1" } diff --git a/internal/eslint-config/src/index.ts b/internal/eslint-config/src/index.ts index c1513ee76..1138bb376 100644 --- a/internal/eslint-config/src/index.ts +++ b/internal/eslint-config/src/index.ts @@ -17,14 +17,7 @@ export default { createDefaultProgram: false, extraFileExtensions: ['.vue'], }, - plugins: [ - 'vue', - '@typescript-eslint', - 'import', - // TODO: 改造完成后开启 - // 'unused-imports', - // 'simple-import-sort', - ], + plugins: ['vue', '@typescript-eslint', 'import'], extends: [ 'eslint:recommended', 'plugin:vue/vue3-recommended', @@ -37,19 +30,10 @@ export default { 'no-use-before-define': 'off', 'space-before-function-paren': 'off', - // TODO: 改造完成后开启 - // 'simple-import-sort/imports': 'error', - // 'simple-import-sort/exports': 'error', - 'import/first': 'error', 'import/newline-after-import': 'error', 'import/no-duplicates': 'error', - // 'unused-imports/no-unused-imports': 'error', - // 'unused-imports/no-unused-vars': [ - // 'warn', - // { vars: 'all', varsIgnorePattern: '^_', args: 'after-used', argsIgnorePattern: '^_' }, - // ], '@typescript-eslint/no-unused-vars': [ 'error', { @@ -58,13 +42,13 @@ export default { }, ], '@typescript-eslint/ban-ts-ignore': 'off', + '@typescript-eslint/ban-ts-comment': 'off', + '@typescript-eslint/ban-types': 'off', '@typescript-eslint/explicit-function-return-type': 'off', '@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/no-var-requires': 'off', '@typescript-eslint/no-empty-function': 'off', '@typescript-eslint/no-use-before-define': 'off', - '@typescript-eslint/ban-ts-comment': 'off', - '@typescript-eslint/ban-types': 'off', '@typescript-eslint/no-non-null-assertion': 'off', '@typescript-eslint/explicit-module-boundary-types': 'off', 'vue/script-setup-uses-vars': 'error', diff --git a/internal/eslint-config/src/strict.ts b/internal/eslint-config/src/strict.ts new file mode 100644 index 000000000..4741d5963 --- /dev/null +++ b/internal/eslint-config/src/strict.ts @@ -0,0 +1,18 @@ +import baseLintConfig from './index'; + +export default { + extends: [baseLintConfig], + plugins: ['simple-import-sort'], + rules: { + 'simple-import-sort/imports': 'error', + 'simple-import-sort/exports': 'error', + + '@typescript-eslint/ban-types': 'error', + '@typescript-eslint/ban-ts-ignore': 'error', + '@typescript-eslint/ban-ts-comment': 'error', + '@typescript-eslint/no-explicit-any': 'error', + + 'vue/attributes-order': 'error', + 'vue/require-default-prop': 'error', + }, +}; diff --git a/package.json b/package.json index ce0b93a13..78cb75cf5 100644 --- a/package.json +++ b/package.json @@ -71,6 +71,7 @@ "@logicflow/core": "^1.2.1", "@logicflow/extension": "^1.2.1", "@vben/hooks": "workspace:*", + "@vue/shared": "^3.2.47", "@vueuse/core": "^9.13.0", "@vueuse/shared": "^9.13.0", "@zxcvbn-ts/core": "^2.2.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5b66c7920..07e403c02 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -19,6 +19,9 @@ importers: '@vben/hooks': specifier: workspace:* version: link:packages/hooks + '@vue/shared': + specifier: ^3.2.47 + version: 3.2.47 '@vueuse/core': specifier: ^9.13.0 version: 9.13.0(vue@3.2.47) @@ -321,9 +324,6 @@ importers: eslint-plugin-simple-import-sort: specifier: ^10.0.0 version: 10.0.0(eslint@8.37.0) - eslint-plugin-unused-imports: - specifier: ^2.0.0 - version: 2.0.0(@typescript-eslint/eslint-plugin@5.57.1)(eslint@8.37.0) eslint-plugin-vue: specifier: ^9.10.0 version: 9.10.0(eslint@8.37.0) @@ -4483,21 +4483,6 @@ packages: eslint: 8.37.0 dev: true - /eslint-plugin-unused-imports@2.0.0(@typescript-eslint/eslint-plugin@5.57.1)(eslint@8.37.0): - resolution: {integrity: sha512-3APeS/tQlTrFa167ThtP0Zm0vctjr4M44HMpeg1P4bK6wItarumq0Ma82xorMKdFsWpphQBlRPzw/pxiVELX1A==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - peerDependencies: - '@typescript-eslint/eslint-plugin': ^5.0.0 - eslint: ^8.0.0 - peerDependenciesMeta: - '@typescript-eslint/eslint-plugin': - optional: true - dependencies: - '@typescript-eslint/eslint-plugin': 5.57.1(@typescript-eslint/parser@5.57.1)(eslint@8.37.0)(typescript@5.0.3) - eslint: 8.37.0 - eslint-rule-composer: 0.3.0 - dev: true - /eslint-plugin-vue@9.10.0(eslint@8.37.0): resolution: {integrity: sha512-2MgP31OBf8YilUvtakdVMc8xVbcMp7z7/iQj8LHVpXrSXHPXSJRUIGSPFI6b6pyCx/buKaFJ45ycqfHvQRiW2g==} engines: {node: ^14.17.0 || >=16.0.0} @@ -4516,11 +4501,6 @@ packages: - supports-color dev: true - /eslint-rule-composer@0.3.0: - resolution: {integrity: sha512-bt+Sh8CtDmn2OajxvNO+BX7Wn4CIWMpTRm3MaiKPCQcnnlm0CS2mhui6QaoeQugs+3Kj2ESKEEGJUdVafwhiCg==} - engines: {node: '>=4.0.0'} - dev: true - /eslint-scope@5.1.1: resolution: {integrity: sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==} engines: {node: '>=8.0.0'} diff --git a/src/components/Application/src/AppLocalePicker.vue b/src/components/Application/src/AppLocalePicker.vue index f71b81280..51852f326 100644 --- a/src/components/Application/src/AppLocalePicker.vue +++ b/src/components/Application/src/AppLocalePicker.vue @@ -22,7 +22,7 @@ import type { DropMenu } from '/@/components/Dropdown'; import { ref, watchEffect, unref, computed } from 'vue'; import { Dropdown } from '/@/components/Dropdown'; - import { Icon } from '/@/components/Icon'; + import Icon from '@/components/Icon/Icon.vue'; import { useLocale } from '/@/locales/useLocale'; import { localeList } from '/@/settings/localeSetting'; diff --git a/src/components/Application/src/search/AppSearchKeyItem.vue b/src/components/Application/src/search/AppSearchKeyItem.vue index e2db5daa6..08e3dbd70 100644 --- a/src/components/Application/src/search/AppSearchKeyItem.vue +++ b/src/components/Application/src/search/AppSearchKeyItem.vue @@ -4,7 +4,7 @@ diff --git a/src/views/demo/feat/icon/index.vue b/src/views/demo/feat/icon/index.vue index 7e3d50f83..ecce72a04 100644 --- a/src/views/demo/feat/icon/index.vue +++ b/src/views/demo/feat/icon/index.vue @@ -64,7 +64,8 @@ CodepenCircleFilled, } from '@ant-design/icons-vue'; - import { Icon, IconPicker, SvgIcon } from '/@/components/Icon/index'; + import { IconPicker, SvgIcon } from '/@/components/Icon/index'; + import Icon from '/@/components/Icon/Icon.vue'; import { openWindow } from '/@/utils'; import { PageWrapper } from '/@/components/Page'; diff --git a/src/views/demo/page/account/center/Application.vue b/src/views/demo/page/account/center/Application.vue index 33a3e308c..5a54f008a 100644 --- a/src/views/demo/page/account/center/Application.vue +++ b/src/views/demo/page/account/center/Application.vue @@ -30,7 +30,7 @@