1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-04 10:19:30 +02:00

Add eslint task. Needs eslintrc tweaking.

This commit is contained in:
Gunther Brunner 2016-01-14 21:20:54 +09:00
parent 4d0983a80f
commit 466af18058
5 changed files with 27 additions and 3 deletions

View file

@ -6,7 +6,7 @@
"comma-style": [2, "first"], "comma-style": [2, "first"],
"no-extra-semi": 2, "no-extra-semi": 2,
"no-underscore-dangle": 0, "no-underscore-dangle": 0,
"quotes": [2, "single"], "quotes": [2, "single", "avoid-escape"],
"semi": [2, "never"], "semi": [2, "never"],
"space-before-blocks": [2, "always"], "space-before-blocks": [2, "always"],
"strict": [0, "function"] "strict": [0, "function"]

View file

@ -4,6 +4,7 @@ var gulp = require('gulp')
var gutil = require('gulp-util') var gutil = require('gulp-util')
var jshint = require('gulp-jshint') var jshint = require('gulp-jshint')
var jsonlint = require('gulp-jsonlint') var jsonlint = require('gulp-jsonlint')
var eslint = require('gulp-eslint')
var standard = require('gulp-standard') var standard = require('gulp-standard')
var webpack = require('webpack') var webpack = require('webpack')
var webpackConfig = require('./webpack.config').webpack var webpackConfig = require('./webpack.config').webpack
@ -46,6 +47,28 @@ gulp.task('jsonlint', function () {
.pipe(jsonlint.reporter()) .pipe(jsonlint.reporter())
}) })
gulp.task('eslint', function () {
return gulp.src([
'lib/**/*.js'
, 'res/app/**/*.js'
, 'res/auth-ldap/**/*.js'
, 'res/auth-mock/**/*.js'
, 'res/common/**/*.js'
, 'res/test/**/*.js'
, '*.js'
, '!node_modules/**'
])
// eslint() attaches the lint output to the "eslint" property
// of the file object so it can be used by other modules.
.pipe(eslint())
// eslint.format() outputs the lint results to the console.
// Alternatively use eslint.formatEach() (see Docs).
.pipe(eslint.format())
// To have the process exit with an error code (1) on
// lint error, return the stream and pipe to failAfterError last.
.pipe(eslint.failAfterError());
});
gulp.task('jscs', function () { gulp.task('jscs', function () {
return gulp.src([ return gulp.src([
'lib/**/*.js' 'lib/**/*.js'

View file

@ -320,7 +320,7 @@ dbapi.saveUserAccessToken = function(email, token) {
dbapi.removeUserAccessToken = function(email, title) { dbapi.removeUserAccessToken = function(email, title) {
return db.run(r.table('accessTokens').getAll(email, { return db.run(r.table('accessTokens').getAll(email, {
index: 'email' index: 'email'
}).filter({"title": title}).delete()) }).filter({'title': title}).delete())
} }
dbapi.loadAccessTokens = function(email) { dbapi.loadAccessTokens = function(email) {

View file

@ -26,7 +26,7 @@ module.exports.readAll = function(stream) {
} }
function readableListener() { function readableListener() {
var chunk; var chunk
while ((chunk = stream.read())) { while ((chunk = stream.read())) {
collected = Buffer.concat([collected, chunk]) collected = Buffer.concat([collected, chunk])
} }

View file

@ -95,6 +95,7 @@
"file-loader": "^0.8.5", "file-loader": "^0.8.5",
"gulp": "^3.8.11", "gulp": "^3.8.11",
"gulp-angular-gettext": "^2.1.0", "gulp-angular-gettext": "^2.1.0",
"gulp-eslint": "^1.1.1",
"gulp-jade": "^1.0.0", "gulp-jade": "^1.0.0",
"gulp-jscs": "^3.0.2", "gulp-jscs": "^3.0.2",
"gulp-jshint": "^1.12.0", "gulp-jshint": "^1.12.0",