Merge branch 'eslint-plugin-import'
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
import pluginImport from 'eslint-plugin-import';
|
||||
import { globalIgnores } from 'eslint/config';
|
||||
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript';
|
||||
import {
|
||||
defineConfigWithVueTs,
|
||||
vueTsConfigs,
|
||||
configureVueProject,
|
||||
} from '@vue/eslint-config-typescript';
|
||||
import pluginVue from 'eslint-plugin-vue';
|
||||
import pluginVitest from '@vitest/eslint-plugin';
|
||||
import pluginPlaywright from 'eslint-plugin-playwright';
|
||||
import pluginOxlint from 'eslint-plugin-oxlint';
|
||||
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting';
|
||||
|
||||
// To allow more languages other than `ts` in `.vue` files, uncomment the following lines:
|
||||
import { configureVueProject } from '@vue/eslint-config-typescript';
|
||||
configureVueProject({ scriptLangs: ['ts', 'tsx'] });
|
||||
// More info at https://github.com/vuejs/eslint-config-typescript/#advanced-setup
|
||||
|
||||
@@ -32,7 +35,22 @@ export default defineConfigWithVueTs(
|
||||
files: ['e2e/**/*.{test,spec}.{js,ts,jsx,tsx}'],
|
||||
},
|
||||
...pluginOxlint.configs['flat/recommended'],
|
||||
skipFormatting,
|
||||
{
|
||||
plugins: {
|
||||
import: pluginImport,
|
||||
},
|
||||
rules: {
|
||||
'import/first': 'error',
|
||||
'import/no-duplicates': 'error',
|
||||
'import/newline-after-import': 'error',
|
||||
'import/no-mutable-exports': 'error',
|
||||
'import/no-named-default': 'error',
|
||||
'import/no-self-import': 'error',
|
||||
'import/no-unresolved': 'off',
|
||||
'import/no-webpack-loader-syntax': 'error',
|
||||
'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
rules: {
|
||||
@@ -50,4 +68,6 @@ export default defineConfigWithVueTs(
|
||||
'vue/multi-word-component-names': 'off',
|
||||
},
|
||||
},
|
||||
|
||||
skipFormatting,
|
||||
);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
},
|
||||
"scripts": {
|
||||
"_all": "run-p build-only format:prettier type-check lint test:unit:DisableWatch",
|
||||
"_all": "run-p build-only type-check lint format:prettier test:unit:DisableWatch",
|
||||
"dev": "vite --port 4730 --host --strictPort",
|
||||
"build": "run-p type-check \"build-only {@}\" --",
|
||||
"build-only": "vite build",
|
||||
@@ -97,6 +97,7 @@
|
||||
"@vue/tsconfig": "^0.8.1",
|
||||
"consola": "^3.4.2",
|
||||
"eslint": "^9.35.0",
|
||||
"eslint-plugin-import": "^2.32.0",
|
||||
"eslint-plugin-oxlint": "~1.23.0",
|
||||
"eslint-plugin-playwright": "^2.2.2",
|
||||
"eslint-plugin-vue": "~10.5.0",
|
||||
|
||||
1043
pnpm-lock.yaml
generated
1043
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,10 @@
|
||||
* https://pinia.vuejs.org/zh/cookbook/testing.html#unit-testing-components
|
||||
*/
|
||||
|
||||
import { mount } from '@vue/test-utils';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { createMemoryHistory, createRouter } from 'vue-router';
|
||||
import App from './App.vue';
|
||||
|
||||
const router = createRouter({
|
||||
history: createMemoryHistory(),
|
||||
@@ -20,10 +23,6 @@ const router = createRouter({
|
||||
],
|
||||
});
|
||||
|
||||
import { mount } from '@vue/test-utils';
|
||||
import { createMemoryHistory, createRouter } from 'vue-router';
|
||||
import App from './App.vue';
|
||||
|
||||
describe('App', () => {
|
||||
it('renders RouterView', async () => {
|
||||
router.push('/');
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import type { GlobalThemeOverrides } from 'naive-ui';
|
||||
import { darkTheme } from 'naive-ui';
|
||||
import { RouterView } from 'vue-router';
|
||||
import { darkTheme, type GlobalThemeOverrides } from 'naive-ui';
|
||||
|
||||
const appStore = useAppStore();
|
||||
|
||||
// https://www.naiveui.com/zh-CN/light/docs/customize-theme
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import type { Ref } from 'vue';
|
||||
import type { MenuInst, MenuOption } from 'naive-ui';
|
||||
import { createGetRoutes } from 'virtual:meta-layouts';
|
||||
import { RouterLink, type RouteRecordRaw } from 'vue-router';
|
||||
import type { Ref } from 'vue';
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
import { RouterLink } from 'vue-router';
|
||||
import IconMenuRounded from '~icons/material-symbols/menu-rounded';
|
||||
|
||||
export function useMetaLayoutsNMenuOptions({ menuInstRef }: { menuInstRef: Ref<MenuInst | null> }) {
|
||||
|
||||
10
src/main.ts
10
src/main.ts
@@ -1,13 +1,11 @@
|
||||
import './styles/index.ts';
|
||||
|
||||
// import { LogLevels } from 'consola';
|
||||
// consola.level = LogLevels.verbose;
|
||||
|
||||
import { LogLevels } from 'consola';
|
||||
import App from './App.vue';
|
||||
import { setupPlugins } from './plugins';
|
||||
|
||||
consola.level = LogLevels.verbose;
|
||||
|
||||
/* `import.meta.glob(${g}, { eager: ${isSync} })`; */
|
||||
const autoInstallModules = import.meta.glob('./plugins/!(index).ts', { eager: true });
|
||||
|
||||
import { setupPlugins } from './plugins';
|
||||
|
||||
setupPlugins(createApp(App), autoInstallModules).mount('#app');
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<script setup lang="tsx">
|
||||
import type { FunctionalComponent } from 'vue';
|
||||
|
||||
import hljs from 'highlight.js/lib/core';
|
||||
import json from 'highlight.js/lib/languages/json';
|
||||
import type { FunctionalComponent } from 'vue';
|
||||
|
||||
hljs.registerLanguage('json', json);
|
||||
|
||||
definePage({ meta: { link: true } });
|
||||
|
||||
@@ -1,19 +1,23 @@
|
||||
import type { ConfigEnv, PluginOption } from 'vite';
|
||||
import consola from 'consola';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
import AutoImport from 'unplugin-auto-import/vite';
|
||||
import { FileSystemIconLoader } from 'unplugin-icons/loaders';
|
||||
import Icons from 'unplugin-icons/vite';
|
||||
import Components from 'unplugin-vue-components/vite';
|
||||
|
||||
import { VueRouterAutoImports } from 'unplugin-vue-router';
|
||||
import { createUtils4uAutoImports } from 'utils4u/auto-imports';
|
||||
|
||||
import { FileSystemIconLoader } from 'unplugin-icons/loaders';
|
||||
import type { ConfigEnv, PluginOption } from 'vite';
|
||||
|
||||
// >>>>>
|
||||
// eslint-disable-next-line import/no-duplicates
|
||||
import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers';
|
||||
|
||||
// eslint-disable-next-line import/no-duplicates
|
||||
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers';
|
||||
|
||||
// eslint-disable-next-line import/no-duplicates
|
||||
import { TDesignResolver } from 'unplugin-vue-components/resolvers';
|
||||
|
||||
import { PrimeVueResolver } from '@primevue/auto-import-resolver';
|
||||
@@ -23,10 +27,6 @@ import IconsResolver from 'unplugin-icons/resolver';
|
||||
import { VantResolver } from '@vant/auto-import-resolver';
|
||||
// <<<<<
|
||||
|
||||
import consola from 'consola';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
function _getNaiveUiComponentNames() {
|
||||
// 方法1: 从 web-types.json 读取(推荐)
|
||||
const webTypesPath = path.resolve('node_modules/naive-ui/web-types.json');
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import consola from 'consola';
|
||||
import { loadEnv, type ConfigEnv, type PluginOption } from 'vite';
|
||||
import type { ConfigEnv, PluginOption } from 'vite';
|
||||
import { loadEnv } from 'vite';
|
||||
import vueDevTools from 'vite-plugin-vue-devtools';
|
||||
|
||||
export function loadPlugin(configEnv: ConfigEnv): PluginOption {
|
||||
|
||||
Reference in New Issue
Block a user