Skip to content

Detect suggestions reported with spread and ternary used in require-meta-has-suggestions and other rules #272

@bmish

Description

@bmish

Some of our rules need to be able to detect when suggestions are reported.

I found a situation where we fail to unwrap the suggestions: https://github.com/typescript-eslint/typescript-eslint/blob/ad412cdd74dc5619fbe4bf27c0a5eb5c5a4b65ca/packages/eslint-plugin/src/rules/no-empty-interface.ts#L86

context.report({
  node: node.id,
  messageId: 'noEmptyWithSuper',
  ...(useAutoFix
    ? { fix }
    : {
        suggest: [
          {
            messageId: 'noEmptyWithSuper',
            fix,
          },
        ],
      }),
});

Alternatively: require-meta-has-suggestions and require-meta-fixable could check for a suggest or fix property anywhere in the file and assume that this counts as a fixer or suggestions.

This issue is not specific to TypeScript.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions