[][src]Struct rslint_core::groups::errors::NoInnerDeclarations

pub struct NoInnerDeclarations {
    pub disallowed: Vec<String>,
}

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

impl NoInnerDeclarations[src]

pub fn new() -> Self[src]

impl NoInnerDeclarations[src]

pub fn disallow_all() -> Self[src]

Trait Implementations

impl Clone for NoInnerDeclarations[src]

impl CstRule for NoInnerDeclarations[src]

impl Debug for NoInnerDeclarations[src]

impl Default for NoInnerDeclarations[src]

impl<'de> Deserialize<'de> for NoInnerDeclarations where
    NoInnerDeclarations: Default
[src]

impl Rule for NoInnerDeclarations[src]

impl Serialize for NoInnerDeclarations[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> DynClone for T where
    T: Clone
[src]

impl<T> Erasable for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Serialize for T where
    T: Serialize + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.