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

pub struct 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:

This example is not tested
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

This example is not tested
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

This example is not tested
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]

pub fn new() -> Self[src]

Trait Implementations

impl Clone for NoUnexpectedMultiline[src]

impl CstRule for NoUnexpectedMultiline[src]

impl Debug for NoUnexpectedMultiline[src]

impl Default for NoUnexpectedMultiline[src]

impl<'de> Deserialize<'de> for NoUnexpectedMultiline[src]

impl Rule for NoUnexpectedMultiline[src]

impl Serialize for NoUnexpectedMultiline[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.