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

Bug: RuleCreator leaks internal meta.docs, meta.type types #8695

Closed
4 tasks done
JoshuaKGoldberg opened this issue Mar 17, 2024 · 2 comments
Closed
4 tasks done

Bug: RuleCreator leaks internal meta.docs, meta.type types #8695

JoshuaKGoldberg opened this issue Mar 17, 2024 · 2 comments
Assignees
Labels
accepting prs Go ahead, send a pull request that resolves this issue breaking change This change will require a new major version to be released bug Something isn't working
Milestone

Comments

@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commented Mar 17, 2024

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Relevant Package

utils

Playground Link

https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbzgUQMoBlgDsYFUbAA2AznAL5wBmUEIcA5AAIwCeYApsQMZTBgwBaToWwwA9AFcCJegG4AUPPYAPSLDhcIWYvCgTC7OAF4UGUfiLEAdACV97AMJR2AQxjQrAd2AwAFhCkAEQguYgAKBHk4DWc3djDNHBUYAEpEKOi4ZxgJKCx0zMyASQATdhxgSmB2KDCsCDK0yMLCxJhkq2c1GAi4EE5iFwBzdlKALjgAIhUXcANJgBo4erLyFIUW8gzosgyyBYyyyhd9GAB5fmAtYgmAbQBdA+j+mBcJ5sySkJuClrLuXiXLQTej0J4tZyaED9LBlEogyG0GFwsHbTIQPw1CYwPTscE7fF9AbDTjvNHRGZzdgTSZnXzLCAAQkmaP2aNYHBBhBcLACMFRhW4vnYIDecAeewOZHWiiAA

Repro Code

import { ESLintUtils } from '@typescript-eslint/utils';

export const rule = ESLintUtils.RuleCreator.withoutDocs({
  create(context) {
    return {
      Identifier(node) {
        context.report({ messageId: "example", node });
      }
    }
  },
  defaultOptions: [],
  meta: {
    docs: {
      description: '',
      recommended: 'recommended',
      other: true,
    },
    messages: {
      example: "Oh no!"
    },
    type: 'layout',
    schema: []
  },
});

ESLint Config

n/a

tsconfig

n/a

Expected Result

Custom rules in community plugins shouldn't be tied into our types for what goes into a rule's meta.docs. Plugins might define their own, potentially different documentation metadata & strategies.

Maybe we should make meta.docs type... Record<string, unknown> for consumers? Or a type parameter on RuleCreator that defaults to Record<string, unknown>?

Actual Result

Additional Info

See also:

Versions

package version
@typescript-eslint/utils 7.2.0

💖

@JoshuaKGoldberg JoshuaKGoldberg added bug Something isn't working triage Waiting for maintainers to take a look breaking change This change will require a new major version to be released labels Mar 17, 2024
@JoshuaKGoldberg JoshuaKGoldberg changed the title Bug: RuleCreator leaks internal meta.docs types Bug: RuleCreator leaks internal meta.docs, meta.type types Apr 4, 2024
@JoshuaKGoldberg
Copy link
Member Author

#8833 shows that this impacts meta.type too.

@JoshuaKGoldberg JoshuaKGoldberg added accepting prs Go ahead, send a pull request that resolves this issue and removed triage Waiting for maintainers to take a look labels Apr 28, 2024
@JoshuaKGoldberg JoshuaKGoldberg self-assigned this Apr 28, 2024
@JoshuaKGoldberg JoshuaKGoldberg added this to the 8.0.0 milestone Apr 28, 2024
@JoshuaKGoldberg
Copy link
Member Author

#9025 is merged into the v8 branch. ✅

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepting prs Go ahead, send a pull request that resolves this issue breaking change This change will require a new major version to be released bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant