Closed
Description
Ideally, disabling lints will piggyback on a general method to disable warnings via source annotations in the analyzer. Pending resolution there, and perhaps to encourage it, this ticket is meant to kick off the conversation specific to disabling linting (but really about configuring the analyzer in general).
By way of a motivational example, take the following.
class BoxBad {
var _contents;
get contents => _contents;
}
which triggers a lint suggesting we should prefer a public final field to a getter
in this instance. Suppose, just this once, we'd like to suppress that warning. How would that look?
Some prior art to get the juices flowing.
/*eslint-disable no-alert, no-console */
alert('foo');
console.log('bar');
/*eslint-enable no-alert */
alert('foo'); // eslint-disable-line
// jscs:disable requireCurlyBraces
if (x) y(); // all errors from requireCurlyBraces on this line will be ignored
// jscs:enable requireCurlyBraces
if (z) a(); // all errors, including from requireCurlyBraces, on this line will be reported
/* jshint undef: true, unused: true */
// Code here will be linted with JSHint.
/* jshint ignore:start */
// Code here will be ignored by JSHint.
/* jshint ignore:end */
ignoreThis(); // jshint ignore:line
# pylint: disable=unused-argument
print self\
+ "foo"
# rubocop:disable Metrics/LineLength, Style/StringLiterals
[...]
for x in (0..19) # rubocop:disable Style/AvoidFor
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", Justification = "Reviewed. Suppression is OK here.")]
public class MyUndocumentedClass
{
public void MyUndocumentedMethod
{
}
}
/* tslint:disable */
/* tslint:disable:rule1 rule2 rule3... */
[…]