Skip to content

Commit

Permalink
enable @typescript-eslint/consistent-type-assertions (#3232)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimaMachina committed Jun 14, 2023
1 parent cf8cc55 commit e4863cc
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ module.exports = {
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/non-nullable-type-assertion-style': 'error',
'@typescript-eslint/consistent-type-assertions': 'error',
// TODO: Fix all errors for the following rules included in recommended config
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
Expand Down
3 changes: 2 additions & 1 deletion packages/monaco-graphql/src/initializeMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function initializeMode(
): MonacoGraphQLAPI {
if (!api) {
api = createMonacoGraphQLAPI(LANGUAGE_ID, config);
(<any>languages).graphql = { api };
(languages as any).graphql = { api };
// export to the global monaco API

// eslint-disable-next-line promise/prefer-await-to-then -- ignore to leave initializeMode sync
Expand All @@ -35,6 +35,7 @@ export function initializeMode(

return api;
}

function getMode(): Promise<typeof GraphQLMode> {
return import('./graphqlMode');
}
4 changes: 2 additions & 2 deletions packages/monaco-graphql/src/languageFeatures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,9 @@ export class HoverAdapter implements monaco.languages.HoverProvider {
const hoverItem = await worker.doHover(resource.toString(), position);

if (hoverItem) {
return <monaco.languages.Hover>{
return {
range: hoverItem.range,
contents: [{ value: hoverItem.content }],
contents: [{ value: hoverItem.content as string }],
};
}

Expand Down
2 changes: 1 addition & 1 deletion packages/monaco-graphql/src/monaco.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export { LANGUAGE_ID };
languages.onLanguage(LANGUAGE_ID, () => {
const api = initializeMode();

(<any>languages).graphql = { api };
(languages as any).graphql = { api };
});
/**
* Register the language mode without schema or any settings, so you can configure them asynchronously.
Expand Down

0 comments on commit e4863cc

Please sign in to comment.