English 中文(简体)
如何使用JSLint与代码 瞄准不同的引擎?
原标题:How to use JSLint with the code aimed to different engines?

例如,考虑以下Node.js代码:

(function () {
    "use strict";
    /*jslint node: true */

    var toBeExecutedInBrowser = function () {
        "use strict";
        /*jslint devel: true */
        alert( Hello world! );
    };

    exports.controller = function (req, res) {
        res.send(toBeExecutedInBrowser.toString());
    };
}());

最新的 JSLint 版本< a href = https:// github. com/douglascrockford/ JSLint/blob/master/jslint.js#L2386" rel= “ nofollow” > 无条件不能够检查此代码。 显然, JSLint 作者不想回答我们在本案中应该做什么, 由他来判断他删除了我的问题; 但也许有人可以回答我在这种情况下应该做什么?

  • I do not want to significantly change the application logic;
  • I do not want to write unsafe code by letting the client-side mode to be executed in a non-strict context (something Douglas Crockford supposedly also wants);
  • I do not want to write unsafe code by disabling JSLint for this file entirely (something Douglas Crockford supposedly also wants);
  • I do not want the JSLint report to be "spammed" by the unnecessary use strict messages, so that it will be possible to overlook something really important.
问题回答

您可能会发现“ 强势” a href = “ http://www.jshint.com/" rel=“ nofollow” > JSHint 很有趣。 它是一个更仁慈的 JSLint 版本。 另外, 它还有一个 NodeJS 选项 。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签