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

Bug: no-fallthrough rule doesn't work well with labeled statements #1379

Open
marvinhagemeister opened this issue Dec 13, 2024 · 0 comments
Open

Comments

@marvinhagemeister
Copy link
Contributor

maybeFlag: if (isFlagProp(i)) {
  const type = getTypeId(ctx, offset);
  const flags = readValue(ctx, offset, AST_PROP_INTERNAL_FLAGS);

  switch (i) {
    case AST_PROP_OPERATOR:
      switch (type) {
        case AstType.AssignmentExpression:
          return getAssignOperator(flags);
        case AstType.BinaryExpression:
          return getBinaryOperator(flags);
        case AstType.UpdateExpression:
          return (flags & Flags.UpdatePlusPlus) !== 0 ? "++" : "--";
        default:
          break maybeFlag; // <-- Errors here
      }
    case AST_PROP_PREFIX:
      return (flags & Flags.UpdatePrefix) !== 0;
    case AST_PROP_OPTIONAL:
      return (flags & Flags.FnOptional) !== 0;
    case AST_PROP_ASYNC:
      return (flags & Flags.FnAsync) !== 0;
    case AST_PROP_GENERATOR:
      return (flags & Flags.FnGenerator) !== 0;
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant