deno_lint icon indicating copy to clipboard operation
deno_lint copied to clipboard

Doesn't recognise rules with @typescript-eslint prefix

Open golergka opened this issue 4 years ago • 3 comments

I've only just discovered this package and tried to use it as in-place replacement for ESLint. However, although the package readme says that it supports all @typescript-eslint rules, they seem to have different names here — without the prefix.

Lint Name

@typescript-eslint/no-explicit-any or any other @typescript-eslint rule.

Code Snippet

// eslint-disable-next-line @typescript-eslint/no-explicit-any
function isPoolClient(p: any): p is PoolClient {

Expected Result

deno_lint recognizes @typescript-eslint/no-explicit-any rule as no-explicit-any rule.

Actual Result

error[ban-unknown-rule-code]: Unknown rule for code "@typescript-eslint/no-explicit-any"
 --> /Users/golergka/Projects/pg-tx/src/client.ts:3:1
  |
3 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
error[no-explicit-any]: `any` type is not allowed
 --> /Users/golergka/Projects/pg-tx/src/client.ts:4:26
  |
4 | function isPoolClient(p: any): p is PoolClient {
  |                          ^^^
  |
  = help: Use a specific type other than `any`

Additional Info

Version

Used with node via @node-rs/deno-lint package, version 1.9.2.

golergka avatar Oct 02 '21 10:10 golergka

I thought we had this working, but looks like it doesn't. IIRC this somehow conflicted with other rules we have like no-unused-ignore and proposed solution was to add "aliases" to rule names (so a single rule can be known as no-explicit-any or @typescript-eslint/no-explicit-any). I guess this is still desirable to ease the migration from existing tools.

@magurotuna any thoughts on this?

bartlomieju avatar Oct 02 '21 13:10 bartlomieju

@bartlomieju Adding aliases to rule names sounds great to me.

magurotuna avatar Oct 03 '21 11:10 magurotuna

Thanks for clarifying that this is indeed intended behaviour! It actually wasn't completely sure if this linter is intended as a drop-in and highly compatible replacement of ESLint after reading the docs. If it is, would you accept a PR that clarified that? (Or may be I'm just bad at reading documentation and it's actually stated there loud and clear).

golergka avatar Oct 03 '21 11:10 golergka