Skip to content

"all" config includes deprecated rules #663

Closed
@jdanil

Description

@jdanil
Contributor

I think I just missed the boat for a major release, but I just wanted to clarify how deprecated rules are handled in this plugin.

Currently the "all" config includes all rules in the rules directory, including deprecated rules that still exist in the source code.

const rulesDir = join(__dirname, 'rules');
const excludedFiles = ['__tests__', 'utils'];

const rules = readdirSync(rulesDir)
  .map(rule => parse(rule).name)
  .filter(rule => !excludedFiles.includes(rule))
  .reduce<Record<string, RuleModule>>(
    (acc, curr) => ({
      ...acc,
      [curr]: importDefault(join(rulesDir, curr)) as RuleModule,
    }),
    {},
  );

const allRules = Object.keys(rules).reduce<
  Record<string, TSESLint.Linter.RuleLevel>
>((rules, key) => ({ ...rules, [`jest/${key}`]: 'error' }), {});

I thought that those deprecated rules might get removed in the next major release. Is that generally the case, or are they expected to remain indefinitely?

Would it make sense for allRules to filter on rule.meta.deprecated?

Activity

SimenB

SimenB commented on Sep 8, 2020

@SimenB
Member

I thought that those deprecated rules might get removed in the next major release. Is that generally the case, or are they expected to remain indefinitely?

Yeah, they were supposed to go away, we just forgot 😅

#579 (comment)
#661

Would it make sense for allRules to filter on rule.meta.deprecated?

That might make sense regardless of them being removed in the next major or not. @G-Rath thoughts?

added a commit that references this issue on Sep 8, 2020
87e29fc
G-Rath

G-Rath commented on Sep 8, 2020

@G-Rath
Collaborator

thoughts

Let's not forget to remove deprecated rules in future majors 😅

Also, I think this sets a predicents we should be careful of, as it's arguably breaking a similar but more subtle way to us removing the deprecated rules in a minor.

I've made a PR for this :)

added a commit that references this issue on Sep 8, 2020
7522fda
SimenB

SimenB commented on Sep 8, 2020

@SimenB
Member
added a commit that references this issue on Sep 12, 2020
f636021
github-actions

github-actions commented on Sep 12, 2020

@github-actions

🎉 This issue has been resolved in version 24.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

jdanil

jdanil commented on Sep 15, 2020

@jdanil
ContributorAuthor

Cheers fellas!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @SimenB@G-Rath@jdanil

      Issue actions

        "all" config includes deprecated rules · Issue #663 · jest-community/eslint-plugin-jest