Skip to content

[tslint-clean-code] Missing converters #1208

Open
@rafaelss95

Description

@rafaelss95

💥 Missing Converter

  • tslint-to-eslint-config version: 2.9.1
  • typescript-eslint version: 7.32.0

TSLint Rule Name

TSLint Rule ESLint Rule
id-length https://eslint.org/docs/rules/id-length
max-func-args https://eslint.org/docs/rules/max-params
min-class-cohesion Not found.
newspaper-order Not found.
no-commented-out-code See the explanation below.
no-complex-conditionals https://eslint.org/docs/rules/complexity
no-feature-envy https://github.com/pksilen/eslint-plugin-clean-code#supported-rules (not sure about this, because it's a somewhat unknown package).
no-flag-args https://github.com/foxglove/eslint-plugin/tree/main/rules#foxgloveno-boolean-parameters (not sure about this, because it's a somewhat unknown package).
no-for-each-push See explanation below.
no-map-without-usage https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-ignored-return.md (note that it does not only report map, but any ignored result of predefined function calls that doesn’t have any side effects).
prefer-dry-conditionals https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-switch.md
try-catch-first Not found.

no-commented-out-code: Found https://github.com/bahmutov/eslint-rules#no-commented-out-code, however this package seems to not to be updated anymore and this specific rule has several issues described in that repo and in proposed versions: eslint/eslint#604, eslint/eslint#2735

no-for-each-push: There's no direct equivalent, we could suggest eslint-plugin-github/array-foreach, but it forbids all usages of forEach and eslint-plugin-fp/no-mutating-methods to forbid push, however it forbids all array mutable methods.
Another possibility would be suggest the use of no-restricted-syntax:

{
  "rules": {
    "no-restricted-syntax": [
      "error",
      {
        selector:
          "CallExpression[callee.property.name='forEach']:has(:matches(ArrowFunctionExpression, FunctionExpression) CallExpression[callee.property.name='push'])",
        message: "Prefer to use `.map` or `.reduce` instead of `.forEach` + `.push`.",
      },
    ]
  }
}

no-map-without-usage: Just for completeness, there are some related links: eslint/eslint#12269, eslint/eslint#12980 and typescript-eslint/typescript-eslint#2509.

Package Source

TSLint package: https://github.com/Glavin001/tslint-clean-code (issue asking for a ESLint port)
ESLint package: ❌

I'd like to work on this, if accepted (just let me know how I should procceed) :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: missing converterA rule converter should exist but doesn't yet.good first issueGood for newcomers; welcome aboard!status: accepting prsPlease, send in a PR to resolve this! ✨

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions