switch from jshint to eslint

This commit is contained in:
spalger
2016-01-08 14:18:35 -07:00
parent 7d5b0395e6
commit d0d55f8f3e
18 changed files with 16 additions and 124 deletions

6
.eslintrc Normal file
View File

@ -0,0 +1,6 @@
{
"extends": "eslint:recommended",
"env": {
"node": true
}
}

View File

@ -1,29 +0,0 @@
{
"unused": true,
"node": true,
"white": true,
"bitwise": false,
"curly": false,
"eqnull": true,
"eqeqeq": true,
"forin": true,
"immed": true,
"expr": true,
"indent": 2,
"latedef": "nofunc",
"newcap": true,
"noarg": true,
"noempty": true,
"undef": true,
"quotmark": "single",
"plusplus": false,
"boss": true,
"trailing": true,
"laxbreak": true,
"laxcomma": true,
"validthis": true,
"sub": true,
"maxlen": 140,
"-W084": true,
"maxerr": 10
}

View File

@ -21,7 +21,7 @@ coverage.html
html_docs
## just in .npmignore
.jshintrc
.eslintrc
.travis.yml
CHANGELOG.md
CONTRIBUTING.md

View File

@ -4,7 +4,7 @@ The process for contributing to any of the Elasticsearch repositories is similar
### 1. Lint your codes
While developing, be sure to run JSHint on the files you modify. This is simple with most IDE's and the project has [.jshintrc files](http://www.jshint.com/docs/) in the proper places, make sure jshint is using them.
While developing, be sure to run eslint on the files you modify.
### 2. Write tests

View File

@ -1,4 +1,3 @@
/* jshint node:true */
'use strict';
module.exports = function (grunt) {
@ -21,4 +20,4 @@ module.exports = function (grunt) {
// load task definitions
grunt.loadTasks('grunt');
};
};

View File

@ -1,14 +0,0 @@
module.exports = {
source: {
src: [
'src/**/*.js -src/elasticsearch*/**/* -<%= bowerSubmodule %>/**/*',
'scripts/**/*.js',
'test/**/*.js -test/browser_integration/yaml_tests.js',
'grunt/**/*.js',
'Gruntfile.js'
],
options: {
jshintrc: true
}
}
};

View File

@ -7,11 +7,10 @@ module.exports = {
'Gruntfile.js'
],
tasks: [
'jshint',
'mochacov:unit'
],
options: {
interrupt: true
}
}
};
};

View File

@ -12,7 +12,6 @@ module.exports = function (grunt) {
grunt.registerTask('test', function (branch) {
var tasks = [
'jshint',
branch ? 'run:generate_' + branch : 'run:generate',
'mochacov:unit'
];

View File

@ -45,6 +45,7 @@
"blanket": "~1.1.5",
"bluebird": "^2.9.14",
"browserify": "~2.35.1",
"eslint": "^1.10.3",
"expect.js": "~0.2.0",
"express": "~3.4.7",
"find-root": "~0.1.1",
@ -56,7 +57,6 @@
"grunt-contrib-compress": "~0.5.3",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-jshint": "spenceralger/grunt-contrib-jshint",
"grunt-contrib-uglify": "~0.2.7",
"grunt-contrib-watch": "~0.5.3",
"grunt-esvm": "^2.0.0",

View File

@ -39,7 +39,7 @@ var taskOut; // task output stream
task('NODE_UNIT', true, function () {
if (!JENKINS) {
return grunt('jshint', 'mochacov:ci_unit');
return grunt('mochacov:ci_unit');
}
return grunt('mochacov:jenkins_unit');
@ -319,4 +319,4 @@ function grunt(/* args... */) {
GRUNT,
_.toArray(arguments)
);
}
}

View File

@ -186,8 +186,6 @@ module.exports = [
{
version: '>=1.6.0',
/* jshint ignore:start */
// strange indentation makes pretty api files
clientActionModifier:
function (spec) {
@ -201,7 +199,5 @@ function (spec) {
});
}
/* jshint ignore:end */
}
];
];

View File

@ -1,5 +1,3 @@
/* jshint maxlen: false */
var ca = require('../client_action').<%
if (!clientActionModifier) print('factory');
@ -28,4 +26,4 @@ _.each(proxies, function (action) {%>
<%= partials.client_action_proxy(action) %><%
});
%>
%>

View File

@ -1,5 +1,3 @@
/* jshint browser: true, jquery: true */
/**
* Simple connection class for using the XHR object in browsers
*
@ -40,5 +38,3 @@ JqueryConnector.prototype.request = function (params, cb) {
jqXHR.abort();
};
};

View File

@ -12,12 +12,10 @@ var startsWithProtocolRE = /^([a-z]+:)?\/\//;
var defaultProto = 'http:';
var btoa;
/* jshint ignore:start */
if (typeof window !== 'undefined') {
defaultProto = window.location.protocol;
btoa = window.btoa;
}
/* jshint ignore:end */
btoa = btoa || function (data) {
return (new Buffer(data, 'utf8')).toString('base64');

View File

@ -1,42 +0,0 @@
{
"node": true,
"white": true,
"bitwise": false,
"curly": true,
"eqnull": true,
"eqeqeq": true,
"forin": true,
"immed": true,
"expr": true,
"indent": 2,
"latedef": "nofunc",
"newcap": true,
"noarg": true,
"noempty": true,
"undef": true,
"quotmark": "single",
"plusplus": false,
"boss": true,
"trailing": true,
"laxbreak": true,
"laxcomma": true,
"validthis": true,
"sub": true,
"maxlen": 140,
"-W084": true,
"maxerr": 10,
"-W030": true,
"-W068": true,
"globals": {
"describe": true,
"context": true,
"before": true,
"after": true,
"it": true,
"beforeEach": true,
"afterEach": true
}
}

View File

@ -3,7 +3,6 @@ var VERBOSE = process.env.VERBOSE;
var JENKINS = !!process.env.JENKINS_HOME;
if (BROWSER) {
/* jshint browser: true */
var es = window.elasticsearch;
} else {
var es = require('../../../src/elasticsearch');

View File

@ -1,5 +1,3 @@
/* jshint browser:true */
/* global ActiveXObject */
//////////////
/// Extended version of:
@ -399,7 +397,6 @@ MockHttpRequest.prototype = {
// Based on parseUri by Steven Levithan <stevenlevithan.com>
// See http://blog.stevenlevithan.com/archives/parseuri
parseUri: function (str) {
/* jshint maxlen:false */
var pattern =
/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/;
var key = ['source', 'protocol', 'authority', 'userInfo', 'user',
@ -481,4 +478,4 @@ MockHttpServer.prototype = {
handle: function (request) {
// Instances should override this.
}
};
};

View File

@ -1,10 +0,0 @@
{
"extends": "../../.jshintrc",
"browser": true,
"globals": {
"angular": true,
"module": true,
"inject": true,
"$": true
}
}