[−][src]Struct rslint_core::groups::errors::NoUnexpectedMultiline
Disallow confusing newlines in expressions.
JavaScript has automatic semicolon insertion, where newlines end statements, however, expressions can often span across newlines, therefore it can become a bit confusing at times and ambiguous. Take the following as an example:
let foo = bar
/bar/g.test("foo");
you would expect this to be a variable declaration and then a regex test, however, it is actually a division expression as such: `(bar / bar) / (g.test("foo")). This rule is aimed at preventing ambiguous and buggy expressions such like these. It disallows ambiguous tagged templates, property accesses, function calls, and division expressions.
Invalid Code Examples
var foo = bar
(1 || 2).baz();
var foo = 'bar'
[1, 2, 3].forEach(addNumber);
let x = function() {}
`foo`
let x = function() {}
x
`bar`
let x = foo
/regex/g.test(bar)
Correct Code Examples
var foo = bar;
(1 || 2).baz();
var foo = 'bar';
[1, 2, 3].forEach(addNumber);
let x = function() {};
`foo`
let x = function() {};
x;
`bar`
let x = foo;
/regex/g.test(bar)
Implementations
impl NoUnexpectedMultiline
[src]
Trait Implementations
impl Clone for NoUnexpectedMultiline
[src]
fn clone(&self) -> NoUnexpectedMultiline
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl CstRule for NoUnexpectedMultiline
[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 NoUnexpectedMultiline
[src]
impl Default for NoUnexpectedMultiline
[src]
fn default() -> NoUnexpectedMultiline
[src]
impl<'de> Deserialize<'de> for NoUnexpectedMultiline
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Rule for NoUnexpectedMultiline
[src]
impl Serialize for NoUnexpectedMultiline
[src]
Auto Trait Implementations
impl RefUnwindSafe for NoUnexpectedMultiline
impl Send for NoUnexpectedMultiline
impl Sync for NoUnexpectedMultiline
impl Unpin for NoUnexpectedMultiline
impl UnwindSafe for NoUnexpectedMultiline
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,
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>,