From 4eeee4c2eb49a46d1c98d93f4c93bbffee5d8164 Mon Sep 17 00:00:00 2001 From: Jesse Yang Date: Tue, 15 Sep 2020 15:33:49 -0700 Subject: [PATCH] chore: enable eslint-import-resolver-typescript (#10895) Let eslint understand tsconfig.json when importing modules, so we can use `compilerOption.paths` to override where to find ts modules. --- superset-frontend/.eslintrc.js | 5 +- superset-frontend/package-lock.json | 53 +++++++++++++++++++ superset-frontend/package.json | 1 + .../components/controls/TextAreaControl.jsx | 1 + superset-frontend/src/featureFlags.ts | 1 + 5 files changed, 60 insertions(+), 1 deletion(-) diff --git a/superset-frontend/.eslintrc.js b/superset-frontend/.eslintrc.js index cdd7c9c886ec7..906a976ae860f 100644 --- a/superset-frontend/.eslintrc.js +++ b/superset-frontend/.eslintrc.js @@ -127,7 +127,10 @@ module.exports = { 'prettier/prettier': 'error', }, settings: { - 'import/resolver': 'webpack', + 'import/resolver': { + webpack: {}, + typescript: {}, + }, react: { version: 'detect', }, diff --git a/superset-frontend/package-lock.json b/superset-frontend/package-lock.json index 6b3df9840111e..07765d2c84101 100644 --- a/superset-frontend/package-lock.json +++ b/superset-frontend/package-lock.json @@ -25067,6 +25067,59 @@ } } }, + "eslint-import-resolver-typescript": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-2.3.0.tgz", + "integrity": "sha512-MHSXvmj5e0SGOOBhBbt7C+fWj1bJbtSYFAD85Xeg8nvUtuooTod2HQb8bfhE9f5QyyNxEfgzqOYFCvmdDIcCuw==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "glob": "^7.1.6", + "is-glob": "^4.0.1", + "resolve": "^1.17.0", + "tsconfig-paths": "^3.9.0" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "resolve": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", + "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } + } + } + }, "eslint-import-resolver-webpack": { "version": "0.12.2", "resolved": "https://registry.npmjs.org/eslint-import-resolver-webpack/-/eslint-import-resolver-webpack-0.12.2.tgz", diff --git a/superset-frontend/package.json b/superset-frontend/package.json index 79069ef11bbb8..839dec8a20cc2 100644 --- a/superset-frontend/package.json +++ b/superset-frontend/package.json @@ -235,6 +235,7 @@ "eslint": "^7.8.1", "eslint-config-airbnb": "^18.2.0", "eslint-config-prettier": "^6.11.0", + "eslint-import-resolver-typescript": "^2.3.0", "eslint-import-resolver-webpack": "^0.12.2", "eslint-plugin-cypress": "^2.11.1", "eslint-plugin-import": "^2.22.0", diff --git a/superset-frontend/src/explore/components/controls/TextAreaControl.jsx b/superset-frontend/src/explore/components/controls/TextAreaControl.jsx index 060fe8887d963..d0c33ec4ef284 100644 --- a/superset-frontend/src/explore/components/controls/TextAreaControl.jsx +++ b/superset-frontend/src/explore/components/controls/TextAreaControl.jsx @@ -65,6 +65,7 @@ export default class TextAreaControl extends React.Component { this.onAceChange(value); }, 300); } + onControlChange(event) { this.props.onChange(event.target.value); } diff --git a/superset-frontend/src/featureFlags.ts b/superset-frontend/src/featureFlags.ts index 35817c74bf72c..c8cdc26fa2ac6 100644 --- a/superset-frontend/src/featureFlags.ts +++ b/superset-frontend/src/featureFlags.ts @@ -33,6 +33,7 @@ export type FeatureFlagMap = { [key in FeatureFlag]?: boolean; }; +// eslint-disable-next-line @typescript-eslint/no-unused-vars declare global { interface Window { featureFlags: FeatureFlagMap;