Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in "The Rules" on front page #1019

Closed
Thom1729 opened this issue Nov 21, 2017 · 3 comments

Comments

@Thom1729
Copy link

commented Nov 21, 2017

  • Never start a line with (, [, or `
    • This is the *only gotcha with omitting semicolons – automatically checked for you!

Emphasis original. If you omit semicolons, you also must not start a line with / (unless you're beginning a comment).

The error is repeated under the Semicolons heading.

@Flet

This comment has been minimized.

Copy link
Member

commented Dec 15, 2017

Huh, Yeah this gives an unexpected token error:

/foo/.test('foo bar')
/bar/.test('foo bar')
@Thom1729

This comment has been minimized.

Copy link
Author

commented Jan 4, 2018

Oh, and also `. You can't safely start a line with a backtick.

@feross

This comment has been minimized.

Copy link
Member

commented May 9, 2018

We only included likely characters in the list of things to watch for. You'll notice in @Flet's example that the return values from the .test method are being discarded, which defeats the whole point of calling .test. For that reason, I've never seen / pose a risk in real code.

However, I've heard others point this out before, so I included the full list of gotcha characters in this commit for completeness: ccbbd92#diff-fc204564835eac10577935faecd0dc71R1304

@feross feross closed this May 9, 2018

@feross feross added the question label May 9, 2018

@lock lock bot locked as resolved and limited conversation to collaborators Aug 7, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
3 participants
You can’t perform that action at this time.