How to use the eslint-rule-composer.joinReports function in eslint-rule-composer

To help you get started, we’ve selected a few eslint-rule-composer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DianaSuvorova / eslint-plugin-react-redux / lib / filterReports.js View on Github external
module.exports = (rules, filterNode, filterAll) => filterReports(ruleComposer.joinReports(rules), filterNode, filterAll);
github babel / babel / eslint / babel-eslint-plugin / src / rules / semi.js View on Github external
message = "Extra semicolon.";
    loc = loc.start;
    fix = function(fixer) {
      return fixer.remove(lastToken);
    };
  }

  context.report({
    node,
    loc,
    message,
    fix,
  });
};

const semiRuleWithClassProperty = ruleComposer.joinReports([
  semiRule,
  context => ({
    ClassProperty(node) {
      const options = context.options[1];
      const exceptOneLine = options && options.omitLastInOneLineBlock === true;

      const sourceCode = context.getSourceCode();
      const lastToken = sourceCode.getLastToken(node);

      if (context.options[0] === "never") {
        if (isUnnecessarySemicolon(context, lastToken)) {
          report(context, node, true);
        }
      } else {
        if (!isSemicolon(lastToken)) {
          if (!exceptOneLine || !isOneLinerBlock(context, node)) {

eslint-rule-composer

A utility for composing ESLint rules from other ESLint rules

MIT
Latest version published 7 years ago

Package Health Score

67 / 100
Full package analysis