Linter Options
List of all available linter options
The aslint tool included with Apache Royale has a number of useful configuration options. The list below is also available by running aslint -help advanced
in a terminal.
-class-name
– Ensures that class names match the pattern^[A-Z][a-zA-Z0-9]*$
. Default:false
-constant-name
– Ensures that constant names match the pattern^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$
. Default:false
-empty-comment
– Checks for comments that contain no text. Default:false
-empty-function-body
– Checks for empty function bodies. Default:false
-empty-nested-block
– Checks for empty blocks, except for bodies of classes, interfaces, and functions. Default:false
-empty-statement
– Checks for statements that consist of only a semicolon. Default:true
-field-name
– Ensures that field names match the pattern^[_a-z][a-zA-Z0-9]*$
. Default:false
-function-name
– Ensures that function names match the pattern^[a-z][a-zA-Z0-9]*$
. Default:false
-help
[keyword]
[...]
– Displays linter usage instructions.-ignore-parsing-problems
– If enabled, parsing errors will be ignored. This may result in undesirable effects. Default:true
-interface-name
– Ensures that interface names match the pattern^I[A-Z][a-zA-Z0-9]*$
. Default:false
-line-comment-position
<string>
– Requires single-line comments to appear at a specific position. Supported values:above
,beside
-load-config
<filename>
– Loads an XML configuration file with more linter options.-local-var-param-name
– Ensures that no local variables use the same name as one of the method’s parameters. Default:false
-local-var-shadows-field
– Ensures that no local variables use the same name as one of the class’ fields. Default:false
-max-block-depth
<int>
– Checks that no nested blocks exceed a specific depth.-max-params
<int>
– Ensures that no method has more than the specified number of parameters.-missing-asdoc
– Checks for missing or empty asdoc comments. Default:false
-missing-constructor-super
– Checks for missing calls tosuper()
in constructor. Default:false
-missing-namespace
– Checks for missing namespaces on classes, interfaces, fields, and methods. Default:false
-missing-semicolon
– Checks for missing semicolons. Default:false
-missing-type
– Checks for missing variable types, method parameter types, and method return types. Default:false
-mxml-empty-attr
– Checks for MXML attributes that contain no value. Default:false
-mxml-id
– Ensures that MXMLid
values match the pattern^[a-z][a-zA-Z0-9]*$
. Default:false
-no-any-type
– Ensures that the*
type is never used. Default:false
-no-boolean-equality
– Checks for==
or!=
operators that redundantly compare totrue
orfalse
. Default:false
-no-constructor-dispatch
– Ensures that no events are dispatched from a constructor. Default:false
-no-constructor-return-type
– Ensures that no return type is specified on a constructor. Default:false
-no-duplicate-keys
– Checks for duplicate keys in object literals. Default:true
-no-dynamic-class
– Ensurse that no class uses thedynamic
modifier. Default:false
-no-if-boolean
– Checks forif (true)
orif (false)
, which will always have the same result. Default:true
-no-leading-zero
– Checks for numeric values with a leading0
, which can be confused for octal notation. Default:true
.-no-sparse-array
– Checks for empty slots in array literals, where there is no value between commas. Default:true
.-no-string-event
– Ensures that strings are not passed toaddEventListener
,removeEventListener
, orhasEventListener
. Default:false
-no-this-closure
– Ensures that thethis
keyword is not used inside closures. Default:false
-no-trace
– Ensures that the code contains notrace()
function calls. Default:false
-no-void-operator
– Ensures that thevoid
operator is never used. Thevoid
type is allowed. Default:false
-no-wildcard-import
– Checks for imports that contain the*
wildcard character. Default:false
-no-with
– Ensures that thewith
keyword is never used. Default:true
-override-super
– Checks for method overrides that contain only calls to thesuper
method. Default:false
-package-name
– Ensures that package names match the pattern^[a-z][a-zA-Z0-9]*(\\.[a-z][a-zA-Z0-9]*)*$
. Default:false
-skip-local-config-file
– Ignores aslint-config.xml in the current working directory, if it exists. Default:false
-static-constants
– Requires all constants on classes to have thestatic
modifier. Default:false
-strict-equality
– Ensures that comparisions use===
or!==
instead of==
or!=
. Default:false
-switch-default
– Checks that allswitch
statements have adefault
case. Default:false
-unsafe-negation
– Ensures that the!
negation operator is used safely within
,is
, andinstanceof
. Default:true
-valid-typeof
– Checks the result of thetypeof
operator for invalid strings. Default:true
-vars-on-top
– Requires all local variables to be declared at the top of a function. Default:false
-version
– Displays the version number of the linter tool.