How to use the stylelint.formatters.string function in stylelint

To help you get started, we’ve selected a few stylelint 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 uswds / uswds / config / gulp / sass.js View on Github external
const ignoreStylelintIgnoreWarnings = lintResults =>
  formatters.string(
    lintResults.reduce((memo, result) => {
      const { warnings } = result;
      const fileIsIgnored = warnings.some(warning =>
        RegExp(IGNORE_STRING, "i").test(warning.text)
      );

      if (!fileIsIgnored) {
        memo.push(result);
      }

      return memo;
    }, [])
  );
github dynatrace-oss / barista / tools / builders / stylelint / index.ts View on Github external
try {
    lintingOutcome = await lint({
      configFile: join(systemRoot, options.stylelintConfig),
      files,
    });

    if (lintingOutcome.errored) {
      context.logger.error(ERROR_MESSAGE);
    } else {
      context.logger.info(SUCCESS_MESSAGE);
    }

    const errors = lintingOutcome.results.filter(result => result.errored);

    if (errors.length) {
      context.logger.info(formatters.string(errors));
    }

    if (options.reportFile) {
      await junitFormatter(options.reportFile, lintingOutcome.results);
    }
  } catch (error) {
    context.logger.error(error.message);
  }

  return {
    success: (lintingOutcome && !lintingOutcome.errored) || false,
  };
}