Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reevaluate the `` property

See original GitHub issue

The problem you want to solve.

There is a rule property mentioned in the Rule Basics documentation that was added along with the Suggestions API / Suggestions RFC:

suggestion (boolean) specifies whether rules can return suggestions (defaults to false if omitted)

There are a few potential problems with this property:

  1. It is missing from some of ESLint’s examples / test cases depicting usage of the suggestions API (more discussion in:
  2. Its name and location are inconsistent with a related property meta.fixable.
  3. Its presence is not enforced, so humans and tooling cannot reliably use it for determining whether a rule provides suggestions (as opposed to meta.fixable whose presence is enforced for autofixable rules) (more discussion in:

Use cases for having a convenient static property to determine which rules are suggestable:

  • Ability to quickly compile a list of suggestable rules
  • Ability to write tests that suggestable rules specify that they are suggestable in their documentation
  • TODO: add any other ideas here

Note that ESLint itself doesn’t currently need to know which rules are suggestable (provide suggestions), whereas it does need to know which rules are fixable, so differences between and meta.fixable could be justified if we wanted to keep as an optional property (as opposed to meta.fixable which is a required property).

Your take on the correct solution to the problem.

There are several potential solutions here of varying size.

  1. Keep as an optional property, fully document it, and add a lint rule eslint-plugin/require-meta-docs-suggestion for those wishing to enforce its presence.
    • Maintains the status quo, no disruption to anyone
    • The property would still be of limited usefulness as we can’t assume plugin rules would provide it
  2. Keep, and begin to enforce its presence as a required property for suggestable rules. Implementation in
    • Ensures that humans and tooling have a reliable means of determining which rules are suggestable
    • But now there would be a noticeable naming/location inconsistency between this property and meta.fixable which would both be required properties
    • This is a breaking change that requires a one-line change in all rules that forgot to specify this property
  3. Remove the property entirely and do not add a replacement for it.
    • Simplifies the API by removing a potentially unnecessary property
    • But now there’s no recommended way to determine what rules provide suggestions
  4. Rename the property to meta.suggestable for consistency with meta.fixable, and enforce its presence for suggestable rules.
    • Ensures that humans and tooling have a reliable means of determining which rules are suggestable
    • Cleans up the API by addressing the naming/location inconsistency with meta.fixable
    • This is a breaking change that requires a one-line change in all suggestable rules

My preferred solution is 4 because it yields the most useful and consistent end-result, although this is also the most disruptive change, so I’m interested to hear what others prefer.

Are you willing to submit a pull request to implement this change?


CC the original RFC/PR author: @ilyavolodin @wdoug

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

bmishcommented, May 6, 2021

I have opened #14573 with the implementation.

btmillscommented, Apr 24, 2021

Coming out of Thursday’s TSC meeting, we’re all aligned around option 4. We discussed suggestions in the meeting since that was the latest idea at the time, but I’d also be fine with hasSuggestions, and like nzakas said, the name is easy to change in the PR.

Since this will be a breaking change, we’ll want to include this in a blog post prior to the v8.0.0 release to give everyone a heads up, and the PR should be included in at least one beta release to give plugin authors time to change the property and ship a new release before v8.0.0 final.

Normally we do RFCs for breaking changes, but hopefully we can use fixable as precedent for the implementation of this property so we don’t have to do a full RFC here. Before you submit an implementation PR, can you leave a comment here outlining what the PR will need to include? That’ll give everyone a chance to look the plan over and make sure we’ve thought of everything before you dive in on the implementation. Thanks for working on this @bmish!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Set the `meta.hasSuggestions` property to `true`. ` ...
js project with npm run build , I am getting following error, I have tried many solution but nothing is working for me....
Read more >
Meta tags - Programmable Search Engine Help
The meta tag contains information about the document. Google understands a standard set of meta tags. You can use custom meta tags to...
Read more >
<meta>: The metadata element - HTML - MDN Web Docs
This attribute contains the value for the http-equiv or name attribute, depending on which is used. Defines a pragma directive.
Read more >
Meta property substitution (changing name of UML property)
Name attribute as a property to customize. Apply the «metaProperty» stereotype. Enter suggested values into the Suggested Values property.
Read more >
Redirects and Google Search | Documentation
meta refresh and its HTTP equivalent ... To set up a JavaScript redirect, set the location property to the redirect target URL in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found