src/filtered-fix.js
function makeFixer(options) {
  if (typeof options === 'undefined') {
    return true;
  }

  if (typeof options === 'boolean') {
    return options;
  }

  const rulesToFix = options.rules;
  const fixWarnings = options.warnings;

  function ruleFixer(eslintMessage) {
    if (!rulesToFix) return true;

    if (rulesToFix.indexOf(eslintMessage.ruleId) !== -1) {
      return true;
    }
    return false;
  }

  function warningFixer(eslintMessage) {
    if (fixWarnings === false) {
      return eslintMessage.severity === 2;
    }

    return true;
  }

  return function (eslintMessage) {
    return ruleFixer(eslintMessage) && warningFixer(eslintMessage);
  };
}
function makeFixer(options) {
  if (typeof options === 'undefined') {
    return true;
  }

  if (typeof options === 'boolean') {
    return options;
  }

  const rulesToFix = options.rules;
  const fixWarnings = options.warnings;

  function ruleFixer(eslintMessage) {
    if (!rulesToFix) return true;

    if (rulesToFix.indexOf(eslintMessage.ruleId) !== -1) {
      return true;
    }
    return false;
  }

  function warningFixer(eslintMessage) {
    if (fixWarnings === false) {
      return eslintMessage.severity === 2;
    }

    return true;
  }

  return function (eslintMessage) {
    return ruleFixer(eslintMessage) && warningFixer(eslintMessage);
  };
}
function makeFixer ( options ) { if ( typeof options === 'undefined' ) { return true ; } if ( typeof options === 'boolean' ) { return options ; } const rulesToFix = options . rules ; const fixWarnings = options . warnings ; function ruleFixer ( eslintMessage ) { if ( ! rulesToFix ) return true ; if ( rulesToFix . indexOf ( eslintMessage . ruleId ) !== - 1 ) { return true ; } return false ; } function warningFixer ( eslintMessage ) { if ( fixWarnings === false ) { return eslintMessage . severity === 2 ; } return true ; } return function ( eslintMessage ) { return ruleFixer ( eslintMessage ) && warningFixer ( eslintMessage ) ; } ; }
Creates a fixing function or boolean that can be provided as eslint's `fix`
option.

@param  {Object|boolean} options Either an options object, or a boolean
@return {Function|boolean}       `fix` option for eslint
Creates a fixing function or boolean that can be provided as eslint s fix option .