From 401d6262eed320465b3fb3eb8a0067fc8bf935b3 Mon Sep 17 00:00:00 2001 From: odanado Date: Mon, 25 Oct 2021 00:44:59 +0900 Subject: [PATCH] fix(typescript): import/named errors when using TypeScript (#170) --- packages/eslint-config-typescript/index.js | 10 +++++++++- packages/eslint-config-typescript/package.json | 3 ++- yarn.lock | 13 ++++++++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/packages/eslint-config-typescript/index.js b/packages/eslint-config-typescript/index.js index 3a54b3ed..297e0f1e 100644 --- a/packages/eslint-config-typescript/index.js +++ b/packages/eslint-config-typescript/index.js @@ -14,5 +14,13 @@ module.exports = { // https://github.com/typescript-eslint/typescript-eslint/blob/1cf9243/docs/getting-started/linting/FAQ.md#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors 'no-undef': 'off' - } + }, + settings: { + 'import/parsers': { + '@typescript-eslint/parser': ['.ts', '.tsx'], + }, + 'import/resolver': { + typescript: {}, + }, + }, } diff --git a/packages/eslint-config-typescript/package.json b/packages/eslint-config-typescript/package.json index ee116345..7f4ffb82 100644 --- a/packages/eslint-config-typescript/package.json +++ b/packages/eslint-config-typescript/package.json @@ -14,7 +14,8 @@ "dependencies": { "@nuxtjs/eslint-config": "6.0.1", "@typescript-eslint/eslint-plugin": "^4.26.1", - "@typescript-eslint/parser": "^4.26.1" + "@typescript-eslint/parser": "^4.26.1", + "eslint-import-resolver-typescript": "2.4.0" }, "peerDependencies": { "eslint": "^7.28.0" diff --git a/yarn.lock b/yarn.lock index 1a41a2a8..24725bb8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2773,6 +2773,17 @@ eslint-import-resolver-node@^0.3.4: debug "^2.6.9" resolve "^1.13.1" +eslint-import-resolver-typescript@2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-2.4.0.tgz#ec1e7063ebe807f0362a7320543aaed6fe1100e1" + integrity sha512-useJKURidCcldRLCNKWemr1fFQL1SzB3G4a0li6lFGvlc5xGe1hY343bvG07cbpCzPuM/lK19FIJB3XGFSkplA== + dependencies: + debug "^4.1.1" + glob "^7.1.6" + is-glob "^4.0.1" + resolve "^1.17.0" + tsconfig-paths "^3.9.0" + eslint-module-utils@^2.6.1: version "2.6.1" resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.6.1.tgz#b51be1e473dd0de1c5ea638e22429c2490ea8233" @@ -5926,7 +5937,7 @@ resolve-from@^5.0.0: resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== -resolve@^1.1.6, resolve@^1.10.0, resolve@^1.10.1, resolve@^1.13.1, resolve@^1.20.0: +resolve@^1.1.6, resolve@^1.10.0, resolve@^1.10.1, resolve@^1.13.1, resolve@^1.17.0, resolve@^1.20.0: version "1.20.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975" integrity sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==