darklua
DocumentationTry itGitHub

remove_comments


Added in 0.7.0

Parameters


NameTypeDescription
except

string array

Comments matching any of the given regular expressions will be kept (added in v0.13.1)

It is important to note that when generating code with the dense or readable generator (e.g. darklua process src --format dense), the comments will already be removed. The only way to retain comments is to use the retain_lines format and avoid this rule.

The except parameter is useful to avoid removing specific comments like --!native (which trigger native compilation of modules when using Luau on Roblox). For example, to avoid removing all comments starting with --!:

{
  rule: "remove_comments",
  except: ["^--!"],
}

Examples


return nil -- this is a comment
InputOutput
return nil -- this is a comment
return nil