Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tslint-clean-code] Missing converters #1208

Open
rafaelss95 opened this issue Sep 1, 2021 · 0 comments
Open

[tslint-clean-code] Missing converters #1208

rafaelss95 opened this issue Sep 1, 2021 · 0 comments
Labels
area: missing converter A rule converter should exist but doesn't yet. good first issue Good for newcomers; welcome aboard! status: accepting prs Please, send in a PR to resolve this! ✨

Comments

@rafaelss95
Copy link
Contributor

💥 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) :)

@JoshuaKGoldberg JoshuaKGoldberg added area: missing converter A rule converter should exist but doesn't yet. good first issue Good for newcomers; welcome aboard! status: accepting prs Please, send in a PR to resolve this! ✨ labels Oct 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: missing converter A rule converter should exist but doesn't yet. good first issue Good for newcomers; welcome aboard! status: accepting prs Please, send in a PR to resolve this! ✨
Projects
None yet
Development

No branches or pull requests

2 participants