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

FECS不支持new-cap特性 #339

Open
ghost opened this issue Jan 8, 2019 · 1 comment
Open

FECS不支持new-cap特性 #339

ghost opened this issue Jan 8, 2019 · 1 comment

Comments

@ghost
Copy link

ghost commented Jan 8, 2019

在开发小程序的时候,fecs总是在报 Page 或者 Component 的错误,在网上查了一下,这个ESlint里面有 “new-cap” 属性支持,参见:https://eslint.org/docs/2.0.0/rules/new-cap。
添加下方代码理论上应该可以解决问题:

"rules": {
                "fecs-camelcase": [2, {
                    "ignore": ["Page", "Component"]
                }],
                "new-cap": [2, {
                    "capIsNewExceptions": ["Page", "Component"],
                    "capIsNewExceptionPattern": ["Page", "Component"]
                }]
            },

但是FECS看起来貌似并不支持这个,并且在官方文档 https://github.com/ecomfe/fecs/wiki/FAQ#%E5%A6%82%E4%BD%95%E4%BF%AE%E5%A4%8D%E4%BD%BF%E7%94%A8-jquery-%E7%9A%84-datatable-%E6%8F%92%E4%BB%B6%E7%9A%84%E9%97%AE%E9%A2%98 里写到:

根据规范,只允许构造函数的首字母大写。而对构造函数的调用,需要使用 new 操作符。因为上面的代码可以改成以下三种方式:.....

希望官方可以支持这种配置,不然这个检查会一直报错。谢谢各位大大。

@ghost
Copy link
Author

ghost commented Jan 9, 2019

重新补一张图
c01001bd9941b6b072a3b717c

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

No branches or pull requests

0 participants