Error Filters

mrjoelkemp edited this page Nov 8, 2014 · 1 revision

Error filters are a way to choose which errors should be reported.

The main use case for this is if you have legacy code with tons of style errors but only want to report errors relevant to your changes. See issue #335 as an example.

An error filter can be defined as follows:

"errorFilter": function(error) {
  // Analyze the error object...

  // Return false to NOT report this error
  // Return true to report this error 
  return false;

The error argument is of the following format:

  filename: '',
  rule: '',
  message: '',
  line: 0,
  column: 0

Supply the path to your filter function in your JSCS config:

"errorFilter": "path/to/myFilter.js"