Skip to content

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

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

Closed
bmish opened this issue Aug 1, 2022 · 0 comments · Fixed by #291
Labels

Comments

@bmish
Copy link
Member

bmish commented Aug 1, 2022

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.

@bmish bmish added the bug label Aug 1, 2022
@bmish bmish changed the title Detect suggestions reported with spread and ternary used Detect suggestions reported with spread and ternary used in require-meta-has-suggestions and other rules Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant