Socket
Socket
Sign inDemoInstall

gulp-stylelint-sourcemap

Package Overview
Dependencies
260
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    gulp-stylelint-sourcemap

Gulp plugin for running Stylelint results through various reporters.


Version published
Weekly downloads
5
decreased by-16.67%
Maintainers
2
Install size
28.1 MB
Created
Weekly downloads
 

Readme

Source

gulp-stylelint-sourcemap

This repository is forked from olegskl/gulp-stylelint. It supports source map feature.

NPM version Build Status Dependency Status

A Gulp plugin that runs stylelint results through a list of reporters.

Installation

npm install gulp-stylelint-sourcemap --save-dev

Quick start

Once you have configured stylelint (e.g. you have a .stylelintrc file), start with the following code. You will find additional configuration options below.

const gulp = require('gulp');

gulp.task('lint-css', function lintCssTask() {
  const gulpStylelint = require('gulp-stylelint-sourcemap');

  return gulp
    .src('src/**/*.css')
    .pipe(gulpStylelint({
      reporters: [
        {formatter: 'string', console: true}
      ]
    }));
});

Formatters

Below is the list of currently available stylelint formatters. Some of them are bundled with stylelint by default and exposed on gulpStylelint.formatters object. Others need to be installed. You can write a custom formatter to tailor the reporting to your needs.

  • "string" (same as gulpStylelint.formatters.string) – bundled with stylelint
  • "verbose" (same as gulpStylelint.formatters.verbose) – bundled with stylelint
  • "json" (same as gulpStylelint.formatters.json) – bundled with stylelint
  • stylelint-checkstyle-formatter – requires installation

Options

gulp-stylelint-sourcemap supports all stylelint options except files and formatter and accepts a custom set of options listed below:

const gulp = require('gulp');

gulp.task('lint-css', function lintCssTask() {
  const gulpStylelint = require('gulp-stylelint-sourcemap');
  const myStylelintFormatter = require('my-stylelint-formatter');

  return gulp
    .src('src/**/*.css')
    .pipe(gulpStylelint({
      failAfterError: true,
      reportOutputDir: 'reports/lint',
      reporters: [
        {formatter: 'verbose', console: true},
        {formatter: 'json', save: 'report.json'},
        {formatter: myStylelintFormatter, save: 'my-custom-report.txt'}
      ],
      debug: true
    }));
});
failAfterError

When set to true, the process will end with non-zero error code if any error-level warnings were raised. Defaults to true.

reportOutputDir

Base directory for lint results written to filesystem. Defaults to current working directory.

reporters

List of reporter configuration objects (see below). Defaults to an empty array.

{
  // stylelint results formatter (required):
  // - pass a function for imported, custom or exposed formatters
  // - pass a string ("string", "verbose", "json") for formatters bundled with stylelint
  formatter: myFormatter,

  // save the formatted result to a file (optional):
  save: 'text-report.txt',

  // log the formatted result to console (optional):
  console: true
}
debug

When set to true, the error handler will print an error stack trace. Defaults to false.

Source map Support

The plugin supports source map feature.

Translate file name, line and column

If a vinyl file object has a sourcemap field, this plugin translates file name, line and column of output.

Ignore files

When ignoreFiles option is specified in stylelintrc, this plugin ignores the files. ignoreFiles should be specified as a glob for translated file name.

License

MIT License

Keywords

FAQs

Last updated on 14 Oct 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc