Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable @typescript-eslint/consistent-type-assertions #3232

Merged
merged 1 commit into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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