Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

ES6+ linting #25

Closed
Extra-lightwill opened this issue Apr 15, 2017 · 8 comments
Closed

ES6+ linting #25

Extra-lightwill opened this issue Apr 15, 2017 · 8 comments
Assignees

Comments

@Extra-lightwill
Copy link

I have a component which uses ES6+ features e.g.

myComponent extends React.Component { static propTypes = {

This throws a syntax error as expected because it is an ES6+ feature. In the past I have installed the relevant npm modules e.g. ("babel-preset-stage-0":) and altered the babel.rc file and it has been successful but even with these additions in this setup, i'm still getting syntax errors:

My babel.rc file looks like this

{
  "presets": [
    ["env", {
      "targets": {
        "node": true
      }
    }],
    "react",
    "stage-0",
    "es2015"
  ]
}

Package.json:

"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",

@hellojere
Copy link

I have a similar issue whilst trying to use ES7 decorators. I managed to get it running on development by adding transform-decorators-legacy and transform-class-properties to /kit/webpack/browser.js, but couldn't figure out a way that would work for production as well.

Having these in .babelrc didn't work at all.

Any tips appreciated.

@leebenson leebenson self-assigned this Apr 15, 2017
@leebenson
Copy link
Owner

Thanks for reporting. I'll add ES7 support to the next release, hopefully tomorrow.

.babelrc is solely to kick-start the Webpack build process; all code-level syntax is handled inside the browser.js and server.js Webpack config files in kit/webpack, so that's where plugins and transforms need to go.

Will report back here when decorator and static support is added.

@jtmthf
Copy link
Contributor

jtmthf commented Apr 16, 2017

I'm all for supporting some esnext features, but I would recommend only enabling specific transforms that are popular instead of setting stage-x presets. There's some talk among the Babel contributors on removing stage-x presets in the next version anyways due to the danger of their use and difficulty maintaining.

@leebenson
Copy link
Owner

Agreed @jtmthf - presets like stage-0 are too broad, and would defeat the purpose of the more selective env preset. This enhancement would be specifically about adding static class properties and decorators.

@leebenson
Copy link
Owner

Moving this to reactql/kit#2

@leebenson
Copy link
Owner

Decorators and static properties have been now added to the kit

@hellojere
Copy link

Thanks a million! Off topic, but is there an official way to upgrade an existing project created with the CLI?

@leebenson
Copy link
Owner

@hellojere - my pleasure. Upgrading-- unfortunately not. Please see my comment here for some more thoughts on upgrading.

TL;DR- Since this is a starter kit rather than an imported framework, kit + custom code live side-by-side, making it tricky to upgrade without overwriting changes. The easiest way to upgrade is to create a new project, copy over src and then manually make any changes to the kit that may have changed between versions.

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

No branches or pull requests

4 participants