Parcourir la source

HUE-9392 [ui] Apply new TS linter rules

Johan Ahlen il y a 5 ans
Parent
commit
5f8c150ea5

+ 4 - 2
desktop/core/src/desktop/js/sql/reference/apiCache.ts

@@ -26,7 +26,8 @@ const getStore = (connector: Connector) =>
     name: `HueUdfCatalog_${VERSION}_${connector.id}`
   });
 
-export const clearUdfCache = async (connector: Connector) => await getStore(connector).clear();
+export const clearUdfCache = async (connector: Connector): Promise<void> =>
+  await getStore(connector).clear();
 
 export const getCachedUdfCategories = async (
   connector: Connector,
@@ -37,4 +38,5 @@ export const setCachedUdfCategories = async (
   connector: Connector,
   database: string | undefined,
   categories: UdfCategory[]
-) => await getStore(connector).setItem(database || GLOBAL_UDF_CACHE_KEY, categories);
+): Promise<UdfCategory[]> =>
+  await getStore(connector).setItem(database || GLOBAL_UDF_CACHE_KEY, categories);

+ 1 - 1
desktop/core/src/desktop/js/sql/reference/apiUtils.test.ts

@@ -14,7 +14,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-import { adaptApiFunctions, ApiUdf, extractArgumentTypes, mergeArgumentTypes} from './apiUtils';
+import { adaptApiFunctions, ApiUdf, extractArgumentTypes, mergeArgumentTypes } from './apiUtils';
 
 describe('apiUtils.js', () => {
   it('should return the default signature when not defined', () => {

+ 2 - 2
desktop/core/src/desktop/js/sql/reference/apiUtils.ts

@@ -15,7 +15,7 @@
 // limitations under the License.
 
 import { simplePostAsync } from 'api/apiUtils';
-import { AUTOCOMPLETE_API_PREFIX, DESCRIBE_API_PREFIX } from 'api/urls';
+import { AUTOCOMPLETE_API_PREFIX } from 'api/urls';
 import { UdfArgument, UdfDetails } from 'sql/reference/types';
 import { Connector } from 'types';
 import I18n from 'utils/i18n';
@@ -81,7 +81,7 @@ export const extractArgumentTypes = (apiUdf: ApiUdf): UdfArgument[][] => {
   return DEFAULT_ARGUMENTS;
 };
 
-export const mergeArgumentTypes = (target: UdfArgument[][], additional: UdfArgument[][]) => {
+export const mergeArgumentTypes = (target: UdfArgument[][], additional: UdfArgument[][]): void => {
   for (let i = 0; i < target.length; i++) {
     if (i >= additional.length) {
       break;

+ 0 - 5
desktop/core/src/desktop/js/sql/reference/sqlReferenceRepository.ts

@@ -33,18 +33,13 @@ export const DESCRIBE_UDF_EVENT = 'hue.describe.udf';
 export const UDF_DESCRIBED_EVENT = 'hue.udf.described';
 
 const SET_REFS: { [attr: string]: () => Promise<{ SET_OPTIONS?: SetOptions }> } = {
-  // @ts-ignore
   impala: async () => import(/* webpackChunkName: "impala-ref" */ './impala/setReference')
 };
 
 const UDF_REFS: { [attr: string]: () => Promise<{ UDF_CATEGORIES?: UdfCategory[] }> } = {
-  // @ts-ignore
   generic: async () => import(/* webpackChunkName: "generic-ref" */ './generic/udfReference'),
-  // @ts-ignore
   hive: async () => import(/* webpackChunkName: "hive-ref" */ './hive/udfReference'),
-  // @ts-ignore
   impala: async () => import(/* webpackChunkName: "impala-ref" */ './impala/udfReference'),
-  // @ts-ignore
   pig: async () => import(/* webpackChunkName: "pig-ref" */ './pig/udfReference')
 };
 

+ 1 - 0
desktop/core/src/desktop/js/types/web-component-wrapper/index.d.ts

@@ -1,3 +1,4 @@
 declare module '@vue/web-component-wrapper' {
+  // eslint-disable-next-line @typescript-eslint/no-explicit-any
   export default function wrap(Vue: any, Component: any): any;
 }

+ 2 - 2
desktop/core/src/desktop/js/vue/components/login/TrademarkBanner.vue

@@ -4,9 +4,9 @@
   </div>
 </template>
 
-<script>
+<script lang="ts">
 export default {
-  data() {
+  data(): {} {
     return {};
   }
 };