Skip to content

Commit 6179186

Browse files
author
De Ville Weppenaar
committed
Merge tag 'v1.0.0'
Initial version.
2 parents ae64de6 + 4610ba0 commit 6179186

File tree

3 files changed

+86
-0
lines changed

3 files changed

+86
-0
lines changed

README.md

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# ESLint Task
2+
Lint your source files with ESLint.
3+
4+
## API
5+
6+
### eslint([options])
7+
8+
#### Available options:
9+
10+
##### **src**
11+
(String|Array) Glob or array of globs ([What's a glob?](https://github.com/isaacs/node-glob#glob-primer)) matching JS files. Default: `'app/**/*.js'`.
12+
13+
##### **eslintOptions**
14+
(Object) [ESLint CLI options](http://eslint.org/docs/developer-guide/nodejs-api#cliengine). Default:
15+
```
16+
{
17+
extends: 'eslint:recommended'
18+
}
19+
```
20+
21+
You can also use a `.eslintrc` file to supply config options.
22+
23+
Order that ESLint config is applied:
24+
25+
1. .eslintrc
26+
2. Supplied config (eslintOptions)
27+
3. Default
28+
29+
## Example
30+
31+
```
32+
var eslint = require('ionic-gulp-eslint');
33+
34+
// default options
35+
gulp.task('lint', eslint);
36+
37+
// override options
38+
gulp.task('lint', function () {
39+
return eslint({ src: ['app/**/*.js'] });
40+
});
41+
```
42+
43+
44+
45+
46+

index.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
var gulp = require('gulp'),
2+
eslint = require('gulp-eslint'),
3+
assign = require('lodash.assign');
4+
5+
var defaultOptions = {
6+
src: 'app/**/*.js',
7+
eslintOptions: {
8+
extends: 'eslint:recommended'
9+
}
10+
}
11+
12+
module.exports = function (options) {
13+
options = assign(defaultOptions, options);
14+
15+
return gulp.src(options.src)
16+
.pipe(eslint(options.eslintOptions))
17+
.pipe(eslint.format());
18+
}

package.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "ionic-gulp-eslint",
3+
"version": "1.0.0",
4+
"description": "Gulp task for Ionic projects to lint code using ESLint",
5+
"author": "De Ville Weppenaar <[email protected]>",
6+
"license": "MIT",
7+
"repository": {
8+
"type": "git",
9+
"url": "https://github.com/devillex/ionic-gulp-eslint.git"
10+
},
11+
"dependencies": {
12+
"babel-eslint": "^6.0.2",
13+
"gulp": "^3.9.1",
14+
"gulp-eslint": "^2.0.0",
15+
"lodash.assign": "^4.0.6"
16+
},
17+
"keywords": [
18+
"ionic",
19+
"gulp",
20+
"eslint"
21+
]
22+
}

0 commit comments

Comments
 (0)