From c204a970d4aaced5674923352d45d90aa43830ca Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Tue, 19 Jul 2022 21:07:21 +0800 Subject: [PATCH] feat!(wip): remove resolver-webpack, add resolver-custom-alias Because ESLint is synchronous by design, while webpack and vite's config could be asynchorous, it's neither safe nor feature-complete to read the build tool's configuration to determine the aliases. It's better to expose an API for the user to configure it by themself. --- packages/eslint-config-standard/index.js | 7 +------ packages/eslint-config-standard/package.json | 13 ++----------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/packages/eslint-config-standard/index.js b/packages/eslint-config-standard/index.js index 9fff674..ba6a110 100644 --- a/packages/eslint-config-standard/index.js +++ b/packages/eslint-config-standard/index.js @@ -3,12 +3,7 @@ const resolver = { [require.resolve('eslint-import-resolver-node')]: {}, } -// in case the project does not depend on @vue/cli-service -try { - resolver[require.resolve('eslint-import-resolver-webpack')] = { - config: require.resolve('@vue/cli-service/webpack.config.js'), - } -} catch (e) {} +// TODO: API for custom aliases module.exports = { extends: [ diff --git a/packages/eslint-config-standard/package.json b/packages/eslint-config-standard/package.json index 879bb55..7d1af1f 100644 --- a/packages/eslint-config-standard/package.json +++ b/packages/eslint-config-standard/package.json @@ -23,6 +23,7 @@ "homepage": "https://github.com/vuejs/eslint-config-standard#readme", "dependencies": { "eslint-config-standard": "^17.0.0", + "eslint-import-resolver-custom-alias": "^1.3.0", "eslint-import-resolver-node": "^0.3.6", "eslint-plugin-import": "^2.25.2", "eslint-plugin-n": "^15.0.0", @@ -30,16 +31,6 @@ "eslint-plugin-vue": "^8.7.1" }, "peerDependencies": { - "@vue/cli-service": "^3.0.0 || ^4.0.0 || ^5.0.0", - "eslint": "^8.0.1", - "eslint-import-resolver-webpack": "^0.13.2" - }, - "peerDependenciesMeta": { - "@vue/cli-service": { - "optional": true - }, - "eslint-import-resolver-webpack": { - "optional": true - } + "eslint": "^8.0.1" } }