Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jedrichards/gulp-jscodesniffer
Gulp plugin for the jscodesniffer project.
https://github.com/jedrichards/gulp-jscodesniffer
Last synced: 5 days ago
JSON representation
Gulp plugin for the jscodesniffer project.
- Host: GitHub
- URL: https://github.com/jedrichards/gulp-jscodesniffer
- Owner: jedrichards
- Created: 2014-03-18T19:20:37.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-03-20T14:16:23.000Z (over 10 years ago)
- Last Synced: 2024-10-05T06:43:54.853Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 125 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# gulp-jscodesniffer
Gulp plugin for the [jscodesniffer](https://github.com/dsheiko/jscodesniffer) project.
From the `jscodesniffer` docs:
> JSCodeSniffer is a node.js application that checks JavaScript code style consistency according to a provided coding style, just like phpcs. One can define a custom coding style by using described below JSON notation or use one of predefined standards.
```
npm install gulp-jscodesniffer --save-dev
```## Options
### **`standard`**
`Optional | Default:EmptyString`
A string defining a pre-made jscodesniffer coding standard. As of writing this only two pre-made standards exist, `Idiomatic` or `Jquery`. You can read more about them at the [jscodesniffer](https://github.com/dsheiko/jscodesniffer) repo.
### **`rc`**
`Optional | Default:EmptyObj`
Path to a jscodesniffer JSON configuration file. Without a defined `standard` this can be used on its own as the only source of rules. When used together with a `standard` your `rc` rules will take precedent. Here's our example [.jscsrc](https://github.com/jedrichards/gulp-jscodesniffer/blob/master/.jscsrc). Note that if you define neither a `standard` nor a `rc` then no style checking will occur.
### **`reporters`**
`Optional | Default:['default']`
An array of reporters used to process jscodesniffer output. There are three supplied reporters, which are detailed below. To use a supplied reporter add its name to the `reporters` array. You can add your own custom reporter by adding it to the array as a function (have a look at the [supplied reporters](https://github.com/jedrichards/gulp-jscodesniffer/tree/master/reporters) for help).
#### `default`
Prints out pleasantly formatted information about failures to the console.
#### `beep`
Rings your terminal bell if any failures occurred.
#### `failer`
By default this Gulp plugin will not fail its task if it encounters style breaches. Add this reporter to emit an error into the stream and fail the task.
## Usage
```javascript
var gulp = require('gulp');
var jscs = require('gulp-jscodesniffer');gulp.task('jscs',function () {
return gulp.src('src/**/*.js')
.pipe(jscs({
rc: '.jscsrc',
standard: 'Idiomatic',
reporters: ['default','beep']
}));
});
```## Tests
Run the Mocha tests:
```
npm test
```Run this project's gulpfile against its fixtures and `.jscsrc`.
```
npm run jscs
```