Struct rslint_core::groups::errors::NoInnerDeclarations [−][src]
Expand description
Disallow variable and function declarations in nested blocks.
Prior to ECMAScript 6, function declarations were only allowed in the first level of a program or the body of another function, although parsers sometimes incorrectly accept it. This rule only applies to function declarations, not function expressions.
Invalid Code Examples
function foo() {
if (bar) {
// Move this to foo's body, outside the if statement
function bar() {}
}
}
if (bar) {
var foo = 5;
}
Correct Code Examples
function foo() {}
var bar = 5;
Fields
disallowed: Vec<String>
What declarations to disallow in nested blocks, it can include two possible options: “functions” and “variables”, you can include either or, or both. Disallows only functions by default.
Implementations
Trait Implementations
Check an individual node in the syntax tree.
You can use the match_ast
macro to make matching a node to an ast node easier.
The reason this uses nodes and not a visitor is because nodes are more flexible,
converting them to an AST node has zero cost and you can easily traverse surrounding nodes.
Defaults to doing nothing. Read more
Check an individual token in the syntax tree. Defaults to doing nothing. Read more
Check the root of the tree one time.
This method is guaranteed to only be called once.
The root’s kind will be either SCRIPT
or MODULE
.
Defaults to doing nothing. Read more
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
A list of tags present on this rule. Empty by default.
Whether this rule is recommended, this is a simple helper around Self::tags
.
Auto Trait Implementations
impl RefUnwindSafe for NoInnerDeclarations
impl Send for NoInnerDeclarations
impl Sync for NoInnerDeclarations
impl Unpin for NoInnerDeclarations
impl UnwindSafe for NoInnerDeclarations
Blanket Implementations
Mutably borrows from an owned value. Read more
Whether this implementor has acknowledged the 1.1.0 update to
unerase
’s documented implementation requirements. Read more