Skip to content

Commit

Permalink
chore(lint): switch from JSHint to ESLint
Browse files Browse the repository at this point in the history
Fixes mozilla#156
Switch from JSHint to ESLint
Add rules to ESLint
Also have JSHint in parallel
Add inline rules for ignoring complexity
  • Loading branch information
TDA committed Jun 13, 2015
1 parent b047e47 commit 53b75a1
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 3 deletions.
10 changes: 10 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "fxa",
"env": {
"amd": true,
"node": true
},
"rules": {
"strict": 0
}
}
4 changes: 2 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ module.exports = function (grunt) {
['intern:node', 'intern:native_node']);

grunt.registerTask('lint',
'Alias for jshint and jscs tasks',
['jshint', 'jscs']);
'Alias for eslint, jshint and jscs tasks',
['eslint', 'jshint', 'jscs']);

grunt.registerTask('default',
['build']);
Expand Down
10 changes: 10 additions & 0 deletions client/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"env": {
"amd": true,
"browser": true,
"node": false
},
"rules": {
"no-console": 0
}
}
1 change: 1 addition & 0 deletions client/FxAccountClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ define([
return credentials.setup(email, password)
.then(
function (result) {
/*eslint complexity: [2, 9] */
var endpoint = '/account/create';
var data = {
email: result.emailUTF8,
Expand Down
2 changes: 1 addition & 1 deletion client/lib/hawk.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ define(['sjcl'], function (sjcl) {
*/

header: function (uri, method, options) {

/*eslint complexity: [2, 21] */
var result = {
field: '',
artifacts: {}
Expand Down
1 change: 1 addition & 0 deletions client/lib/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ define(['./hawk', 'p', './errors'], function (hawk, P, ERRORS) {
* @return {Promise} A promise that will be fulfilled with JSON `xhr.responseText` of the request
*/
Request.prototype.send = function request(path, method, credentials, jsonPayload, options) {
/*eslint complexity: [2, 8] */
var deferred = P.defer();
var xhr = new this.xhr();
var uri = this.baseUri + path;
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
},
"devDependencies": {
"bower": "~1.3.9",
"eslint-config-fxa": "1.2.0",
"grunt": "~0.4.2",
"grunt-build-control": "git://github.com/robwierzbowski/grunt-build-control#274952",
"grunt-bump": "0.0.13",
Expand All @@ -48,6 +49,7 @@
"grunt-contrib-yuidoc": "~0.5.0",
"grunt-conventional-changelog": "~1.1.0",
"grunt-copyright": "~0.1.0",
"grunt-eslint": "14.0.0",
"grunt-jscs": "0.7.1",
"grunt-open": "~0.2.2",
"http-proxy": "~1.0.2",
Expand Down
16 changes: 16 additions & 0 deletions tasks/eslint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

module.exports = function (grunt) {
grunt.config('eslint', {
options: {
eslintrc: '.eslintrc',
src: ['Gruntfile.js', 'tasks/*.js', 'config/**/*.js', 'node/**/*.js']
},
app: {
options: {eslintrc: 'client/.eslintrc'},
src: ['client/*.js', 'client/lib/**/*']
}
});
};

0 comments on commit 53b75a1

Please sign in to comment.