具有no-undef规则的eslint对象简写规则

时间:2017-08-25 05:16:36

标签: javascript reactjs visual-studio-code eslint

我使用create-react-app创建了一个新的React(v15.6.1)项目。这段代码

const Range = {
    Near, Far
}

在VSCode报告中生成ESlint“'近'未定义。(no-undef)”(Far具有相同的错误。)

代码编译,但错误有点分散注意力。

这是.eslintrc

{
    "extends": "react-app",
    "rules": {
        "object-shorthand": [
            2,
            "always"
        ]
    }
}

有没有办法同时使用object-shorthandno-undef

编辑:

抱歉,我误解了速记文字:

> a = 3
3
> b = {a}
{ a: 3 }

这应该证明它的用法。

0 个答案:

没有答案
相关问题