我正在尝试将ESLint应用于Cordova + Meteor应用程序(具体而言:Inkstone)。我发现一个简单的自动配置+ find -name '*.js' | xargs -n1 eslint
并不能满足我的要求-我收到很多错误消息,如下所示:
[14:42:00] git:(master*) d33tah@d33tah-pc:/home/d33tah/workspace/inkstone(0) > eslint client/templates/teach/code.js
/data/home/d33tah/workspace/inkstone/client/templates/teach/code.js
36:21 error 'ReactiveDict' is not defined no-undef
41:29 error 'Meteor' is not defined no-undef
43:7 error 'fixMedianCoordinates' is assigned a value but never used no-unused-vars
61:3 error '$' is not defined no-undef
75:18 error '_' is not defined no-undef
89:3 error '$' is not defined no-undef
90:7 error '$' is not defined no-undef
91:11 error '$' is not defined no-undef
124:13 error '$' is not defined no-undef
183:17 error '_' is not defined no-undef
186:5 error '$' is not defined no-undef
211:5 error Unexpected console statement no-console
226:5 error Unexpected console statement no-console
250:14 error '_' is not defined no-undef
298:34 error 'skip_confirmation' is defined but never used no-unused-vars
304:3 error 'Meteor' is not defined no-undef
308:1 error 'Template' is not defined no-undef
312:1 error 'Template' is not defined no-undef
317:1 error 'Template' is not defined no-undef
319:24 error '$' is not defined no-undef
323:1 error 'Template' is not defined no-undef
324:51 error 'event' is defined but never used no-unused-vars
329:7 error 'Router' is not defined no-undef
331:7 error Unexpected console statement no-console
334:33 error 'event' is defined but never used no-unused-vars
341:5 error 'Router' is not defined no-undef
344:28 error 'event' is defined but never used no-unused-vars
366:1 error 'Template' is not defined no-undef
377:1 error 'Template' is not defined no-undef
379:1 error 'Tracker' is not defined no-undef
✖ 30 problems (30 errors, 0 warnings)
在我的配置中,似乎ESlint似乎无法遵循import
。我的一个朋友告诉我,所有的希望都丧失了,因为ESLint仅基于每个文件运行,而我能做的最好的事情就是设置“全局变量”,它不会检查API是否被正确遵循,而只是忽略那些导入。这是唯一的方法吗?如果不是,我应该怎么做才能使ESLint跟随我链接到的项目(Inkstone)中的导入?如果是,我是否需要针对此类问题的特定于框架的工具,或者是否已对此进行了概括并找到了解决方案?