eslint / archive-website

The ESLint website
https://eslint.org
MIT License
95 stars 244 forks source link

Cleanup the rules list in Rules Configuration of Demo #878

Closed pubmikeb closed 2 years ago

pubmikeb commented 2 years ago

The Demo section has very useful .eslintrc.json configurator, the only problem it contains deprecated, duplicated, and actual rules.

It would be great:

  1. to remove duplicated (renamed) rules/aliases, e.g. id-blacklist vs. id-denylist.
  2. to split the Demo's Rules section to two sections:
    • actual rules
    • deprecated rules

So we could in one click activate just actual rules, not caring about deprecated ones.

nzakas commented 2 years ago

We would gladly accept a pull request for these changes. :)

pubmikeb commented 2 years ago

@nzakas , I've have a look on Configuration.jsx which is looks like to be responsible for Demo content:

<RulesConfig
    config={this.props.options.rules}
    ruleNames={this.props.ruleNames}
    docs={this.props.docs}
    onUpdate={this.handleRulesConfigUpdate}
/>

Unfortunately, I don't see where this.props.options.rules is populated and if this list contains a rule state property (e.g. ative/deprecated).

nzakas commented 2 years ago

It looks like it’s coming from here: https://github.com/eslint/website/blob/c7ee67d8deec5c0d347c0f62b94a4ed8f6da72af/src/js/demo/components/App.jsx#L225

Each rule has a meta property that should give you the data you need: https://github.com/eslint/eslint/blob/44f7de5ee4d934dee540d3d55305126c670f6bfc/lib/rules/no-process-exit.js#L14

pubmikeb commented 2 years ago

I'll give a look on it on the coming weekend and will let you know, if I can arrange a PR.

pubmikeb commented 2 years ago

Unfortunately, currently I can't allocate enough time to implement the issue in a reasonable time.

nzakas commented 2 years ago

No worries. Unfortunately the demo is a pretty low priority for the team right now so it’s unlikely this will get addressed anytime soon. I’ll leave the issue open in case anyone else wants to take this.

snitin315 commented 2 years ago

I opened a PR that will differentiate the deprecated rules by adding (deprecated) next to the rule.