Skip to content

Latest commit

 

History

History
135 lines (88 loc) · 3.33 KB

README.md

File metadata and controls

135 lines (88 loc) · 3.33 KB

gulp-reporter

NPM version Travis AppVeyor Coverage Status

Error report localization for: EditorConfig ESLint JSCS JSHint CssLint PostCSS TSLint

Install

npm install gulp-eslint

Usage

gulp.src('test/fixtures/eslint/invalid.js')
	.pipe(eslint())
	.pipe(reporter(options));

demo

API

reporter(options)

options.ignore

Type: Array|string|RegExp|function

Default: /[\.\-]min\.\w+$/

Glob patterns for paths to ignore. String or array of strings.

options.browser

Type: boolean

Default: false

Report error messages right in your browser.

options.console

Type: boolean|function

Default: true

Report error messages in gutil.log() or your function

options.sort

Type: boolean|function

Default: true

Messages will not be sorted by severity/line/column, or your function.

options.filter

Type: Array Default: [reporter.filterByAuthor()]

Filter Error object by your callback functions. support Async function

The default function will check the GIT author of the code that is in errors, and adjusts the error level to 'warn' if this is not related to the current author

gulp.src('test/fixtures/postcss/test.css')
	.pipe(postcss())
	.pipe(reporter({
		filter: async function (errs, file){
			await readFile(file.path);
			return errs.filter(err => err.plugin === 'stylelint');
		}
	})
)

options.beep

Type: boolean

Default: true

Make your terminal beep if an error has been reported for any file.

options.fail

Type: boolean|function

Stop a task/stream if an error has been reported for any file, but wait for all of them to be processed first.

You can use a function to determine stop or not to stop.

gulp.src('test/fixtures/postcss/test.css')
	.pipe(postcss())
	.pipe(reporter({
		fail: function(err, file) {
			return err.plugin === 'stylelint' && /^src\b/.test(file.relative);
		}
	})
)

reporter.filterByAuthor(options)

According to the author of GIT commit, downgraded each error to warning that is not commit by this author. If options are unset, It will lookup author info from environment or git log

options.name

Type: string

Default: ${GIT_AUTHOR_NAME} || git log --max-count=1 --no-merges --format=%aN

options.email

Type: string

Default: ${GIT_AUTHOR_EMAIL} || git log --max-count=1 --no-merges --format=%aE