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

Indicate which rules provide suggestions in readme rules table #1306

Merged
merged 11 commits into from
May 21, 2021

Conversation

bmish
Copy link
Sponsor Contributor

@bmish bmish commented May 20, 2021

Fixes #1292.

This is another useful point of information about rules that we can include in our readme rules table.

Note that this property name/location will likely change slightly in ESLint 8 and become enforced so that it will be more reliable: eslint/eslint#14312

@bmish bmish force-pushed the readme-suggestions-table branch from 568016b to 2068ea1 Compare May 20, 2021 17:52
@fisker
Copy link
Collaborator

fisker commented May 20, 2021

Actually, we can test this, some code here https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/test/utils/test.mjs should work.

@bmish
Copy link
Sponsor Contributor Author

bmish commented May 20, 2021

Actually, we can test this, some code here https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/test/utils/test.mjs should work.

Added a test to ensure meta.docs.suggestion is present in suggestable rules, is that what you had in mind?

@fisker
Copy link
Collaborator

fisker commented May 21, 2021

Yes, but add it to snapshot tester too, please.

bmish and others added 3 commits May 20, 2021 23:17
Co-authored-by: fisker Cheung <lionkay@gmail.com>
Co-authored-by: fisker Cheung <lionkay@gmail.com>
@@ -112,6 +117,7 @@ class Tester {
const tester = snapshotRuleTester(test, {
parserOptions: defaultParserOptions
});
verifySuggestionPropertyConsistency(this.rule, tests.invalid);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This won't work because snapshot tester don't need set errors, should check here

const {suggestions = []} = message;

Copy link
Sponsor Contributor Author

Choose a reason for hiding this comment

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

Fixed.

test/utils/test.mjs Outdated Show resolved Hide resolved
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.

Add suggestion property to rule meta
3 participants