typescript-eslint / tslint-to-eslint-config

Converts your TSLint configuration to the closest possible ESLint equivalent. 🚀
MIT License
849 stars 100 forks source link

Add notice instead of logging missing rules for external code analyzer #315

Open KingDarBoja opened 4 years ago

KingDarBoja commented 4 years ago

🚀 Feature Request

Following #151 example, if you try to convert TSLint rules into ESLint ones for some projects that make use of external static code analyzer like as Elm language client VSCode, you will see a long tslint-to-eslint-config.log file whose content is the following:

arguments-order does not yet have an ESLint equivalent.
bool-param-default does not yet have an ESLint equivalent.
cognitive-complexity does not yet have an ESLint equivalent.
consecutive-overloads does not yet have an ESLint equivalent.
jsdoc-format does not yet have an ESLint equivalent.
max-switch-cases does not yet have an ESLint equivalent.
max-union-size does not yet have an ESLint equivalent.
no-accessor-field-mismatch does not yet have an ESLint equivalent.
no-all-duplicated-branches does not yet have an ESLint equivalent.
no-alphabetical-sort does not yet have an ESLint equivalent.
no-array-delete does not yet have an ESLint equivalent.
no-big-function does not yet have an ESLint equivalent.
no-case-with-or does not yet have an ESLint equivalent.
no-collapsible-if does not yet have an ESLint equivalent.
no-collection-size-mischeck does not yet have an ESLint equivalent.
no-commented-code does not yet have an ESLint equivalent.
no-dead-store does not yet have an ESLint equivalent.
no-duplicate-in-composite does not yet have an ESLint equivalent.
no-duplicate-string does not yet have an ESLint equivalent.
no-duplicated-branches does not yet have an ESLint equivalent.
no-element-overwrite does not yet have an ESLint equivalent.
no-empty-array does not yet have an ESLint equivalent.
no-empty-destructuring does not yet have an ESLint equivalent.
no-extra-semicolon does not yet have an ESLint equivalent.
no-gratuitous-expressions does not yet have an ESLint equivalent.
no-hardcoded-credentials does not yet have an ESLint equivalent.
no-identical-conditions does not yet have an ESLint equivalent.
no-identical-expressions does not yet have an ESLint equivalent.
no-identical-functions does not yet have an ESLint equivalent.
no-ignored-initial-value does not yet have an ESLint equivalent.
no-ignored-return does not yet have an ESLint equivalent.
no-in-misuse does not yet have an ESLint equivalent.
no-invalid-await does not yet have an ESLint equivalent.
no-invariant-return does not yet have an ESLint equivalent.
no-inverted-boolean-check does not yet have an ESLint equivalent.
no-misleading-array-reverse does not yet have an ESLint equivalent.
no-misspelled-operator does not yet have an ESLint equivalent.
no-multiline-string-literals does not yet have an ESLint equivalent.
no-nested-switch does not yet have an ESLint equivalent.
no-nested-template-literals does not yet have an ESLint equivalent.
no-redundant-boolean does not yet have an ESLint equivalent.
no-redundant-jump does not yet have an ESLint equivalent.
no-redundant-parentheses does not yet have an ESLint equivalent.
no-reference-import does not yet have an ESLint equivalent.
no-return-type-any does not yet have an ESLint equivalent.
no-same-line-conditional does not yet have an ESLint equivalent.
no-self-assignment does not yet have an ESLint equivalent.
no-small-switch does not yet have an ESLint equivalent.
no-statements-same-line does not yet have an ESLint equivalent.
no-try-promise does not yet have an ESLint equivalent.
no-unconditional-jump does not yet have an ESLint equivalent.
no-undefined-argument does not yet have an ESLint equivalent.
no-unenclosed-multiline-block does not yet have an ESLint equivalent.
no-unthrown-error does not yet have an ESLint equivalent.
no-unused-array does not yet have an ESLint equivalent.
no-use-of-empty-return-value does not yet have an ESLint equivalent.
no-useless-cast does not yet have an ESLint equivalent.
no-useless-catch does not yet have an ESLint equivalent.
no-useless-increment does not yet have an ESLint equivalent.
no-useless-intersection does not yet have an ESLint equivalent.
no-variable-usage-before-declaration does not yet have an ESLint equivalent.
object-literal-sort-keys does not yet have an ESLint equivalent.
parameters-max-number does not yet have an ESLint equivalent.
prefer-default-last does not yet have an ESLint equivalent.
prefer-immediate-return does not yet have an ESLint equivalent.
prefer-optional does not yet have an ESLint equivalent.
prefer-promise-shorthand does not yet have an ESLint equivalent.
prefer-type-guard does not yet have an ESLint equivalent.
prettier does not yet have an ESLint equivalent.
use-primitive-type does not yet have an ESLint equivalent.
use-type-alias does not yet have an ESLint equivalent.
editor.insertSpaces does not yet have an ESLint equivalent.
editor.tabSize does not yet have an ESLint equivalent.

As you can check at the source code, the tslint.json extends from tslint-sonarts, which is another static code analyzer for Typescript. The rule list can be found at readme at SonarTS repo.

Existing Behavior

The above log file is being generated with tons of rules that are not supported by ESLint.

Change Proposal

Provide a notice which states external code analyzer are not supported by ESLint.

I am not sure if this should be of concern but I had to bring int into discussion.

Cheers!

JoshuaKGoldberg commented 4 years ago

Yeah this is a good question... The messaging here is a little better post-#299 but still not perfect. I wonder what the best way to tackle this would be. Would it be doable to statically detect through the TSLint project extensions that the rules are coming from a community plugin? If so, yay! - accepting PRs. If not, let's think a little bit more.

KingDarBoja commented 4 years ago

I think it is possible to do something like detecting the author of the package, if the name is not included on some array which stores official TSLint repo owners, then it will be a community plugin.

To retrieve the author data, we can use pacote as npm relies on it to fetch package metadata,

EDIT I checked this comment on SonarTS repo and looks like they already provide some way of migration to their own ESLint rules.

Maybe provide a custom message per community plugin could be useful too 🤔

JoshuaKGoldberg commented 3 years ago

@KingDarBoja you assigned yourself back in 2020; do you still have time to look at this? I can if not!

KingDarBoja commented 3 years ago

Sure, go ahead, I got pretty busy and lacking free time to look at these at the time being 😢