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

standard confuses string with missing quotes and new class instance without brackets #725

Closed
lukechilds opened this issue Dec 19, 2016 · 6 comments

Comments

@lukechilds
Copy link

commented Dec 19, 2016

If I have the code:

const onionoo = new Onionoo()

to create a new instance of the Onionoo class but leave off the brackets:

const onionoo = new Onionoo

standard says:

standard: Use JavaScript Standard Style (http://standardjs.com)
standard: Run `standard --fix` to automatically fix some problems.

/Users/lukechilds/Dev/oss/onionoo-node-client/test/unit.js
  18:19  error  Missing '

It seems like maybe it assumes Onionoo is a string without quotes. It would be better if it would warn that there are no parenthesis on the class (or not warn at all, not sure of the pros/cons of leaving off parenthesis). I would assume this would be fairly easy to fix by checking if the new keyword is directly before the string.

@lukechilds

This comment has been minimized.

Copy link
Author

commented Dec 19, 2016

Just realised standard uses eslint under the hood, should I be reporting this there?

@dcousens

This comment has been minimized.

Copy link
Member

commented Dec 19, 2016

@lukechilds yup 👍

@lukechilds

This comment has been minimized.

Copy link
Author

commented Dec 19, 2016

@dcousens according to ESLint this appears to be an issue with standard. It gets reported correctly as Missing '()' invoking a constructor. (new-parens) with vanilla ESLint.

eslint/eslint#7792

@dcousens dcousens reopened this Dec 19, 2016

@dcousens

This comment has been minimized.

Copy link
Member

commented Dec 19, 2016

@lukechilds actually, it appears to be an issue on your end 😛

var Onionoo
const onionoo = new Onionoo

console.log(onionoo)
standard: Use JavaScript Standard Style (http://standardjs.com)
standard: Run `standard --fix` to automatically fix some problems.
  /home/daniel/test.js:2:17: Missing '()' invoking a constructor.

Do you have a test case we could try?

@dcousens dcousens closed this Dec 19, 2016

@dcousens dcousens reopened this Dec 19, 2016

@lukechilds

This comment has been minimized.

Copy link
Author

commented Dec 19, 2016

Ahhhh, found the culprit!

It's not doing it if I call standard directly but if I call snazzy it does with the exact same input.

$ standard
standard: Use JavaScript Standard Style (http://standardjs.com)
standard: Run `standard --fix` to automatically fix some problems.
  /Users/lukechilds/Dev/oss/onionoo-node-client/test/unit.js:14:19: Missing '()' invoking a constructor.

$ snazzy
standard: Use JavaScript Standard Style (http://standardjs.com)
standard: Run `standard --fix` to automatically fix some problems.

/Users/lukechilds/Dev/oss/onionoo-node-client/test/unit.js
  14:19  error  Missing '

✖ 1 problem

Should I open the issue on snazzy? 😆

@dcousens dcousens closed this Dec 19, 2016

@dcousens

This comment has been minimized.

Copy link
Member

commented Dec 19, 2016

@lukechilds I think so, feel free to post back and we'll re-open if needed 👍

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018

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