Removed "Do No Evil" jshint and replaced with eslint.

eslint is not weighted down by the 'do no evil' license that plagues
jshint and jslint. It also replaces lintspaces. Some rules have been
explicitly deactivated and addressed in future patches.

Change-Id: I17ce9ea6c050563981dbd0d708cb8f3ec8bdbc76
This commit is contained in:
Michael Krotscheck 2015-03-04 15:49:34 -08:00
parent 48c5270094
commit 77ac547f80
4 changed files with 83 additions and 112 deletions

70
.eslintrc Normal file
View File

@ -0,0 +1,70 @@
{
// For a detailed list of all options, please see here:
// http://eslint.org/docs/configuring/
"ecmaFeatures": {
"arrowFunctions": false,
"binaryLiterals": false,
"blockBindings": false,
"defaultParams": false,
"forOf": false,
"generators": false,
"objectLiteralComputedProperties": false,
"objectLiteralDuplicateProperties": false,
"objectLiteralShorthandProperties": false,
"octalLiterals": false,
"regexUFlag": false,
"superInFunctions": false,
"templateStrings": false,
"unicodeCodePointEscapes": false,
"globalReturn": false,
"jsx": false
},
"env": {
"browser": true,
"node": false,
"amd": false,
"mocha": false,
"jasmine": true,
"phantomjs": false,
"jquery": false,
"prototypejs": false,
"shelljs": false
},
"globals": {
"require": false,
"exports": false,
"angular": false, // AngularJS
"module": false,
"inject": false,
"element": false,
"by": false,
"browser": false
},
"rules": {
"quotes": [2, "single"],
"eol-last": 2,
"no-trailing-spaces": 2,
"camelcase": 0,
"no-extra-boolean-cast": 0,
// Rules to be processed.
"no-use-before-define": 0,
"space-infix-ops": 0,
"no-shadow": 0,
"consistent-return": 0,
"space-unary-ops": 0,
"no-console": 0,
"strict": 0,
"no-underscore-dangle": 0,
"no-space-before-semi": 0,
"key-spacing": 0,
// Stylistic
"indent": [1, 4],
"max-len": [2, 80],
"no-undefined": 0
}
}

View File

@ -1,69 +0,0 @@
// Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
/**
* This file contains JSHint configuration settings, which allow us to enforce a
* coding standard programatically using jshint. It's as close to PEP-8 as we
* can get it.
*
* @see http://www.jshint.com/
*/
{
"node": true,
"browser": true,
"esnext": true,
"bitwise": true,
"camelcase": false,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 4,
"maxlen": 80,
"latedef": true,
"newcap": true,
"noarg": true,
"quotmark": "single",
"undef": true,
"unused": true,
"strict": true,
"trailing": true,
"smarttabs": true,
// Inform JSHint that the following globals are expected.
"globals": {
// Library constants
"$": false, // JQuery
"angular": false, // AngularJS
// Unit test constants
"after": false,
"afterEach": false,
"before": false,
"beforeEach": false,
"describe": false,
"expect": false,
"inject": false,
"it": false,
"spyOn": false,
"runs": false,
"waitsFor": false,
"jasmine": false,
// functional test constants
"browser": false,
"by": false,
"element": false,
"protractor": false // Protractor
}
}

View File

@ -87,17 +87,13 @@ module.exports = function (grunt) {
},
/**
* grunt jshint
* grunt eslint
*
* Runs the JSHint linter against all the javascript files in our
* project, using the .jshintrc file shared with our IDE (sublime,
* eclipse, intellij, etc)
* Runs the eslint linter against all the javascript files in our
* project, using the .eslintrc file shared with our IDE.
*/
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
eslint: {
target: [
dir.source + '/**/*.js',
dir.test + '/**/*.js',
'./*.js'
@ -121,25 +117,6 @@ module.exports = function (grunt) {
}
},
/**
* grunt newlines
*
* Checks that all js files end with a newline
*/
lintspaces: {
dist: {
src: [
dir.source + '/**/*.js',
dir.test + '/**/*.js',
'./*.js'
],
options: {
newline: true,
trailingspaces: true
}
},
},
/**
* grunt recess
*
@ -455,21 +432,13 @@ module.exports = function (grunt) {
],
tasks: ['html2js']
},
jshint: {
eslint: {
files: [
'Gruntfile.js',
dir.source + '/**/*.js',
dir.test + '/**/*.js'
],
tasks: ['jshint']
},
lintspaces: {
files: [
'Gruntfile.js',
dir.source + '/**/*.js',
dir.test + '/**/*.js'
],
tasks: ['lintspaces']
tasks: ['eslint']
},
livereload: {
options: {
@ -582,11 +551,10 @@ module.exports = function (grunt) {
* Compiles all of our sources.
*/
grunt.registerTask('compile', [
'jshint',
'eslint',
'useminPrepare',
'concat',
'less',
'lintspaces',
'imagemin',
'html2js',
'copy:dist',
@ -657,7 +625,8 @@ module.exports = function (grunt) {
grunt.log.warn('The `server` task has been deprecated. Use ' +
'`grunt serve` to start a server.');
grunt.task.run(['serve:' + target]);
});
}
);
/**
* grunt test:integration

View File

@ -16,8 +16,10 @@
"author": "Michael Krotscheck",
"license": "Apache2",
"devDependencies": {
"angularjs-eslint": "0.0.3",
"bower": "1.3.12",
"connect-livereload": "0.4.0",
"eslint": "0.15.1",
"gifsicle": "1.0.0",
"grunt": "0.4.5",
"grunt-cli": "0.1.13",
@ -29,14 +31,13 @@
"grunt-contrib-cssmin": "0.10.0",
"grunt-contrib-htmlmin": "0.3.0",
"grunt-contrib-imagemin": "0.8.1",
"grunt-contrib-jshint": "0.10.0",
"grunt-contrib-less": "0.11.4",
"grunt-contrib-uglify": "0.6.0",
"grunt-contrib-watch": "0.6.1",
"grunt-env": "0.4.1",
"grunt-eslint": "7.0.1",
"grunt-html2js": "0.2.9",
"grunt-karma": "0.9.0",
"grunt-lintspaces": "0.6.0",
"grunt-open": "0.2.3",
"grunt-protractor-runner": "1.1.4",
"grunt-shell": "1.1.1",