From 5974a289c626ea41c339511aa494aac0bd4d6d3f Mon Sep 17 00:00:00 2001 From: xiaosi <2652281683@qq.com> Date: Mon, 27 Nov 2023 14:53:07 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E9=85=8D=E7=BD=AE=E3=80=91eslint?= =?UTF-8?q?=EF=BC=9A@=20=E8=AF=86=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.cjs | 6 ++++++ package-lock.json | 20 ++++++++++++++++++++ package.json | 1 + 3 files changed, 27 insertions(+) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 3d5f44e..a45f045 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -12,6 +12,12 @@ module.exports = { ecmaVersion: 'latest', }, + settings: { + 'import/resolver': { + alias: [['@', './src']], + }, + }, + rules: { 'no-console': 'warn', 'no-debugger': 'warn', diff --git a/package-lock.json b/package-lock.json index d3d6a95..3fa7ae5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,7 @@ "@vitejs/plugin-vue-jsx": "^3.0.2", "eslint": "^8.49.0", "eslint-config-airbnb-base": "^15.0.0", + "eslint-import-resolver-alias": "^1.1.2", "eslint-plugin-vue": "^9.17.0", "vite": "^4.4.11" } @@ -1860,6 +1861,18 @@ "eslint-plugin-import": "^2.25.2" } }, + "node_modules/eslint-import-resolver-alias": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-alias/-/eslint-import-resolver-alias-1.1.2.tgz", + "integrity": "sha512-WdviM1Eu834zsfjHtcGHtGfcu+F30Od3V7I9Fi57uhBEwPkjDcii7/yW8jAT+gOhn4P/vOxxNAXbFAKsrrc15w==", + "dev": true, + "engines": { + "node": ">= 4" + }, + "peerDependencies": { + "eslint-plugin-import": ">=1.4.0" + } + }, "node_modules/eslint-import-resolver-node": { "version": "0.3.9", "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", @@ -5474,6 +5487,13 @@ "semver": "^6.3.0" } }, + "eslint-import-resolver-alias": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-alias/-/eslint-import-resolver-alias-1.1.2.tgz", + "integrity": "sha512-WdviM1Eu834zsfjHtcGHtGfcu+F30Od3V7I9Fi57uhBEwPkjDcii7/yW8jAT+gOhn4P/vOxxNAXbFAKsrrc15w==", + "dev": true, + "requires": {} + }, "eslint-import-resolver-node": { "version": "0.3.9", "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", diff --git a/package.json b/package.json index f2cc86e..204e70a 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "@vitejs/plugin-vue-jsx": "^3.0.2", "eslint": "^8.49.0", "eslint-config-airbnb-base": "^15.0.0", + "eslint-import-resolver-alias": "^1.1.2", "eslint-plugin-vue": "^9.17.0", "vite": "^4.4.11" }