feat(eslint): 添加 eslint-plugin-import 插件并配置导入规则
This commit is contained in:
@@ -1,13 +1,16 @@
|
|||||||
|
import pluginImport from 'eslint-plugin-import';
|
||||||
import { globalIgnores } from 'eslint/config';
|
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 pluginVue from 'eslint-plugin-vue';
|
||||||
import pluginVitest from '@vitest/eslint-plugin';
|
import pluginVitest from '@vitest/eslint-plugin';
|
||||||
import pluginPlaywright from 'eslint-plugin-playwright';
|
import pluginPlaywright from 'eslint-plugin-playwright';
|
||||||
import pluginOxlint from 'eslint-plugin-oxlint';
|
import pluginOxlint from 'eslint-plugin-oxlint';
|
||||||
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting';
|
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'] });
|
configureVueProject({ scriptLangs: ['ts', 'tsx'] });
|
||||||
// More info at https://github.com/vuejs/eslint-config-typescript/#advanced-setup
|
// 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}'],
|
files: ['e2e/**/*.{test,spec}.{js,ts,jsx,tsx}'],
|
||||||
},
|
},
|
||||||
...pluginOxlint.configs['flat/recommended'],
|
...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: {
|
rules: {
|
||||||
@@ -50,4 +68,6 @@ export default defineConfigWithVueTs(
|
|||||||
'vue/multi-word-component-names': 'off',
|
'vue/multi-word-component-names': 'off',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
skipFormatting,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
"node": "^20.19.0 || >=22.12.0"
|
"node": "^20.19.0 || >=22.12.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"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",
|
"dev": "vite --port 4730 --host --strictPort",
|
||||||
"build": "run-p type-check \"build-only {@}\" --",
|
"build": "run-p type-check \"build-only {@}\" --",
|
||||||
"build-only": "vite build",
|
"build-only": "vite build",
|
||||||
@@ -97,6 +97,7 @@
|
|||||||
"@vue/tsconfig": "^0.8.1",
|
"@vue/tsconfig": "^0.8.1",
|
||||||
"consola": "^3.4.2",
|
"consola": "^3.4.2",
|
||||||
"eslint": "^9.35.0",
|
"eslint": "^9.35.0",
|
||||||
|
"eslint-plugin-import": "^2.32.0",
|
||||||
"eslint-plugin-oxlint": "~1.23.0",
|
"eslint-plugin-oxlint": "~1.23.0",
|
||||||
"eslint-plugin-playwright": "^2.2.2",
|
"eslint-plugin-playwright": "^2.2.2",
|
||||||
"eslint-plugin-vue": "~10.5.0",
|
"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
Reference in New Issue
Block a user