Skip to content

"all" config includes deprecated rules #663

@jdanil

Description

@jdanil

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions