Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

CI testNext failures with [email protected] #4863

Closed
adidahiya opened this issue Sep 30, 2019 · 1 comment · Fixed by #4866
Closed

CI testNext failures with [email protected] #4863

adidahiya opened this issue Sep 30, 2019 · 1 comment · Fixed by #4866

Comments

@adidahiya
Copy link
Contributor

https://circleci.com/gh/palantir/tslint/17859?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link

test/rules/return-undefined/default/test.ts.lint: Failed!
Expected (from .lint file)
Actual (from TSLint)
  class Promise<T> {
      then(): Promise<T>;
  }
  function valueWrong(): number | undefined {
      return;
      ~~~~~~~ [Value-returning function should use `return undefined;`, not just `return;`.]
  }
  function valueRight(): number | undefined {
      return undefined;
  }
  
  function voidWrong(): void {
      return undefined;
      ~~~~~~~~~~~~~~~~~ [`void` function should use `return;`, not `return undefined;`.]
  }
  function voidRight(): void {
      return;
  }
  
  // Infers type from context.
  [].forEach(() => {
      return undefined;
      ~~~~~~~~~~~~~~~~~ [`void` function should use `return;`, not `return undefined;`.]
  });
  [].map<number | undefined>(() => {
      return;
      ~~~~~~~ [Value-returning function should use `return undefined;`, not just `return;`.]
  });
  
  type Cb = () => void;
  declare function badContextualType(cb: Cb | Cb[]): void;
  // Uses typeAtLocation instead of contextual type.
  badContextualType(() => {
      if (1 === 2) return 1;
      else return;
           ~~~~~~~ [Value-returning function should use `return undefined;`, not just `return;`.]
  });
  
  // Allow anything in callback taking 'any'.
  function takesAnyCb(cb: () => any): void;
  takesAnyCb(() => { return; });
  takesAnyCb(() => { return undefined; });
  takesAnyCb(() => {
      if (1 === 2) return;
      else return 1;
  });
  takesAnyCb(() => {
      if (1 === 2) return;
      else return undefined;
  });
  takesAnyCb((): void => {
      if (1 === 2) return;
      else return undefined;
           ~~~~~~~~~~~~~~~~~ [`void` function should use `return;`, not `return undefined;`.]
  });
  
  async function promiseVoid(): Promise<void> {
      if (1 === 2) return;
-                  ~~~~~~~ [Value-returning function should use `return undefined;`, not just `return;`.]
      else return undefined;
+          ~~~~~~~~~~~~~~~~~ [`void` function should use `return;`, not `return undefined;`.]
  }
  
  async function promiseValue(): Promise<number | undefined> {
      if (1 === 2) return 1;
      else return;
           ~~~~~~~ [Value-returning function should use `return undefined;`, not just `return;`.]
  }
  
  declare function test(cb: () => Promise<void> | void): void;
  
  test(async () => {
      if (1 === 2) return;
-                  ~~~~~~~ [Value-returning function should use `return undefined;`, not just `return;`.]
      else return undefined;
+          ~~~~~~~~~~~~~~~~~ [`void` function should use `return;`, not `return undefined;`.]
  });
  
  
  function * generator(returnNothing: boolean) {
      if (returnNothing) return;
      yield 1;
      return yield * [2, 3];
  }
  
  class ClassWithGeneratorMethod {
      * generatorMethod(returnNothing: boolean) {
          if (returnNothing) return;
          yield 1;
      }
  }
@JoshuaKGoldberg
Copy link
Contributor

🤖 Beep boop! 👉 TSLint is deprecated 👈 and you should switch to typescript-eslint! 🤖

🔒 This issue is being locked to prevent further unnecessary discussions. Thank you! 👋

@palantir palantir locked and limited conversation to collaborators Sep 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants