Getting Facebook's react.js library JSX syntax to play nicely with jslint?

前端 未结 7 1396
死守一世寂寞
死守一世寂寞 2021-01-30 05:19

I am playing around with the Facebook\'s react.js library. I am trying to use their JSX syntax which describes creating a view in the following way.

/** @jsx Rea         


        
7条回答
  •  难免孤独
    2021-01-30 05:47

    Amey's answer is correct but also could be updated today:

    Pair of eslint and eslint-plugin-react now support es6+jsx+react so babel-eslint is needed only if you use some specific stuff like class properties, decorators, async/await, types.

    Example .eslintrc configuration for react+jsx+es6 without babel-eslint:

    {
        "parserOptions": {
            "ecmaVersion": 6,
            "sourceType": "module",
            "ecmaFeatures": {
                "jsx": true
            }
        },
        "rules": {
            "semi": 0
        },
        "plugins": [
            "react"
        ],
        "extends": ["eslint:recommended", "plugin:react/recommended"]
    }
    

    You can just look at eslint-plugin-react instructions for further details/information.

提交回复
热议问题