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

[question] jsx config #612

Closed
crobinson42 opened this issue Sep 5, 2016 · 4 comments

Comments

@crobinson42
Copy link

commented Sep 5, 2016

I'm new to using standard and linters in general (I know, burnn!) I'm getting errors on my JSX and would like to know how to config/setup standard to recognize JSX.

I simply installed with npm i standard and run standard on a simple React component w/ JSX and get this error:

$ node_modules/standard/bin/cmd.js
standard: Use JavaScript Standard Style (http://standardjs.com)
  /Users/willlyrob/projects/react-job-app-form/src/index.jsx:11:7: Parsing error: Unexpected token <

I don't see any specific configuration options for standard to use with JSX in my .js files. I also tried renaming the file to .jsx and did not help anything.

@timoxley

This comment has been minimized.

Copy link
Contributor

commented Sep 5, 2016

Standard supports jsx. This doesn't look like the latest standard. Try reinstalling with the latest version.. If that doesn't work perhaps post the code you are trying to lint.

@crobinson42

This comment has been minimized.

Copy link
Author

commented Sep 5, 2016

I checked the package.json and it's "version": "8.0.0"

Here's the code:

import React from 'react'

export default class Component extends React.Component {
  constructor (props) {
    super(props)
    this.state = {}
  }

  render () {
    let title = this.props.title

    return {
      <div>
        {title}
      </div>
    }
  }
}
@crobinson42

This comment has been minimized.

Copy link
Author

commented Sep 5, 2016

Oh! Duh- I have a config for JSX set :-/ Sorry. It's expecting (<div></div>) not <div></div>!

@crobinson42 crobinson42 closed this Sep 5, 2016

@crobinson42

This comment has been minimized.

Copy link
Author

commented Sep 5, 2016

thx for the quick response btw- AWESOME util/tool!

@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.