douglascrockford/JSLint — pull request #131 by penartur (2012-05-25 07:36:05+00:00)
Title: "Suppress messages" feature for JSLint

Allows to write code like this:

```javascript
module.exports = {
linter: 'jslint',
linterOptions: {
suppress: { unnecessary_use: true }
}
}
```

or

```javascript
"use strict";

var itWillBeStringifiedAndSentToBrowser = function () {
/*suppress unnecessary_use: true */
"use strict"; //so that the function will be executed in strict environment in browser
}
```

- Implemented `suppress` setting in `options`, in the fashion similar to `predef` setting (e.g. `suppress: ['some_message', 'some_other_message']` or `suppress: { some_message: true, some_other_message: true }`). `true` means that the message should be suppressed, false is the default.
- Implemented setting `suppress` setting inline, in the fashion similar to `/*jslint ... */` and `/*global ... */` (e.g. `/*suppress some_message, some_other_message */` or `/*suppress some_message: true, other_message_suppressed_in_an_external_scope: false */`).
- Changed JSLint processing source code files to respect `suppress` setting; if the error JSLint is about to report is suppressed, it won't report about the error nor include it in its report.
- In order to make this with as less pain as possible, some additional modifications were performed. Namely,
- Previously `warn` always returned some return value. `warn` is used everywhere, but we only cared about the return value in `stop`. Now, only `do_warn` returns a return value, and `do_warn` is only called from `warn` and `stop`. In case error passed to `do_warn` should be suppressed, `do_warn` returns false instead of the detailed error info object.
- In order for `do_warn` to check whether the message should be suppressed, `suppressed_messages` property added to JSLint object.