Skip to content

no-empty

Forbid empty block statement

INFO

☑️ The predefined configuration "mslint:recommended" enables this rule.

Rule details

This rule prohibits empty block statements.

Example of incorrect code for this rule:

maniascript
Void FunctionA() {

}
main() {
  foreach (A in B) {

  }

  for (I, 0, 10) {

  }

  while (True) {

  }

  meanwhile (True) {

  }

  switch (C) {
    case 1: {

    }
  }

  switchtype (D) {
    case CSmMode: {

    }
  }

  if (True) {

  } else if (True) {

  } else {

  }

  {

  }
}

Example of correct code for this rule:

maniascript
Void FunctionA() {
  DoSomehting();
}
main() {
  foreach (A in B) {
    DoSomehting();
  }

  for (I, 0, 10) {
    DoSomehting();
  }

  while (True) {
    DoSomehting();
  }

  meanwhile (True) {
    DoSomehting();
  }

  switch (C) {
    case 1: {
      DoSomehting();
    }
  }

  switchtype (D) {
    case CSmMode: {
      DoSomehting();
    }
  }

  if (True) {
    DoSomehting();
  } else if (True) {
    DoSomehting();
  } else {
    DoSomehting();
  }

  {
    DoSomehting();
  }
}

Resources