[−][src]Struct rslint_core::groups::errors::NoInnerDeclarations
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]
impl NoInnerDeclarations
[src]
pub fn disallow_all() -> Self
[src]
Trait Implementations
impl Clone for NoInnerDeclarations
[src]
fn clone(&self) -> NoInnerDeclarations
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl CstRule for NoInnerDeclarations
[src]
fn check_node(&self, node: &SyntaxNode, ctx: &mut RuleCtx) -> Option<()>
[src]
fn check_token(&self, token: &SyntaxToken, ctx: &mut RuleCtx) -> Option<()>
[src]
fn check_root(&self, root: &SyntaxNode, ctx: &mut RuleCtx) -> Option<()>
[src]
impl Debug for NoInnerDeclarations
[src]
impl Default for NoInnerDeclarations
[src]
impl<'de> Deserialize<'de> for NoInnerDeclarations where
NoInnerDeclarations: Default,
[src]
NoInnerDeclarations: Default,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Rule for NoInnerDeclarations
[src]
fn name(&self) -> &'static str
[src]
fn group(&self) -> &'static str
[src]
fn docs(&self) -> &'static str
[src]
impl Serialize for NoInnerDeclarations
[src]
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> DynClone for T where
T: Clone,
[src]
T: Clone,
fn __clone_box(&self, Private) -> *mut ()
[src]
impl<T> Erasable for T
unsafe fn unerase(this: NonNull<Erased>) -> NonNull<T>
const ACK_1_1_0: bool
fn erase(this: NonNull<Self>) -> NonNull<Erased>
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Serialize for T where
T: Serialize + ?Sized,
[src]
T: Serialize + ?Sized,
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<Ok, Error>
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,