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

lint: update @typescript-eslint, fix warnings #5054

Merged
merged 5 commits into from
May 24, 2024
Merged

lint: update @typescript-eslint, fix warnings #5054

merged 5 commits into from
May 24, 2024

Conversation

justinmk3
Copy link
Contributor

closes #5034

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@justinmk3 justinmk3 requested a review from a team as a code owner May 24, 2024 09:52
@@ -37,7 +36,7 @@ export default ESLintUtils.RuleCreator.withoutDocs({
meta: {
docs: {
description: 'disallow awaiting on vscode notifications if the response is unused',
recommended: 'error',
recommended: 'recommended',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'error' is not a valid value here, apparently

Problem:
After updating to @typescript-eslint/parser 7.x, importing '@typescript-eslint/types/dist/generated/ast-spec' fails:

    lib/rules/no-await-on-vscode-msg.ts(15,34): error TS2307: Cannot find module '@typescript-eslint/types/dist/generated/ast-spec' or its corresponding type declarations.
    lib/rules/no-await-on-vscode-msg.ts(40,13): error TS2322: Type '"error"' is not assignable to type 'RuleRecommendation | RuleRecommendationAcrossConfigs<never[]> | undefined'.
    lib/rules/no-only-in-tests.ts(13,62): error TS2307: Cannot find module '@typescript-eslint/types/dist/generated/ast-spec' or its corresponding type declarations.
    lib/rules/no-only-in-tests.ts(32,13): error TS2322: Type '"error"' is not assignable to type 'RuleRecommendation | RuleRecommendationAcrossConfigs<never[]> | undefined'.
    lib/rules/no-only-in-tests.ts(60,25): error TS2322: Type '`${any}OnlyErrMsg`' is not assignable to type '"describeOnlyErrMsg" | "itOnlyErrMsg"'.

Solution:
Import from '@typescript-eslint/utils' instead.
Comment on lines 28 to 29
switch (message.eventType) {
case 'GENERATE_CLICKED':
case TelemetryType.GENERATE_CLICKED:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is another small disadvantage of enums. If a type was used, the literal value could be used instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better now to switch it from enum in to a type instead? It looks safe to do

@justinmk3 justinmk3 force-pushed the lint branch 2 times, most recently from cccad7c to c89208e Compare May 24, 2024 12:17
@justinmk3 justinmk3 merged commit 020f6f7 into master May 24, 2024
14 checks passed
@justinmk3 justinmk3 deleted the lint branch May 24, 2024 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants