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

Clarification of config in package.json #15

Closed
dthree opened this issue Aug 24, 2015 · 5 comments
Closed

Clarification of config in package.json #15

dthree opened this issue Aug 24, 2015 · 5 comments

Comments

@dthree
Copy link

dthree commented Aug 24, 2015

I use spaces, so runnign xo --space works fine.

However, when trying to throw this into my package.json, this doesn't seem to accept args like ESLINT would:

  "xo": {
    "envs": ["node", "mocha"],
    "rules": {
      "indent": [2, 2, {"SwitchCase": 1}],
    }
  }  

This isn't applying two-space indentation.

Am I missing something?

@dthree
Copy link
Author

dthree commented Aug 24, 2015

NVM. Had a trailing comma in package.json, and so XO just up and ignored it.

It would be really cool if XO could catch that it isn't reading package.json due to malformed JSON and warn the user!

@dthree dthree closed this as completed Aug 24, 2015
@markogresak
Copy link

I'd recommend you to install a JSON plugin in your editor, it should detect and highlight malformed JSON. If you're using atom, that should work by default.
Although adding an error message to notify the user of error in package.json wouldn't be very difficult.

@dthree
Copy link
Author

dthree commented Aug 24, 2015

I'll do that for sure. But adding the error would be the kind of one-up that makes packages like XO awesome.

@sindresorhus
Copy link
Member

Sure. Btw, use the space: true option instead of "rules": {"indent": [2, 2, {"SwitchCase": 1}]}.

@dthree
Copy link
Author

dthree commented Aug 24, 2015

Thanks and will do :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants