denoland / deno_lint

Blazing fast linter for JavaScript and TypeScript written in Rust
https://lint.deno.land/
MIT License
1.53k stars 172 forks source link

Lint for unexported types on exported types #1035

Open dsherret opened 2 years ago

dsherret commented 2 years ago

Example failures:

interface SomeInterface {
}

export function myFunc(opts: SomeInterface ) { // fail
}

export class Test implements SomeInterface { // fail
  myMethod(): SomeInterface { // fail
  }
}

/// etc...

This would be a good first start... for a second pass we could maybe consider implementing cross file lints. For example:

// mod.ts
export { myFunc } from "./other.ts"; // fail

// other.ts

export interface MyArg {
 // ...
}

export function myFunc(arg: MyArg) {
  // ...
}
magurotuna commented 1 year ago

This sounds like a reasonable lint rule. I'll implement it.