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

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

Open
KingDarBoja opened this issue Jan 20, 2020 · 4 comments
Open
Labels
status: accepting prs Please, send in a PR to resolve this! ✨ type: enhancement New feature or request

Comments

@KingDarBoja
Copy link
Collaborator

🚀 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
Copy link
Member

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.

@JoshuaKGoldberg JoshuaKGoldberg added status: needs investigation Let's dig deeper into this before drawing conclusions. type: enhancement New feature or request labels Jan 20, 2020
@KingDarBoja
Copy link
Collaborator Author

KingDarBoja commented Jan 20, 2020

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 🤔

@KingDarBoja KingDarBoja self-assigned this Jul 18, 2020
@JoshuaKGoldberg JoshuaKGoldberg added status: accepting prs Please, send in a PR to resolve this! ✨ and removed status: needs investigation Let's dig deeper into this before drawing conclusions. labels Sep 16, 2020
@JoshuaKGoldberg
Copy link
Member

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

@KingDarBoja
Copy link
Collaborator Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepting prs Please, send in a PR to resolve this! ✨ type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants