8000 `suggest#fix` shouldn't be optional · Issue #3948 · typescript-eslint/typescript-eslint · GitHub
[go: up one dir, main page]

Skip to content
suggest#fix shouldn't be optional #3948
Closed
@rafaelss95

Description

@rafaelss95
  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.

Repro
Currently, the fix within suggest is optional, however it shouldn't. Even if we forget to use it, ESLint give us this error.

context.report({
  node,
  messageId,
  suggest: [{ messageId: messageIdSuggest }] // missing `fix` and no error
})

Expected Result

context.report({
  node,
  messageId,
  suggest: [{ messageId: messageIdSuggest }] // error - missing `fix`
})

Actual Result
No errors being shown.

Additional Info
Maybe a solution would be:

type ReportSuggestionArray<TMessageIds extends string> =
- ReportDescriptorBase<TMessageIds>[];
+  (ReportDescriptorBase<TMessageIds> & {
+    readonly fix: ReportFixFunction | null;
+  })[];

Versions

package version
@typescript-eslint/experimental-utils 4.3.2
TypeScript 4.4.3
node 14.16.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpackage: utilsIssues related to the @typescript-eslint/utils package

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0