# gulp-stylint

> Gulp plugin for stylus stylint linter

Latest version **4.0.2** (published 2018-04-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-stylint
pnpm add gulp-stylint
yarn add gulp-stylint
bun add gulp-stylint
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.2 |
| Published | 2018-04-23 |
| First published | 2015-03-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/gulp-stylint) |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 4 |
| Unpacked size | 7.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 28 |
| Author | Daniel Husar |
| Maintainers | efrafa, rpatton, simenb |
| Keywords | gulpplugin, linter, stylint, stylus |

## Links

- npm: https://www.npmjs.com/package/gulp-stylint
- Repository: https://github.com/danielhusar/gulp-stylint
- Homepage: https://github.com/danielhusar/gulp-stylint#readme
- Issues: https://github.com/danielhusar/gulp-stylint/issues
- npm.io page: https://npm.io/package/gulp-stylint

## Dependencies (4)

- [vinyl](https://npm.io/package/vinyl.md) ^2.1.0
- [stylint](https://npm.io/package/stylint.md) 1.4.1
- [through2](https://npm.io/package/through2.md) ^2.0.1
- [plugin-error](https://npm.io/package/plugin-error.md) ^1.0.1

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 4.0.2 (latest) — 2018-04-23
- 4.0.1 — 2018-01-05
- 4.0.0 — 2016-10-08
- 3.0.0 — 2015-09-21
- 2.0.0 — 2015-08-12
- 1.1.10 — 2015-08-04
- 1.1.9 — 2015-08-04
- 1.1.8 — 2015-08-03
- 1.1.7 — 2015-07-26
- 1.1.6 — 2015-07-20
- 1.1.5 — 2015-07-19
- 1.1.4 — 2015-07-18
- 1.1.3 — 2015-05-29
- 1.1.2 — 2015-03-27
- 1.1.1 — 2015-03-26
- … 6 more at https://npm.io/package/gulp-stylint/versions

## README

# [gulp](http://gulpjs.com)-stylint [![Build Status](https://travis-ci.org/danielhusar/gulp-stylint.svg?branch=master)](https://travis-ci.org/danielhusar/gulp-stylint)

> Gulp plugin for stylus [stylint](https://github.com/rossPatton/stylint) linter


## Install

```sh
$ npm install --save-dev gulp-stylint
```


## Usage

```js
var gulp = require('gulp');
var stylint = require('gulp-stylint');

gulp.task('default', function () {
	return gulp.src('src/*.styl')
		.pipe(stylint())
		.pipe(stylint.reporter());
});
```

## Custom options

```js
var gulp = require('gulp');
var stylint = require('gulp-stylint');

gulp.task('default', function () {
	return gulp.src('src/*.styl')
		.pipe(stylint({config: '.stylintrc'}))
		.pipe(stylint.reporter());
});
```

## Reporters

### Standard
Standard reporter is just printing out the report created from `stylint` (possibly formatted by #reporter).

```js
var gulp = require('gulp');
var stylint = require('gulp-stylint');

gulp.task('default', function () {
	return gulp.src('src/*.styl')
		.pipe(stylint())
		.pipe(stylint.reporter());
});
```

#### Reporter options

##### logger
Type: `function`  
Default: `console.log`

Default warnings log function, you can use for example `gutil.log`.

```js
var gulp = require('gulp');
var stylint = require('gulp-stylint');

gulp.task('default', function () {
	return gulp.src('src/*.styl')
		.pipe(stylint())
		.pipe(stylint.reporter({ logger: gutil.log.bind(null, 'gulp-stylint:') }));
});
```

### Fail-reporter
Another reporter you can use is the `fail-reporter`. You can use it to fail the `gulp`-process in the case of linting-errors, or optionally warnings.

```js
var gulp = require('gulp');
var stylint = require('gulp-stylint');

gulp.task('default', function () {
	return gulp.src('src/*.styl')
		.pipe(stylint())
		.pipe(stylint.reporter())
		.pipe(stylint.reporter('fail'));
});
```

#### Fail-reporter options

##### failOnWarning
Type: `boolean`  
Default: `false`
If provided, fail the process not only on errors from `stylint`, but also on warnings.

```js
var gulp = require('gulp');
var stylint = require('gulp-stylint');

gulp.task('default', function () {
	return gulp.src('src/*.styl')
		.pipe(stylint())
		.pipe(stylint.reporter())
		.pipe(stylint.reporter('fail', { failOnWarning: true }));
});
```

## API

### stylint(options)

#### options
type: `object`

##### config

Type: `string`  
Default: `undefined`

Pass in path to custom rules configuration file as a string. If no configuration is passed in, it will use the `.stylintrc` file in the project root if present. If that file is not present, it will use default rules.

##### rules

type: `object`  
Default: `undefined`

Pass in an object with rules for `stylint` to lint by. This will override all default rules.

##### reporter

type: `string or object`  
Default: `undefined`

If using `rules`, and you want to use a custom reporter, you can pass in either a string with it's name, or an object containing both a string with the name, and options for it.  
If you only pass in `config`, this config can be placed in that file instead.

Example:
```js
gulp.task('default', function () {
  return gulp.src('src/*.styl')
    .pipe(stylint({
      rules: { semicolons: 'always' },
      reporter: {
        reporter: 'stylint-stylish',
        reporterOptions: {
          verbose: true
        }
      }
    }))
    .pipe(stylint.reporter());
}
```

__NOTE__: You must install the reporter yourself. E.g. `npm i -D stylint-stylish`.


## License

MIT © [Daniel Husar](https://github.com/danielhusar)

---
_Source: https://npm.io/package/gulp-stylint · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
