madskristensen / WebAnalyzer

A Visual Studio extension
Other
55 stars 17 forks source link

Using es7 features #21

Open amhed opened 8 years ago

amhed commented 8 years ago

I'm trying to lint my JSX files / use some features from the stage-0 feature set of ES7:

class NotepadComponent extends React.Component {
    static displayName = 'NotepadComponent'

    static defaultProps = {
        activeTab: 'type'
    }
}

This shows a "JSX Parser: Unexpected Token" error.

I can effectively use eslint from my command line using the proper configuration on .eslintrc, but not from the VS window. I tried replicating the same configuration options both via updating the eslint config file under the \Users and global node_modules directories with no avail.

What is the correct place to specify these? here's my current config:

"extends": "defaults/configurations/eslint",
    "parser": "babel-eslint",
    "ecmaFeatures": {
    "jsx": true,
    "classes":  true
    },
    "plugins": [
        "react"
    ],
    "env": {
        "browser": true,
        "node": true,
    "es6": true,
    "jquery":  true
    }
amhed commented 8 years ago

This is the thread I followed to configure eslint and the react plugin to understand static property definition: https://github.com/yannickcr/eslint-plugin-react/issues/43

madskristensen commented 8 years ago

What node modules do you have installed for this to work from the command line?

amhed commented 8 years ago
"dependencies": {
    "babel-eslint": "^4.1.6",
    "babel-plugin-transform-decorators": "^6.4.0",
    "babel-preset-es2015": "~6.3.13",
    "babel-preset-react": "~6.3.13",
    "babel-preset-stage-0": "^6.3.13",
    "eslint-plugin-react": "^3.15.0",
    "gulp": "^3.8.9",
    "gulp-babel": "^6.1.1",
    "gulp-cached": "^1.1.0",
    "gulp-eslint": "^1.1.1"
  },

Testing adding all of these to the global node_modules folder

amhed commented 8 years ago

Still doesn't work :S